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

ndc-test nix improvements and Chinook data fixes #43

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 8 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 13 additions & 2 deletions arion-compose/project-ndc-test.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, config, ... }:

let
mongodb-port = "27017";
Expand All @@ -9,10 +9,21 @@ in
services = {
test = import ./service-connector.nix {
inherit pkgs;
command = "test";
command = ["test"];
# Record snapshots into the snapshots dir
# 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;
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
service.user = builtins.toString config.host.uid;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey that's handy!

extra-volumes = [
# Mount the snapshots directory in the repo source tree into the container
# so that ndc-test can read/write in it
"./snapshots:/snapshots:rw"
];
};

mongodb = import ./service-mongodb.nix {
Expand Down
8 changes: 4 additions & 4 deletions arion-compose/service-connector.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
, port ? "7130"
, profile ? "dev" # Rust crate profile, usually either "dev" or "release"
, hostPort ? null
, command ? "serve"
, command ? ["serve"]
, configuration-dir ? ../fixtures/connector/sample_mflix
, database-uri ? "mongodb://mongodb/sample_mflix"
, service ? { } # additional options to customize this service configuration
, otlp-endpoint ? null
, extra-volumes ? [],
}:

let
Expand All @@ -26,8 +27,7 @@ let
command = [
# mongodb-connector is added to pkgs via an overlay in flake.nix
"${connector-pkg}/bin/mongodb-connector"
command
];
] ++ command;
ports = pkgs.lib.optionals (hostPort != null) [
"${hostPort}:${port}" # host:container
];
Expand All @@ -41,7 +41,7 @@ let
};
volumes = [
"${configuration-dir}:/configuration:ro"
];
] ++ extra-volumes;
healthcheck = {
test = [ "CMD" "${pkgs.pkgsCross.linux.curl}/bin/curl" "-f" "http://localhost:${port}/health" ];
start_period = "5s";
Expand Down
2 changes: 1 addition & 1 deletion fixtures/connector/chinook/schema/Employee.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"ReportsTo": {
"type": {
"nullable": {
"scalar": "string"
"scalar": "int"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions fixtures/connector/chinook/schema/Invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
},
"Total": {
"type": {
"scalar": "double"
"scalar": "decimal"
}
},
"_id": {
Expand All @@ -72,4 +72,4 @@
"description": "Object type for collection Invoice"
}
}
}
}
4 changes: 2 additions & 2 deletions fixtures/connector/chinook/schema/InvoiceLine.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"UnitPrice": {
"type": {
"scalar": "double"
"scalar": "decimal"
}
},
"_id": {
Expand All @@ -42,4 +42,4 @@
"description": "Object type for collection InvoiceLine"
}
}
}
}
4 changes: 2 additions & 2 deletions fixtures/connector/chinook/schema/Track.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
},
"UnitPrice": {
"type": {
"scalar": "double"
"scalar": "decimal"
}
},
"_id": {
Expand All @@ -70,4 +70,4 @@
"description": "Object type for collection Track"
}
}
}
}
Loading