这是indexloc提供的服务,不要输入任何密码
Skip to content

update integration fixtures to work with latest cli #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 40 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c9bd591
Update ndc-models and ndc-sdk to v0.1.3
dmoverton Jun 6, 2024
44a82d4
Fix build
dmoverton Jun 6, 2024
82c6726
Fix test build
dmoverton Jun 7, 2024
a0cf93f
Update to ndc v0.1.4
dmoverton Jun 13, 2024
d6039a5
Fix build
dmoverton Jun 13, 2024
af93888
Fix tests
dmoverton Jun 13, 2024
eec7782
Merge remote-tracking branch 'origin/main' into dmoverton/ndc-spec-0.1.3
dmoverton Jun 13, 2024
da4ad4f
Merge branch 'main' into dmoverton/ndc-spec-0.1.3
hallettj Jun 13, 2024
95d9c37
Merge branch 'main' into dmoverton/ndc-spec-0.1.3
hallettj Jun 13, 2024
c34dca0
generate supergraph
hallettj Jun 13, 2024
3d379cf
set supergraph context
hallettj Jun 13, 2024
a639574
set up subgraphs and connectors
hallettj Jun 13, 2024
d8896bb
introspect databases
hallettj Jun 13, 2024
9e49129
copy over sample_mflix config
hallettj Jun 13, 2024
1e8bedb
introspect chinook
hallettj Jun 13, 2024
3ab36a1
copy over chinook config
hallettj Jun 13, 2024
ff1291a
add dataconnector links
hallettj Jun 13, 2024
4ec6b10
write schema info to dataconnector metadata
hallettj Jun 13, 2024
dfbe449
copy over metadata
hallettj Jun 13, 2024
7a231e9
update dataconnector links
hallettj Jun 13, 2024
5cd7f2f
update sample_mflix models
hallettj Jun 13, 2024
1ada7da
update chinook models
hallettj Jun 13, 2024
9f235fd
wip:
hallettj Jun 18, 2024
bd73c45
Merge branch 'main' into jesse/make-fixtures-updatable-with-cli
hallettj Jul 9, 2024
e3a8744
run init with latest cli
hallettj Jul 9, 2024
a49e536
more updates for latest cli
hallettj Jul 10, 2024
5e8cef8
pull ddn updates for sample_mflix
hallettj Jul 10, 2024
a24af0a
ddn updates for chinook
hallettj Jul 10, 2024
87b2fd2
update arion to point to new fixtures
hallettj Jul 10, 2024
9d1bcf1
only one Double!
hallettj Jul 10, 2024
360950a
set up remote relationship
hallettj Jul 10, 2024
628b5c4
remove old fixtures
hallettj Jul 10, 2024
d0f9b9f
remove some stuff
hallettj Jul 10, 2024
9b60698
only one Double!
hallettj Jul 10, 2024
87f547b
remove unused env vars
hallettj Jul 10, 2024
ff72518
delete more things
hallettj Jul 10, 2024
4d608ff
update sample_mflix schema with non-nullable settings
hallettj Jul 10, 2024
5851b45
update sample_mflix metadata again after restarting connector
hallettj Jul 10, 2024
d8ebf70
Merge branch 'main' into jesse/make-fixtures-updatable-with-cli
hallettj Jul 11, 2024
1bc8a91
Merge branch 'main' into jesse/make-fixtures-updatable-with-cli
hallettj Jul 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.hml linguist-language=yaml
4 changes: 2 additions & 2 deletions arion-compose/e2e-testing.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ in

connector = import ./services/connector.nix {
inherit pkgs;
configuration-dir = ../fixtures/connector/chinook;
configuration-dir = ../fixtures/hasura/chinook/connector/chinook;
database-uri = "mongodb://mongodb/chinook";
port = connector-port;
service.depends_on.mongodb.condition = "service_healthy";
Expand All @@ -38,7 +38,7 @@ in
inherit pkgs;
port = engine-port;
connectors.chinook = "http://connector:${connector-port}";
ddn-dirs = [ ../fixtures/ddn/chinook ];
ddn-dirs = [ ../fixtures/hasura/chinook/metadata ];
service.depends_on = {
auth-hook.condition = "service_started";
};
Expand Down
10 changes: 5 additions & 5 deletions arion-compose/integration-test-services.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ in
{
connector = import ./services/connector.nix {
inherit pkgs otlp-endpoint;
configuration-dir = ../fixtures/connector/sample_mflix;
configuration-dir = ../fixtures/hasura/sample_mflix/connector/sample_mflix;
database-uri = "mongodb://mongodb/sample_mflix";
port = connector-port;
hostPort = hostPort connector-port;
Expand All @@ -32,7 +32,7 @@ in

connector-chinook = import ./services/connector.nix {
inherit pkgs otlp-endpoint;
configuration-dir = ../fixtures/connector/chinook;
configuration-dir = ../fixtures/hasura/chinook/connector/chinook;
database-uri = "mongodb://mongodb/chinook";
port = connector-chinook-port;
hostPort = hostPort connector-chinook-port;
Expand Down Expand Up @@ -62,9 +62,9 @@ in
sample_mflix = "http://connector:${connector-port}";
};
ddn-dirs = [
../fixtures/ddn/chinook
../fixtures/ddn/sample_mflix
../fixtures/ddn/remote-relationships_chinook-sample_mflix
../fixtures/hasura/chinook/metadata
../fixtures/hasura/sample_mflix/metadata
../fixtures/hasura/common/metadata
];
service.depends_on = {
auth-hook.condition = "service_started";
Expand Down
2 changes: 1 addition & 1 deletion arion-compose/ndc-test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ in
# command = ["test" "--snapshots-dir" "/snapshots" "--seed" "1337_1337_1337_1337_1337_1337_13"];
# Replay and test the recorded snapshots
# command = ["replay" "--snapshots-dir" "/snapshots"];
configuration-dir = ../fixtures/connector/chinook;
configuration-dir = ../fixtures/hasura/chinook/connector/chinook;
database-uri = "mongodb://mongodb:${mongodb-port}/chinook";
service.depends_on.mongodb.condition = "service_healthy";
# Run the container as the current user so when it writes to the snapshots directory it doesn't write as root
Expand Down
2 changes: 1 addition & 1 deletion arion-compose/services/connector.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
, profile ? "dev" # Rust crate profile, usually either "dev" or "release"
, hostPort ? null
, command ? ["serve"]
, configuration-dir ? ../../fixtures/connector/sample_mflix
, configuration-dir ? ../../fixtures/hasura/sample_mflix/connector/sample_mflix
, database-uri ? "mongodb://mongodb/sample_mflix"
, service ? { } # additional options to customize this service configuration
, otlp-endpoint ? null
Expand Down
3 changes: 2 additions & 1 deletion arion-compose/services/engine.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# a `DataConnectorLink.definition.name` value in one of the given `ddn-dirs`
# to correctly match up configuration to connector instances.
, connectors ? { sample_mflix = "http://connector:7130"; }
, ddn-dirs ? [ ../../fixtures/ddn/subgraphs/sample_mflix ]
, ddn-dirs ? [ ../../fixtures/hasura/sample_mflix/metadata ]
, auth-webhook ? { url = "http://auth-hook:3050/validate-request"; }
, otlp-endpoint ? "http://jaeger:4317"
, service ? { } # additional options to customize this service configuration
Expand Down Expand Up @@ -65,6 +65,7 @@ let
auth-config = pkgs.writeText "auth_config.json" (builtins.toJSON {
version = "v1";
definition = {
allowRoleEmulationBy = "admin";
mode.webhook = {
url = auth-webhook.url;
method = "Post";
Expand Down
17 changes: 17 additions & 0 deletions fixtures/hasura/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"customizations": {
"vscode": {
"extensions": [
"HasuraHQ.hasura"
],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"terminal.integrated.shellArgs.linux": [
"-l"
]
}
}
},
"name": "Hasura DDN Codespace",
"postCreateCommand": "curl -L https://graphql-engine-cdn.hasura.io/ddn/cli/v2/get.sh | bash"
}
2 changes: 2 additions & 0 deletions fixtures/hasura/.hasura/context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
context:
supergraph: ../supergraph.yaml
5 changes: 5 additions & 0 deletions fixtures/hasura/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"HasuraHQ.hasura"
]
}
13 changes: 13 additions & 0 deletions fixtures/hasura/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"configurations": [
{
"cwd": "${workspaceFolder}",
"name": "DDN Dev",
"preLaunchTask": "dev",
"program": "${workspaceFolder}",
"request": "launch",
"type": "node"
}
],
"version": "0.2.0"
}
26 changes: 26 additions & 0 deletions fixtures/hasura/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"tasks": [
{
"args": [
"watch",
"--dir",
"."
],
"command": "ddn",
"label": "watch",
"options": {
"cwd": "${workspaceFolder}"
},
"presentation": {
"clear": true,
"close": false,
"focus": true,
"panel": "new",
"reveal": "always"
},
"problemMatcher": [],
"type": "shell"
}
],
"version": "2.0.0"
}
35 changes: 35 additions & 0 deletions fixtures/hasura/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# MongoDB Connector Hasura fixtures

This directory contains example DDN and connector configuration which is used to
run integration tests in this repo, and supports local development.

Instead of having docker compose configurations in this directory, supporting
services are run using arion configurations defined at the top level of the
repo. Before running ddn commands bring up services with:

```sh
arion up -d
```

## Cheat Sheet

We have two subgraphs, and two connector configurations. So a lot of these
commands are repeated for each subgraph + connector combination.

Run introspection to update connector configuration:

```sh
$ ddn connector introspect --connector sample_mflix/connector/sample_mflix/connector.yaml

$ ddn connector introspect --connector chinook/connector/chinook/connector.yaml
```

Update Hasura metadata based on connector configuration
(after restarting connectors with `arion up -d` if there were changes from
introspection):

```sh
$ ddn connector-link update sample_mflix --subgraph sample_mflix/subgraph.yaml --env-file sample_mflix/.env.sample_mflix --add-all-resources

$ ddn connector-link update chinook --subgraph chinook/subgraph.yaml --env-file chinook/.env.chinook --add-all-resources
```
1 change: 1 addition & 0 deletions fixtures/hasura/chinook/.env.chinook
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHINOOK_CONNECTOR_URL='http://localhost:7131'
1 change: 1 addition & 0 deletions fixtures/hasura/chinook/connector/chinook/.ddnignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
1 change: 1 addition & 0 deletions fixtures/hasura/chinook/connector/chinook/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MONGODB_DATABASE_URI="mongodb://localhost/chinook"
7 changes: 7 additions & 0 deletions fixtures/hasura/chinook/connector/chinook/configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"introspectionOptions": {
"sampleSize": 100,
"noValidatorSchema": false,
"allSchemaNullable": false
}
}
8 changes: 8 additions & 0 deletions fixtures/hasura/chinook/connector/chinook/connector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kind: Connector
version: v1
definition:
name: chinook
subgraph: chinook
source: hasura/mongodb:v0.1.0
context: .
envFile: .env
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,43 @@ definition:
dataConnectorScalarType: Int
representation: Int
graphql:
comparisonExpressionTypeName: IntComparisonExp
comparisonExpressionTypeName: Chinook_IntComparisonExp

---
kind: ScalarType
version: v1
definition:
name: Chinook_Double
graphql:
typeName: Chinook_Double

---
kind: DataConnectorScalarRepresentation
version: v1
definition:
dataConnectorName: chinook
dataConnectorScalarType: Double
representation: Double
graphql:
comparisonExpressionTypeName: Chinook_DoubleComparisonExp

---
kind: ScalarType
version: v1
definition:
name: Decimal
graphql:
typeName: Chinook_Decimal

---
kind: DataConnectorScalarRepresentation
version: v1
definition:
dataConnectorName: chinook
dataConnectorScalarType: Decimal
representation: Decimal
graphql:
comparisonExpressionTypeName: Chinook_DecimalComparisonExp

---
kind: DataConnectorScalarRepresentation
Expand All @@ -34,7 +70,7 @@ definition:
dataConnectorScalarType: String
representation: String
graphql:
comparisonExpressionTypeName: StringComparisonExp
comparisonExpressionTypeName: Chinook_StringComparisonExp

---
kind: ScalarType
Expand All @@ -54,12 +90,3 @@ definition:
graphql:
comparisonExpressionTypeName: Chinook_ExtendedJsonComparisonExp

---
kind: DataConnectorScalarRepresentation
version: v1
definition:
dataConnectorName: chinook
dataConnectorScalarType: Float
representation: Float
graphql:
comparisonExpressionTypeName: FloatComparisonExp
Loading
Loading