Repository navigation
ci: remove repeated test runs from mongodb-rust and the integration shards - #911
Conversation
mongodb-rust passed --rust to run-mongodb-tests, which runs the whole workspace's `cargo test` against the job's server. On main's push run for 76b9710 that took 11 minutes. Building the workspace's test binaries took 3 min 54 s, and running every crate's tests took 7 minutes. The Test workflow runs the same tests on stable and on 1.88. The job now passes only --rust-integration. The tests that need MongoDB still run against a replica set: - records_live and the five migration test files run in the storage-level sections of run-mongodb-tests. Their condition now names both Rust suites. - The data_engine and backup_engine live tests and the restore fence cells run under --rust-live. - The snapshot_engine tests run in mongodb-snapshot, with EXTENDDB_TEST_MONGODB_REQUIRED set. No other workspace test reads EXTENDDB_TEST_MONGODB_URI.
The comment said that the records_live and migration sections of run-mongodb-tests run for either Rust suite. They run when the arguments name --rust or --rust-integration, and not for --all, which run-tests expands to both suites. The comment now says so, and it names the tests that mongodb-rust runs in these sections.
On the CI run of d9528e6 (run 42637473269), every shard of run-integration and run-integration-sqlite ran tests/test_backup_store_config.py and tests/test_backup_job.py by name. The two files took 2 min 52 s to 3 min 8 s on each PostgreSQL shard. The S3 mock took 22 to 28 s more. On each SQLite shard the two files took 4 min 28 s to 4 min 30 s. Each SQLite shard also ran the store configuration suite a second time inside devtools/run-tests, against an S3 mock of its own. That run took 2 min 45 s to 2 min 46 s. - PostgreSQL: the new run-integration-backup job runs the two files once, with the shards' PostgreSQL service, the S3 mock and the same environment. The integration job needs it. The CLI lifecycle list of devtools/run-tests still runs the store configuration suite's PostgreSQL cells on one shard. - SQLite: the shards run neither file. devtools/run-tests skips its SQLite backup store block in a run with --shard. The shards no longer start the S3 mock, whose one reader was that block. run-integration-sqlite-s3 runs both files on the same build with the S3 mock. On run 42637473269 it passed every test that a SQLite shard passed in either of those runs. The timeout comments give the measured times and the projected time of a shard.
navareamol
left a comment
There was a problem hiding this comment.
I think two things stop running or change after this branch meets main, and the timing numbers are out of date.
-
crates/storage-mongodb/tests/secret_rows.rswas added to main after your base. On main run 45436870054, mongodb-rust runs it inside the workspacecargo testagainst the replica set: "3 passed" in 3.79 s. After this change nothing runs it against a server:run-mongodb-testslists records_live, the migration files, metrics_store and (under--rust-live) iam_leftovers, andgrep secret_rowsover .github and devtools finds nothing. The Test workflow has no MongoDB server. Could the storage-level section run every test target of the crate (cargo test -p extenddb-storage-mongodb --tests, withEXTENDDB_TEST_MONGODB_REQUIRED=1), the way the PostgreSQL storage job uses--tests? A hand-written list will drop the next new file the same way. -
The comments give the new job "about 4 min" with a 15 minute bound, and shard times of 13 to 14 minutes. On 75 PostgreSQL shard runs on main today, the backup suites step took 7.5 to 9.5 minutes (6.0 to 7.5 on SQLite), because
tests/test_backup_job.pygrew by about 3500 lines since your base. I expect the new job to take about 11 minutes with setup, which leaves 4 minutes under the bound. Could you rebase, rerun CI, and set the bound and the comment numbers from the new run? I think 25 minutes is safer. -
devtools/run-testsline 693 still liststests/test_backup_store_config.pyin the CLI lifecycle list, andrun-integration-backupruns the whole file again, so the PostgreSQL cells run twice (about 8 s of the first). Is that intended? -
devtools/run-mongodb-testsline 53 still shows--rust-live -- --rust --rust-integrationas the example, which runs the workspace tests that CI dropped. The description also names 1.88.0 as the second Test toolchain; main now uses 1.91.1.
I will approve once the storage-level section covers secret_rows (or every test target of the crate), and the branch is rebased with CI green and the timing comments and the new job's bound matching the new run.
The storage-level section of run-mongodb-tests listed seven test files. Main added tests/secret_rows.rs after this branch's base, and after the merge nothing ran it against a server. mongodb-rust no longer runs the workspace `cargo test`, and the Test workflow has no MongoDB server, so the file's three tests skip there. The section now runs `cargo test -p extenddb-storage-mongodb --tests` with EXTENDDB_TEST_MONGODB_URI and EXTENDDB_TEST_MONGODB_REQUIRED=1, so a new file under tests/ runs without an edit. It skips the snapshot_engine unit tests, which mongodb-snapshot runs. With REQUIRED set, a_standalone_server_is_unsupported fails when EXTENDDB_TEST_MONGODB_STANDALONE_URI is unset, and cargo then stops before the files under tests/. The --rust-live section ran tests/iam_leftovers.rs one test at a time, and the storage-level section now runs it too. Neither the commit that added the serial run nor #923 gives a reason for it. Each test makes databases of its own, and main's mongodb-rust job ran both tests in parallel in its workspace `cargo test` (run 45436870031). This commit removes that section, and the file's comment now says which arguments set REQUIRED.
The three timing comments gave this branch's run of 9 Nov. Since then tests/test_backup_job.py grew from 1543 to 4712 lines on main. Main ran the Integration workflow for 25 pushes from 18 to 25 Nov. In those runs the backup store and job suites step took 7.3 to 9.1 minutes on the PostgreSQL shards. On the SQLite shards it took 5.9 to 7.5 minutes. With the 61 s of steps before it, the longest of those runs leaves run-integration-backup about 5 minutes under a 15-minute bound. run-integration-backup now stops at 25 minutes. The comments of the two shard jobs and of run-integration-backup give main's step and job times with their date range.
Under --shard, the CLI lifecycle list of run-tests still named tests/test_backup_store_config.py, so one PostgreSQL shard ran the file's PostgreSQL cells without the S3 mock. run-integration-backup runs the whole file with the mock, so those cells ran twice in each CI run. The list now takes the file only in a run without --shard, as the SQLite block already does. A local run without --shard keeps it. The --shard help, the comments beside the list and the comment of run-integration-backup say so.
The usage example still passed --rust, which runs the workspace `cargo test` that mongodb-rust no longer runs. It now shows the job's line, `--rust-live -- --rust-integration`. This also corrects two sentences of the message of d9528e6 for the tree after the merge of main. The Test workflow's second toolchain is now 1.91.1, not 1.88. tests/secret_rows.rs, which main added after this branch's base, also reads EXTENDDB_TEST_MONGODB_URI, and 7e7918c runs it.
|
Thanks, all four hold.
|
navareamol
left a comment
There was a problem hiding this comment.
I approve. Checked at acdab4e, with main at a417b2f already merged into the branch.
- The storage-level section now runs
cargo test -p extenddb-storage-mongodb --tests -- --skip snapshot_engine::with the replica set andEXTENDDB_TEST_MONGODB_REQUIRED=1. Against a local replica set the lib tests (178) and all 11 test files ran,secret_rowsincluded (3 passed). In CI the mongodb-rust job shows the same counts and takes 20.6 minutes, against 29 to 32 on main. Listing the command with--listshows every file under tests/, and a file I dropped in was picked up. Naming only one--testmakes the check report ten files missing. - run-integration-backup has a 25 minute bound. I recomputed main's runs from 18 to 25 Nov: the suites take 7.3 to 9.1 minutes on the PostgreSQL shards, so the bound is about 2.5 times the slowest run. On this head the job took 8.2 minutes.
tests/test_backup_store_config.pyis no longer in the sharded CLI list. CI's shard check passes.- bash -n, shellcheck and actionlint report nothing the PR added. The 62 checks pass.
One optional point: devtools/run-mongodb-tests --rust-live on its own no longer runs iam_leftovers, because the section only runs for --rust and --rust-integration. CI always passes --rust-integration.
Changes since the last review
navareamol reviewed d833c71 on 24 November. The commits since then:
1d4930a75merges main ata417b2f82. No file conflicted. The merge bringscrates/storage-mongodb/tests/secret_rows.rs(feat(auth): wrap the credential encryption key with a KEK kept outside the catalog #1003), the serialiam_leftoversrun under--rust-live(fix(iam): delete what a principal or account owns with it #923) and the 15th workspace crate,crates/wasm-adapter(feat(wasm): [Add WebAssembly browser support for ExtendDB #1009).7e7918cb2makes the storage-level section ofdevtools/run-mongodb-testsrun every test target ofextenddb-storage-mongodb,secret_rowsincluded. It removes the serialiam_leftoversrun, which repeated a file that the section now runs.c8b865862setstimeout-minutes: 25on run-integration-backup. The timing comments of the three jobs give main's figures from 18 to 25 November.4f7d84380removestests/test_backup_store_config.pyfrom the CLI lifecycle list ofdevtools/run-testsin a run with--shard.acdab4ee9gives CI's arguments,--rust-live -- --rust-integration, as the usage example ofdevtools/run-mongodb-tests. Its message also corrects two sentences of the message ofd9528e6bdfor the tree after the merge: the second Test toolchain is 1.91.1, andsecret_rows.rsalso readsEXTENDDB_TEST_MONGODB_URI.What
Two jobs ran tests that CI also runs elsewhere in the same run.
mongodb-rust
CI's mongodb-rust job no longer runs the whole workspace's
cargo test. It randevtools/run-mongodb-tests --rust-live -- --rust --rust-integration. The--rustsuite ofdevtools/run-testsrunscargo testover all 15 workspace crates. The job now runsdevtools/run-mongodb-tests --rust-live -- --rust-integration.devtools/run-mongodb-testsnow names both Rust suites in the condition of its storage-level sections. The old condition matched the substring--rust, which--rust-integrationalso contains. Without--rust, the old condition selects these sections only because of that match. The new condition names--rust-integration, so the job does not depend on the substring.The storage-level sections run records_live and every test target of
extenddb-storage-mongodb. The second section runscargo test -p extenddb-storage-mongodb --tests -- --skip snapshot_engine::withEXTENDDB_TEST_MONGODB_URIandEXTENDDB_TEST_MONGODB_REQUIRED=1, as the PostgreSQL storage job runs--tests. A new file undercrates/storage-mongodb/tests/runs there without an edit. Before, the section named seven files, andsecret_rows.rs, which main added after this branch's base, was not among them.The skip omits the 12 snapshot_engine unit tests, which the mongodb-snapshot job runs. One of them,
a_standalone_server_is_unsupported, needs a standalone server, which mongodb-snapshot starts beside its replica set. WithEXTENDDB_TEST_MONGODB_REQUIREDset andEXTENDDB_TEST_MONGODB_STANDALONE_URIunset, it fails.The
--rust-livesection no longer runstests/iam_leftovers.rswith--test-threads=1. The storage-level section runs the file with the default thread count.The integration shards
Every shard of run-integration (PostgreSQL) and run-integration-sqlite ran
tests/test_backup_store_config.pyandtests/test_backup_job.pyby name. Each SQLite shard also ran the store configuration suite insidedevtools/run-tests.--shard, the CLI lifecycle list ofdevtools/run-testsomits the store configuration suite. A run without--shardkeeps it.devtools/run-testsskips its SQLite backup store block in a run with--shard. The shards no longer start the S3 mock, whose one reader was that block. run-integration-sqlite-s3 already ran both files on the same build with an S3 mock.run-integration-backup stops at 25 minutes.
Against main, the PR adds 149 lines and removes 106 in five files. None of them is production code.
Why
No issue tracks this change.
The mongodb-integration check waits for six jobs, and mongodb-rust finishes last. On main's push run 45436870031 (24 November, 89fc971), the workspace
cargo testsection took 10 min 3 s of the job's 28 min 51 s. The Test workflow runs the same test binaries on stable and on 1.91.1.The integration check waits for the shards. Main ran the Integration workflow for 25 pushes from 18 to 25 November. In those runs the backup store and job suites step took 7.3 to 9.1 minutes on the PostgreSQL shards. The 74 PostgreSQL shard jobs that passed took 20.0 to 27.9 minutes. On the SQLite shards the step took 5.9 to 7.5 minutes, and the 75 shard jobs took 20.6 to 29.3 minutes.
tests/test_backup_job.pyhas 4712 lines on main and had 1543 at this branch's base.The measurements below are from 9 November, before the merge of main. On main's push run for 96a6b6f (MongoDB run 42630213888), the workspace
cargo testtook 12.2 of mongodb-rust's 31.8 minutes. Cargo compiled the test binaries in 4 min 58 s and ran them in 7 min 12 s.On this PR's run for d9528e6 (run 42637473269, 9 November), the PostgreSQL shards took 16 min 52 s to 18 min 14 s. The two files took 2 min 52 s to 3 min 8 s of that, and their S3 mock 22 to 28 s more. The SQLite shards took 20 min 6 s to 21 min 52 s. The two files took 4 min 28 s to 4 min 30 s of that. The run inside
devtools/run-teststook 2 min 45 s to 2 min 46 s more. The projection from that run without these files was 13 min 38 s to 14 min 44 s for a PostgreSQL shard. For a SQLite shard it was 12 min 26 s to 14 min 7 s.Testing done
CI on acdab4e
CI passed on this head, 62 of 62 checks. In MongoDB run 45561928546, mongodb-rust ran the storage-level section, and
tests/secret_rows.rspassed 3 tests there. Job times in minutes, from Integration run 45561928654 and that MongoDB run, 25 November:Both runs waited about 48 minutes for their first runner. So their times from the start of each workflow run are not comparable with the 9 November tables below.
mongodb-rust
EXTENDDB_TEST_MONGODB_REQUIRED=1.--rust-live.EXTENDDB_TEST_MONGODB_REQUIRED=1.devtools/run-mongodb-testsran locally at 7e7918c, with the arguments--rust-integration, against a MongoDB 7 replica set on 127.0.0.1. The later commits change neither the sections nor the crate. records_live passed 7 tests. The--testsline passed 178 unit tests and every file undertests/. It skipped the 12 snapshot_engine tests, and the 84#[ignore]d live tests stayed ignored:--testscommand without the skip failed.a_standalone_server_is_unsupportedpanicked withEXTENDDB_TEST_MONGODB_REQUIRED is set but EXTENDDB_TEST_MONGODB_STANDALONE_URI is not; the standalone test must run, not skip. cargo then stopped before the files undertests/.iam_leftoversrun when it moved the tests fromsrc/totests/. It kept--test-threads=1from the old--lib -- --ignoredline. Neither its commits nor its review give a reason for the serial run. Each test creates databases of its own, named after the process id, a counter and the test. Main's mongodb-rust job ran both tests in parallel in its workspacecargo test(run 45436870031), and so did the local run above.EXTENDDB_TEST_MONGODB_URIorEXTENDDB_TEST_MONGODB_REQUIRED. The Test workflow runs every test binary of the workspacecargo test. It has no MongoDB server, so the tests that need one skip there.EXTENDDB_ADMIN_USERandEXTENDDB_ADMIN_PASSWORD, which run-mongodb-tests exports. When the environment has them, an in-memory or dev SQLite open in crates/storage-sqlite passes them tobootstrap_dev_rows. On this branch before the merge of main, the workspace tests passed both with and without them.--rust,--rust-integration,--rust --rust-integration,--pytest --comprehensive --paralleland--pytest --parallel --filter backup. They also give the same result for all 255 combinations of the eight suite flags of run-tests.bash -npasses on devtools/run-mongodb-tests. shellcheck reports one info finding there: SC2329, for thecleanupfunction thattrapcalls. Main's copy of the script gives the same finding.cargo testin mongodb-rust=== Rust tests (debug)section.The integration shards
devtools/run-testspassed 13 tests of the store configuration suite.extenddb initon a catalog of its own.devtools/run-testsruns the store configuration suite in a run without--shard. For shards 1/3 and 2/3 it prints a skip line.devtools/run-testsat acdab4e, namestests/test_backup_store_config.pyin a run without--shard. With--shard 1/3, and with--shard 2/3 --filter backup, it does not. For shards 1/3 to 3/3,devtools/test-shards preparecollected 37 tests in five files from that list.devtools/test-shards checkover the three legs passed.iof seven server waits (7).bash -npasses on devtools/run-tests. shellcheck gives the same finding there as on main's copy, SC2034 forprefix_upper.devtools/run-testspassed 12 and skipped 5, and its run by name passed 28 and skipped 4. Each SQLite shard printed the skip line.Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a
Breaking changes
None.
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.