-
Notifications
You must be signed in to change notification settings - Fork 43
Optimize CockroachDB setup for tests (96% reduction) #493
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
Changes from all commits
082c009
444aaa0
42727a7
d1c1345
54b6f68
6850f67
c736fe0
05aed1b
304d03d
61d3fd3
a992ee8
c5427aa
fea3cd9
0153e19
0bcdc28
52b31c6
a0c88a4
43b75c9
3dd98d8
419d89e
7b9dc1b
9ad763c
1b19c57
4f9feef
8eb0549
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,6 @@ default-members = [ | |
"common", | ||
"nexus", | ||
"nexus/src/db/db-macros", | ||
"nexus/test-utils", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: this has been removed from the default members, but we're definitely still using / testing it. This just means that Note: This still gets built with |
||
"package", | ||
"rpaths", | ||
"sled-agent", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
use dropshot::{test_util::LogContext, ConfigLogging, ConfigLoggingLevel}; | ||
use omicron_test_utils::dev::test_setup_database_seed; | ||
|
||
// Creates a "pre-populated" CockroachDB storage directory, which | ||
// subsequent tests can copy instead of creating themselves. | ||
// | ||
// Is it critical this happens at build-time? No. However, it | ||
// makes it more convenient for tests to assume this seeded | ||
// directory exists, rather than all attempting to create it | ||
// concurrently. | ||
// | ||
// Refer to the documentation of [`test_setup_database_seed`] for | ||
// more context. | ||
#[tokio::main] | ||
async fn main() { | ||
println!("cargo:rerun-if-changed=build.rs"); | ||
println!("cargo:rerun-if-changed=../../common/src/sql/dbinit.sql"); | ||
println!("cargo:rerun-if-changed=../../tools/cockroachdb_checksums"); | ||
println!("cargo:rerun-if-changed=../../tools/cockroachdb_version"); | ||
|
||
let logctx = LogContext::new( | ||
"crdb_seeding", | ||
&ConfigLogging::StderrTerminal { level: ConfigLoggingLevel::Info }, | ||
); | ||
|
||
test_setup_database_seed(&logctx.log).await; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change here - and in the ".github/workflows/rust.yml" file - just make sure
cockroach
is downloaded and on the PATH before wecargo build --all-targets
, since we're now using it in a build script.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the README to reflect this? Basically this part:
I think that should now say "the build and test suite expect..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated