-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
322 additions
and
230 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# crdb-seed | ||
|
||
This is a small utility that creates a seed tarball for our CockroachDB instance | ||
in the temporary directory. It is used as a setup script for nextest (see | ||
`.config/nextest.rs`). | ||
|
||
This utility hashes inputs and attempts to reuse a tarball if it already exists | ||
(see `digest_unique_to_schema` in `omicron/test-utils/src/dev/seed.rs`). | ||
|
||
To invalidate the tarball and cause it to be recreated from scratch, set | ||
`CRDB_SEED_INVALIDATE=1` in the environment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// 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 anyhow::{Context, Result}; | ||
use dropshot::{test_util::LogContext, ConfigLogging, ConfigLoggingLevel}; | ||
use omicron_test_utils::dev::seed::{ | ||
ensure_seed_tarball_exists, should_invalidate_seed, | ||
}; | ||
use std::io::Write; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
// TODO: dropshot is v heavyweight for this, we should be able to pull in a | ||
// smaller binary | ||
let logctx = LogContext::new( | ||
"crdb_seeding", | ||
&ConfigLogging::StderrTerminal { level: ConfigLoggingLevel::Info }, | ||
); | ||
let (seed_tar, status) = | ||
ensure_seed_tarball_exists(&logctx.log, should_invalidate_seed()) | ||
.await?; | ||
status.log(&logctx.log, &seed_tar); | ||
|
||
if let Ok(env_path) = std::env::var("NEXTEST_ENV") { | ||
let mut file = std::fs::File::create(&env_path) | ||
.context("failed to open NEXTEST_ENV file")?; | ||
writeln!(file, "CRDB_SEED_TAR={seed_tar}") | ||
.context("failed to write to NEXTEST_ENV file")?; | ||
} else { | ||
slog::warn!( | ||
logctx.log, | ||
"NEXTEST_ENV not set (is this script running under nextest?)" | ||
); | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.