Skip to content
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

Respect KNEX_TEST, support omitting sqlite3 from DB, and reduce outside mssql test db config #4313

Merged
merged 3 commits into from
Feb 24, 2021

Conversation

jeremy-w
Copy link
Contributor

This PR contains several changes that simplify getting a green test run in a fresh checkout by eliminating some unexpected behavior around KNEX_TEST and DB config.

Before, if DB omitted sqlite3, several of the CLI tests would fail, because only some of them conditionally skipped when sqlite3 config was not available. Now, all of those tests skip when sqlite3 tests are not selected.

Before, some of the DB integration tests did not use the config supplied in KNEX_TEST. Now, all run by test:db do.

Before, the mssql transaction isolation tests required, not just a test DB, but also a test DB with snapshot isolation already enabled. This led to test failures due to having a test DB without that config already set up. Now, that test suite ensures snapshot isolation is enabled upfront before running its tests.

There is no documentation PR; the main intent of this PR is to align test suite behavior with the existing documentation around how the DB and KNEX_TEST environment variables affect test running.

The KNEX_TEST config handling is identical to that already performed
by test/knexfile.js.

This ensures that connection configuration information for the test
environment is consistent across the db:test suite.
Before, some of the tests in the suite remembered to skip if the
config was unavailable, but others did not.

Now, the skip decision is made at the describe-level, removing the
need to remember to check-and-skip from each individual test.
Before, the tests relied on outside config to enable this.

Now, the suite performs the needed config itself.

This enables the test suite to succeed after a simple create database
call, without the tester needing to know about the need to alter
the database to enable snapshot isolation.
@jeremy-w
Copy link
Contributor Author

Spurious test failure: db:start on Travis failed due to:

ERROR: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit

@kibertoad
Copy link
Collaborator

@jeremy-w Yeah, ignore the Travis part, it is extremely flaky and probably will stop working altogether at some point.

@@ -10,6 +10,14 @@ describe('Transaction', () => {
const tableName = 'key_value';
before(() => {
knex = getKnexForDb(db);

if (isMssql(knex)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we still need the Docker config part then? I think it was originally added precisely because it was not clear how to do that on per-test basis.

@kibertoad kibertoad merged commit 3718d64 into knex:master Feb 24, 2021
@kibertoad
Copy link
Collaborator

thanks!

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.

None yet

2 participants