Skip to content

Commit

Permalink
move postgres tests to other-db-tests (#108)
Browse files Browse the repository at this point in the history
### What

We'd like to have all of the tests in the same place. This also helps
with compilation time.

### How

- Copy citus
- Fill in missing tests and make sure all snapshots are renames
- Remove ndc-postgres/tests
- Fix references
  • Loading branch information
Gil Mizrahi committed Oct 26, 2023
1 parent 038a2ae commit 24033b1
Show file tree
Hide file tree
Showing 91 changed files with 316 additions and 341 deletions.
22 changes: 11 additions & 11 deletions .github/test-configuration.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
{
"ndc-postgres-citus": {
"package": "ndc-postgres",
"feature": "citus",
"flags": "",
"services": "citus",
"env": {
"POSTGRESQL_CONNECTION_STRING": "postgresql://postgres:password@localhost:64004"
}
},
"ndc-postgres-cockroach": {
"package": "ndc-postgres",
"feature": "cockroach",
"flags": "",
"services": "cockroach",
"env": {
"POSTGRESQL_CONNECTION_STRING": "postgresql://postgres:password@localhost:64003/defaultdb"
}
},
"ndc-postgres-12": {
"package": "ndc-postgres",
"flags": "-E 'not test(test_configure)'",
"feature": "postgres",
"flags": "-E 'not test(configure_initial_configuration_is_unchanged) and not test(configure_is_idempotent)'",
"services": "postgres",
"env": {
"POSTGRESQL_CONNECTION_STRING": "postgresql://postgres:password@localhost:64002",
"POSTGRESQL_VERSION": "12"
}
},
"ndc-postgres-13": {
"package": "ndc-postgres",
"flags": "-E 'not test(test_configure)'",
"feature": "postgres",
"flags": "-E 'not test(configure_initial_configuration_is_unchanged) and not test(configure_is_idempotent)'",
"services": "postgres",
"env": {
"POSTGRESQL_CONNECTION_STRING": "postgresql://postgres:password@localhost:64002",
"POSTGRESQL_VERSION": "13"
}
},
"ndc-postgres-14": {
"package": "ndc-postgres",
"flags": "-E 'not test(test_configure)'",
"feature": "postgres",
"flags": "-E 'not test(configure_initial_configuration_is_unchanged) and not test(configure_is_idempotent)'",
"services": "postgres",
"env": {
"POSTGRESQL_CONNECTION_STRING": "postgresql://postgres:password@localhost:64002",
"POSTGRESQL_VERSION": "14"
}
},
"ndc-postgres-15": {
"package": "ndc-postgres",
"flags": "-E 'not test(test_configure)'",
"feature": "postgres",
"flags": "-E 'not test(configure_initial_configuration_is_unchanged) and not test(configure_is_idempotent)'",
"services": "postgres",
"env": {
"POSTGRESQL_CONNECTION_STRING": "postgresql://postgres:password@localhost:64002",
"POSTGRESQL_VERSION": "15"
}
},
"ndc-postgres-16": {
"package": "ndc-postgres",
"feature": "postgres",
"flags": "",
"services": "postgres",
"env": {
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/cargo-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ jobs:

- name: run tests
run: |
cargo nextest run --no-fail-fast --release -p ${{ env.PACKAGE_NAME }} ${{ env.TEST_FLAGS }}
cargo nextest run --no-fail-fast --release -p other-db-tests --features ${{ env.FEATURE_NAME }} ${{ env.TEST_FLAGS }}
env:
POSTGRESQL_CONNECTION_STRING: ${{ fromJSON(steps.configuration.outputs.configuration).env.POSTGRESQL_CONNECTION_STRING }}
PACKAGE_NAME: ${{ fromJSON(steps.configuration.outputs.configuration).package }}
FEATURE_NAME: ${{ fromJSON(steps.configuration.outputs.configuration).feature }}
TEST_FLAGS: ${{ fromJSON(steps.configuration.outputs.configuration).flags }}
RUST_LOG: INFO

Expand Down Expand Up @@ -152,13 +152,14 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.BROKEN_BUILD_SLACK_WEBHOOK_URL }}

test-ndc-postgres-with-yugabyte:
test-ndc-postgres-with-database:
strategy:
matrix:
database:
- yugabyte
- postgres
- citus
- cockroach
- yugabyte
name: "test connector (ndc-postgres on ${{ matrix.database }})"
runs-on: ubuntu-latest
env:
Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions crates/connectors/ndc-postgres/tests/capabilities_tests.rs

This file was deleted.

28 changes: 0 additions & 28 deletions crates/connectors/ndc-postgres/tests/common/mod.rs

This file was deleted.

76 changes: 0 additions & 76 deletions crates/connectors/ndc-postgres/tests/configuration_tests.rs

This file was deleted.

33 changes: 0 additions & 33 deletions crates/connectors/ndc-postgres/tests/explain_tests.rs

This file was deleted.

29 changes: 0 additions & 29 deletions crates/connectors/ndc-postgres/tests/mutation_tests.rs

This file was deleted.

48 changes: 0 additions & 48 deletions crates/connectors/ndc-postgres/tests/ndc_tests.rs

This file was deleted.

7 changes: 0 additions & 7 deletions crates/connectors/ndc-postgres/tests/schema_tests.rs

This file was deleted.

This file was deleted.

4 changes: 4 additions & 0 deletions crates/tests/other-db-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ yugabyte = []
cockroach = []
# We only run the Citus tests if this feature is enabled.
citus = []
# We only run the PostgreSQL tests if this feature is enabled.
postgres = []

[dependencies]
ndc-postgres = { path = "../../connectors/ndc-postgres" }
ndc-test = { git = "https://github.com/hasura/ndc-spec.git", tag = "v0.1.0-rc.8" }
tests-common = { path = "../tests-common" }

axum = "0.6.19"
insta = { version = "1.34.0", features = ["json"] }
schemars = { version = "0.8.15", features = ["smol_str", "preserve_order"] }
tokio = { version = "1.33.0", features = ["full"] }
7 changes: 7 additions & 0 deletions crates/tests/other-db-tests/src/capabilities_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[cfg(test)]
mod capabilities_tests {
#[tokio::test]
async fn get_capabilities() {
insta::assert_json_snapshot!(ndc_postgres::capabilities::get_capabilities());
}
}
4 changes: 2 additions & 2 deletions crates/tests/other-db-tests/src/citus/configuration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ mod configuration_tests {
use tests_common::common_tests;

#[tokio::test]
async fn test_configure() {
common_tests::configuration_tests::test_configure(
async fn test_configure_is_idempotent() {
common_tests::configuration_tests::configure_is_idempotent(
common::CONNECTION_STRING,
common::CHINOOK_DEPLOYMENT_PATH,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ mod configuration_tests {
use tests_common::common_tests;

#[tokio::test]
async fn test_configure() {
common_tests::configuration_tests::test_configure(
async fn test_configure_is_idempotent() {
common_tests::configuration_tests::configure_is_idempotent(
common::CONNECTION_STRING,
common::CHINOOK_DEPLOYMENT_PATH,
)
Expand Down
Loading

0 comments on commit 24033b1

Please sign in to comment.