← 输入框|github.com|刷新
Skip to content

Run the Postgres query plan test only if Postgres is available - #1380

Open
555aaditya wants to merge 1 commit into
sqlancer:mainfrom
555aaditya:fix/gate-postgres-query-plan-test
Open

555aaditya wants to merge 1 commit into
sqlancer:mainfrom
555aaditya:fix/gate-postgres-query-plan-test

Conversation

@555aaditya

Copy link
Copy Markdown

TestPostgresQueryPlan.testPostgresQueryPlan creates tables in a Postgres server, but, unlike TestPostgresQPG and the CockroachDB, TiDB, and Materialize query plan tests, it is not skipped when POSTGRES_AVAILABLE is unset. So mvn test fails on a machine without that server. CI avoids this only because the misc job excludes sqlancer.qpg.**.

This PR skips testPostgresQueryPlan unless POSTGRES_AVAILABLE=true, using TestConfig.isEnvironmentTrue like the tests in sqlancer.dbms. testFormatQueryPlan does not need a server, so it keeps running everywhere.

Checked on macOS (arm64), OpenJDK 11.0.33, Maven 3.10.1, on a machine with an unrelated local Postgres 14 that has no sqlancer role:

  • on main, mvn -Djacoco.skip=true -Dtest=TestPostgresQueryPlan test: testPostgresQueryPlan errors with PSQLException: FATAL: role "sqlancer" does not exist (2 run, 1 error).
  • with this change: 2 run, 0 failures, 1 skipped (testPostgresQueryPlan); testFormatQueryPlan runs and passes.
  • with this change and POSTGRES_AVAILABLE=true: the test runs again and fails with the same role error on this machine, so the gate does open. I did not run it against a correctly configured Postgres.
  • mvn -B verify -DskipTests=true: BUILD SUCCESS. python3 src/check_names.py: exit 0.

CI does not run this test at all (there is no Postgres QPG job), so this does not change CI.

@mrigger

testPostgresQueryPlan connects to a Postgres server, but unlike the other query plan and QPG tests it was not skipped when POSTGRES_AVAILABLE is not set, so mvn test failed on machines without that server. Skip only this test, because testFormatQueryPlan does not need a server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant