Skip to content

Conversation

benbardin
Copy link
Contributor

The hard-coded defaults here around job schedules are more reasonable for some unit tests.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@benbardin benbardin requested a review from dt June 26, 2025 21:28
@benbardin benbardin marked this pull request as ready for review June 26, 2025 21:28
@benbardin benbardin requested review from rafiss, jeffswenson and rickystewart and removed request for dt and jeffswenson June 26, 2025 21:46
@@ -403,7 +403,6 @@ func downloadBinaryFromTar(response *http.Response, output *os.File, filePath st
}

}
return nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unreachable code.

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"
Copy link
Contributor Author

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

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")

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.

Copy link
Contributor Author

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.

@benbardin
Copy link
Contributor Author

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.
@benbardin benbardin merged commit ea50f98 into master Jun 30, 2025
3 checks passed
@benbardin benbardin deleted the bardin-demo branch June 30, 2025 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants