Skip to content

Commit

Permalink
Merge branch 'main' into update-hive-gw-links
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan authored Nov 1, 2024
2 parents d13f271 + ccbe0f0 commit e5646de
Show file tree
Hide file tree
Showing 11 changed files with 446 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This repository contains a set of tests to evaluate and compare the compatibilit
| [Apollo Gateway](https://www.apollographql.com/) | 97.08% | 🟢 166 ❌ 5 | 🟢 38 ❌ 3 |
| [Cosmo Router](https://wundergraph.com) | 72.51% | 🟢 124 ❌ 47 | 🟢 19 ❌ 22 |
| [Grafbase Gateway](https://grafbase.com) | 59.65% | 🟢 102 ❌ 69 | 🟢 19 ❌ 22 |
| [Inigo Gateway](https://inigo.io) | 46.78% | 🟢 80 ❌ 91 | 🟢 12 ❌ 29 |

<!-- gateways:end -->

Expand Down
94 changes: 94 additions & 0 deletions REPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| [Apollo Gateway](https://www.apollographql.com/) | 97.08% | 🟢 166 ❌ 5 | 🟢 38 ❌ 3 |
| [Cosmo Router](https://wundergraph.com) | 72.51% | 🟢 124 ❌ 47 | 🟢 19 ❌ 22 |
| [Grafbase Gateway](https://grafbase.com) | 59.65% | 🟢 102 ❌ 69 | 🟢 19 ❌ 22 |
| [Inigo Gateway](https://inigo.io) | 46.78% | 🟢 80 ❌ 91 | 🟢 12 ❌ 29 |

## Detailed Results

Expand Down Expand Up @@ -480,3 +481,96 @@ You can look at the full list of tests [here](./src/test-suites/). Every test id
<a href="./src/test-suites/union-intersection">union-intersection</a>
<pre>🟢🟢🟢❌❌🟢❌❌</pre>
</details>

<a id="inigo-gateway"></a>

### Inigo Gateway

- [Repository](https://github.com/inigolabs)
- [Website](https://inigo.io)

<details>
<summary>Results</summary>
<a href="./src/test-suites/abstract-types">abstract-types</a>
<pre>🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢❌❌</pre>
<a href="./src/test-suites/child-type-mismatch">child-type-mismatch</a>
<pre>❌❌❌🟢</pre>
<a href="./src/test-suites/circular-reference-interface">circular-reference-interface</a>
<pre>🟢🟢</pre>
<a href="./src/test-suites/complex-entity-call">complex-entity-call</a>
<pre>❌</pre>
<a href="./src/test-suites/corrupted-supergraph-node-id">corrupted-supergraph-node-id</a>
<pre>🟢❌❌❌❌🟢🟢🟢🟢🟢</pre>
<a href="./src/test-suites/enum-intersection">enum-intersection</a>
<pre>❌❌❌❌❌</pre>
<a href="./src/test-suites/fed1-external-extends">fed1-external-extends</a>
<pre>🟢🟢</pre>
<a href="./src/test-suites/fed1-external-extends-resolvable">fed1-external-extends-resolvable</a>
<pre>❌</pre>
<a href="./src/test-suites/fed1-external-extension">fed1-external-extension</a>
<pre>🟢🟢</pre>
<a href="./src/test-suites/fed2-external-extends">fed2-external-extends</a>
<pre>🟢🟢</pre>
<a href="./src/test-suites/fed2-external-extension">fed2-external-extension</a>
<pre>🟢🟢</pre>
<a href="./src/test-suites/include-skip">include-skip</a>
<pre>🟢🟢🟢🟢</pre>
<a href="./src/test-suites/input-object-intersection">input-object-intersection</a>
<pre>🟢❌❌</pre>
<a href="./src/test-suites/interface-object-with-requires">interface-object-with-requires</a>
<pre>❌❌❌❌❌❌❌</pre>
<a href="./src/test-suites/keys-mashup">keys-mashup</a>
<pre>❌</pre>
<a href="./src/test-suites/mutations">mutations</a>
<pre>🟢🟢❌</pre>
<a href="./src/test-suites/mysterious-external">mysterious-external</a>
<pre>🟢🟢</pre>
<a href="./src/test-suites/nested-provides">nested-provides</a>
<pre>❌❌</pre>
<a href="./src/test-suites/node">node</a>
<pre>🟢</pre>
<a href="./src/test-suites/non-resolvable-interface-object">non-resolvable-interface-object</a>
<pre>🟢🟢🟢🟢🟢❌❌</pre>
<a href="./src/test-suites/null-keys">null-keys</a>
<pre>❌</pre>
<a href="./src/test-suites/override-type-interface">override-type-interface</a>
<pre>❌❌🟢🟢</pre>
<a href="./src/test-suites/override-with-requires">override-with-requires</a>
<pre>🟢🟢🟢🟢</pre>
<a href="./src/test-suites/parent-entity-call">parent-entity-call</a>
<pre>🟢</pre>
<a href="./src/test-suites/parent-entity-call-complex">parent-entity-call-complex</a>
<pre>❌</pre>
<a href="./src/test-suites/provides-on-interface">provides-on-interface</a>
<pre>❌❌</pre>
<a href="./src/test-suites/provides-on-union">provides-on-union</a>
<pre>❌❌</pre>
<a href="./src/test-suites/requires-interface">requires-interface</a>
<pre>❌❌❌❌❌</pre>
<a href="./src/test-suites/requires-requires">requires-requires</a>
<pre>🟢🟢🟢🟢🟢</pre>
<a href="./src/test-suites/requires-with-argument">requires-with-argument</a>
<pre>❌❌❌❌❌</pre>
<a href="./src/test-suites/requires-with-fragments">requires-with-fragments</a>
<pre>❌❌❌❌❌❌</pre>
<a href="./src/test-suites/shared-root">shared-root</a>
<pre>❌❌</pre>
<a href="./src/test-suites/simple-entity-call">simple-entity-call</a>
<pre>❌</pre>
<a href="./src/test-suites/simple-inaccessible">simple-inaccessible</a>
<pre>🟢🟢❌❌</pre>
<a href="./src/test-suites/simple-interface-object">simple-interface-object</a>
<pre>❌❌❌❌❌❌❌❌❌❌❌❌❌</pre>
<a href="./src/test-suites/simple-override">simple-override</a>
<pre>❌🟢</pre>
<a href="./src/test-suites/simple-requires-provides">simple-requires-provides</a>
<pre>🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢</pre>
<a href="./src/test-suites/typename">typename</a>
<pre>❌❌❌❌❌❌</pre>
<a href="./src/test-suites/unavailable-override">unavailable-override</a>
<pre>❌🟢</pre>
<a href="./src/test-suites/union-interface-distributed">union-interface-distributed</a>
<pre>❌❌🟢🟢🟢🟢🟢</pre>
<a href="./src/test-suites/union-intersection">union-intersection</a>
<pre>❌❌❌❌❌❌❌❌</pre>
</details>
6 changes: 6 additions & 0 deletions gateways/inigo-gateway/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/subgraphs/*.graphql
/inigo
/inigo_gateway
/supergraph.graphql
/local.yaml
/subgraphs.json
7 changes: 7 additions & 0 deletions gateways/inigo-gateway/gateway.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Inigo Gateway",
"repository": "https://github.com/inigolabs",
"website": "https://inigo.io",
"graphql": "http://127.0.0.1:4000/graphql",
"health": "http://127.0.0.1:4000/health"
}
6 changes: 6 additions & 0 deletions gateways/inigo-gateway/gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
listen_port: 4000
graphql_route: /graphql

health_check:
enable: true
path: /health
35 changes: 35 additions & 0 deletions gateways/inigo-gateway/inigo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { writeFileSync, readFileSync, readdirSync, unlinkSync } from "node:fs";

for (const file of readdirSync("subgraphs")) {
if (file.endsWith(".graphql")) {
unlinkSync(`subgraphs/${file}`);
}
}

const subgraphs: Array<{
name: string;
url: string;
sdl: string;
}> = JSON.parse(readFileSync("subgraphs.json", "utf-8"));

let yaml = `
kind: Gateway
name: audit
label: dev
spec:
composition: ApolloFederation_v2
services:
`;

for (const subgraph of subgraphs) {
writeFileSync(`subgraphs/${subgraph.name}.graphql`, subgraph.sdl, "utf-8");

yaml += `
- name: ${subgraph.name}
url: ${subgraph.url}
schema_files:
- ./subgraphs/${subgraph.name}.graphql
`;
}

writeFileSync("local.yaml", yaml, "utf-8");
164 changes: 164 additions & 0 deletions gateways/inigo-gateway/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
#!/bin/sh

set -u

# Inigo has no install.sh script, so I took the install.sh script from the router gateway
# and modified it to download the Inigo binary instead of the router binary

BINARY_DOWNLOAD_PREFIX="https://github.com/inigolabs/artifacts/releases/download"

DOWNLOAD_VERSION="v0.30.14"

download_binaries() {
downloader --check
need_cmd mktemp
need_cmd chmod
need_cmd mkdir
need_cmd rm
need_cmd rmdir
need_cmd tar
need_cmd which
need_cmd dirname
need_cmd awk
need_cmd cut

get_architecture || return 1
_arch="$RETVAL"
assert_nz "$_arch" "arch"

_tardir="$DOWNLOAD_VERSION/cli_${_arch}"
_url="$BINARY_DOWNLOAD_PREFIX/${_tardir}.tar.gz"

_dir="$(mktemp -d 2>/dev/null || ensure mktemp -d -t tmp_bin)"
_file="$_dir/input.tar.gz"

say "Downloading inigo from $_url ..." 1>&2

ensure mkdir -p "$_dir"
downloader "$_url" "$_file"
if [ $? != 0 ]; then
say "Failed to download $_url"
exit 1
fi

ensure tar xf "$_file" -C "$_dir"

ls -l "$_dir"

_cli_outfile="./inigo"
_cli="$_dir/inigo"

say "Moving $_cli to $_cli_outfile ..."
mv "$_cli" "$_cli_outfile"

_retval=$?

say ""

_gateway_outfile="./inigo_gateway"
_gateway="$_dir/inigo_gateway"

say "Moving $_gateway to $_gateway_outfile ..."
mv "$_gateway" "$_gateway_outfile"

_retval=$?

say ""

ignore rm -rf "$_dir"

return "$_retval"
}

get_architecture() {
case $(uname -ms) in
'Darwin x86_64')
target=darwin_all
;;
'Darwin arm64')
target=darwin_all
;;
'Linux arm64')
target=linux_arm64
;;
'Linux aarch64')
target=linux_amd64
;;
'Linux x86_64' | *)
target=linux_amd64
;;
esac

RETVAL="$target"
}

say() {
green=$(tput setaf 2 2>/dev/null || echo '')
reset=$(tput sgr0 2>/dev/null || echo '')
echo "$1"
}

err() {
red=$(tput setaf 1 2>/dev/null || echo '')
reset=$(tput sgr0 2>/dev/null || echo '')
say "${red}ERROR${reset}: $1" >&2
exit 1
}

need_cmd() {
if ! check_cmd "$1"
then err "Installation halted. Reason: [command not found '$1' - please install this command]"
fi
}

check_cmd() {
command -v "$1" > /dev/null 2>&1
return $?
}

need_ok() {
if [ $? != 0 ]; then err "$1"; fi
}

assert_nz() {
if [ -z "$1" ]; then err "assert_nz $2"; fi
}

# Run a command that should never fail. If the command fails execution
# will immediately terminate with an error showing the failing
# command.
ensure() {
"$@"
need_ok "command failed: $*"
}

# This is just for indicating that commands' results are being
# intentionally ignored. Usually, because it's being executed
# as part of error handling.
ignore() {
"$@"
}

# This wraps curl or wget. Try curl first, if not installed,
# use wget instead.
downloader() {
if check_cmd curl
then _dld=curl
elif check_cmd wget
then _dld=wget
else _dld='curl or wget' # to be used in error message of need_cmd
fi

if [ "$1" = --check ]
then need_cmd "$_dld"
elif [ "$_dld" = curl ]
then curl -sSfL "$1" -o "$2"
elif [ "$_dld" = wget ]
then wget "$1" -O "$2"
else err "Unknown downloader" # should not reach here
fi
}

download_binaries "$@" || exit 1

echo "success"
Loading

0 comments on commit e5646de

Please sign in to comment.