-
Notifications
You must be signed in to change notification settings - Fork 40
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
[nexus-test-utils] replace build.rs with a new setup script #4150
[nexus-test-utils] replace build.rs with a new setup script #4150
Conversation
Created using spr 1.3.4
Created using spr 1.3.4
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.
Looks great, thanks for doing this!
nexus/test-utils/src/db.rs
Outdated
// TODO: replace with temp dir written out by nextest | ||
// Use "out/" for now. |
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.
Isn't this happening already?
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.
Isn't this happening already?
Yes, lol. Will fix.
&ConfigLogging::StderrTerminal { level: ConfigLoggingLevel::Info }, | ||
); | ||
let dir = ensure_seed_directory_exists(&logctx.log).await; | ||
if let Ok(env_path) = std::env::var("NEXTEST_ENV") { |
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.
Out of curiosity, what sets this environment variable?
Also, if this environment variable cannot be found, should we throw an error?
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.
Out of curiosity, what sets this environment variable?
Nextest does -- it's the way setup scripts can communicate with nextest.
Also, if this environment variable cannot be found, should we throw an error?
I figured folks might want to run the script by hand. Maybe we should warn in that case.
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.
Gotcha. So someone could run this binary manually, and it would create the seed dir, but not pass the necessary info to nextest.
That makes sense -- I'm okay with this structure as-is, I just wanted to make sure it would be clear "where things went wrong" if the environment variable from nextest was not provided.
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.
I added some more logging and a warning message to make this clearer.
crdb-seed/src/main.rs
Outdated
// If the directory didn't exist when we started, try to create it. | ||
// | ||
// Note that this may be executed concurrently by many tests, so | ||
// we should consider it possible for another caller to create this | ||
// seed directory before we finish setting it up ourselves. |
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.
Is this still true, or will nextest prevent the concurrent execution of this function?
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.
Nextest will execute it once, but it's possible that the user spins up two instances of nextest at the same time. I'll update the comment.
Created using spr 1.3.4
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.
This is great! Thanks!
Nextest now has support for setup scripts, which means that we can
replace the existing
build.rs
with a small binary.I also took the liberty of switching some of the related code over to
camino.
Supersedes #4056.