-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
roachtest: replace roachtest run --dry-run #30994
Conversation
The first commit is #30146. |
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 unfortunately removes functionality: roachtest run -n
vs roachtest bench -n
.
Reviewed 4 of 4 files at r1.
Reviewable status:complete! 0 of 0 LGTMs obtained
pkg/cmd/roachtest/main.go, line 43 at r2 (raw file):
return fmt.Errorf("cannot specify both an existing cluster (%s) and --local", clusterName) } if !dryrun {
This was useful, though, as it prevented trying to find the roachprod
and workload
binaries if you weren't running a test. I think you'll want to refactor where initBinaries
is performed so that it is only done if we're actually running tests.
5f6df2d
to
bb28afe
Compare
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.
roachtest bench
... who knew. Added roachtest list --bench
.
Reviewable status:
complete! 0 of 0 LGTMs obtained
pkg/cmd/roachtest/main.go, line 43 at r2 (raw file):
Previously, petermattis (Peter Mattis) wrote…
This was useful, though, as it prevented trying to find the
roachprod
andworkload
binaries if you weren't running a test. I think you'll want to refactor whereinitBinaries
is performed so that it is only done if we're actually running tests.
good catch. I left it here, but made it conditional on the command.
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 think it is good that you got rid of the dryrun
variable infecting the run
implementation. But I'm less thrilled about the user ergonomics of list
and list --bench
. A --dry-run
flag is reasonably common in tools. Did you consider leaving the flag in place, but changing the implementation to be similar to what you've implemented for listCmd
? That is, the runCmd
function would contain something like:
if dryrun {
names := r.ListAll(args)
for _, name := range names {
fmt.Println(name)
}
} else {
os.Exit(r.Run(args))
}
Reviewable status:
complete! 0 of 0 LGTMs obtained
pkg/cmd/roachtest/main.go, line 48 at r4 (raw file):
"store-gen": {}, } if _, ok := needsBinaries[cmd.Name()]; ok {
Nit: I think this is cleaner as a switch
:
switch cmd.Name() {
case "run", "bench", "store-gen":
initBinaries()
}
bb28afe
to
e9aac4e
Compare
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 have considered it.
--dry-run
may be common enough for simple tools, but I don't think roachtest
qualifies (particularly as I'm trying to make it more complex). This tool should allocate a cluster pool, then run tests through a scheduler. Were a --dry-run
to exist, it'd be unclear (to me as a user) what parts should run and what parts shouldn't: how would it interact with the --parallelism and --count flags, for example?
Also, through the run()
decontamination, I've also changed the output format of list/--dry-run
- it no longer prints stuff like [PASS]
which is a big deal as far as expectations from this tool go.
Basically, to quote a living classic, to consider --dry-run
making sense with run
I have to squint so hard my eyes would be closed.
Having said all this, I'll change it if you insist.
Reviewable status:
complete! 0 of 0 LGTMs obtained
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 don't feel strongly about --dry-run
and you raise good points. Another approach would be to replace --dry-run
with --list
. That is run --list
, bench --list
, etc. Feel free to ignore this suggestion.
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale)
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... still prefer a top-level command (particularly as you have a good suggestion elsewhere about also optionally printing the cluster spec for each test, which I might do).
Merging on Monday.
Reviewable status:
complete! 1 of 0 LGTMs obtained
pkg/cmd/roachtest/main.go, line 48 at r4 (raw file):
Previously, petermattis (Peter Mattis) wrote…
Nit: I think this is cleaner as a
switch
:switch cmd.Name() { case "run", "bench", "store-gen": initBinaries() }
done
... with a dedicated `roachtest list`. The dryrun argument was polluting and indenting the code. Release note: None
e9aac4e
to
3f14d9a
Compare
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.
bors r+
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale)
30994: roachtest: replace roachtest run --dry-run r=andreimatei a=andreimatei ... with a dedicated `roachtest list`. The dryrun argument was polluting and indenting the code. Release note: None Co-authored-by: Andrei Matei <[email protected]>
Build succeeded |
... with a dedicated
roachtest list
.The dryrun argument was polluting and indenting the code.
Release note: None