-
Notifications
You must be signed in to change notification settings - Fork 75
testserver: add option to run demo mode #186
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
Conversation
@@ -403,7 +403,6 @@ func downloadBinaryFromTar(response *http.Response, output *os.File, filePath st | |||
} | |||
|
|||
} | |||
return nil |
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.
unreachable code.
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.
Nit: I would rather there be return fmt.Errorf("could not find cockroach binary in archive")
or something similar in case due to some bug it turns out to no longer be true that this is unreachable. I also don't fully understand when missing the final return
statement is a compile error or not, I'd rather that not change under our feet due to a Go upgrade or similar.
@@ -559,12 +566,7 @@ func NewTestServer(opts ...TestServerOpt) (TestServer, error) { | |||
return nil, fmt.Errorf("%s failed to parse version: %w", testserverMessagePrefix, err) | |||
} | |||
|
|||
startCmd := "start-single-node" |
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.
moved into the new else
below
@@ -403,7 +403,6 @@ func downloadBinaryFromTar(response *http.Response, output *os.File, filePath st | |||
} | |||
|
|||
} | |||
return nil |
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.
Nit: I would rather there be return fmt.Errorf("could not find cockroach binary in archive")
or something similar in case due to some bug it turns out to no longer be true that this is unreachable. I also don't fully understand when missing the final return
statement is a compile error or not, I'd rather that not change under our feet due to a Go upgrade or similar.
// TODO(janexing): Make sure the log is written to logDir instead of shown in console. | ||
// Should be done once issue #109 is solved: | ||
// https://github.com/cockroachdb/cockroach-go/issues/109 | ||
nodes[i].stdout = filepath.Join(logsBaseDir, "cockroach.stdout") |
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.
Nit: there's some mild duplication here (this whole nodes[i]
thing seems to be copy-pasted?) You could refactor into a helper function but the duplication doesn't look so severe that it seems absolutely necessary.
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.
Demo mode and regular mode have different flags, so I think a helper here might be more risky than, well, helpful. I'll add a comment in the code.
I'll add your suggestion to the unreachable-code thing, that makes sense. |
The hard-coded defaults here around job schedules are more reasonable for some unit tests.
The hard-coded defaults here around job schedules are more reasonable for some unit tests.