Skip to content

Commit

Permalink
feat: expose DownloadBinary function
Browse files Browse the repository at this point in the history
  • Loading branch information
alnr authored and rafiss committed Mar 2, 2023
1 parent e5902a9 commit c97ddc6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions testserver/binaries.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ func GetDownloadResponse(desiredVersion string, nonStable bool) (*http.Response,
return response, desiredVersion, nil
}

// downloadBinary saves the latest version of CRDB into a local binary file,
// DownloadBinary saves the latest version of CRDB into a local binary file,
// and returns the path for this local binary.
// To download a specific cockroach version, specify desiredVersion. Otherwise,
// the latest stable or non-stable version will be chosen.
// To download the latest STABLE version of CRDB, set `nonStable` to false.
// To download the bleeding edge version of CRDB, set `nonStable` to true.
func downloadBinary(tc *TestConfig, desiredVersion string, nonStable bool) (string, error) {
func DownloadBinary(tc *TestConfig, desiredVersion string, nonStable bool) (string, error) {
response, desiredVersion, err := GetDownloadResponse(desiredVersion, nonStable)
if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion testserver/testserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ func NewTestServer(opts ...TestServerOpt) (TestServer, error) {
serverArgs.cockroachBinary = cockroachBinary
}
} else {
serverArgs.cockroachBinary, err = downloadBinary(&serverArgs.testConfig, serverArgs.customVersion, serverArgs.nonStableDB)
serverArgs.cockroachBinary, err = DownloadBinary(&serverArgs.testConfig, serverArgs.customVersion, serverArgs.nonStableDB)
if err != nil {
if errors.Is(err, errStoppedInMiddle) {
// If the testserver is intentionally killed in the middle of downloading,
Expand Down

0 comments on commit c97ddc6

Please sign in to comment.