Skip to content

Commit e5902a9

Browse files
alnrrafiss
authored andcommitted
Add support for ARM64 binaries on Linux and macOS
1 parent 246d034 commit e5902a9

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

testserver/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# cockroach-go Testserver
22

33
The `testserver` package helps running cockroachDB binary with tests. It
4-
automatically downloads the latest stable cockroach binary for your runtimeOS
5-
(Linux-amd64 and Darwin-amd64 only for now), or attempts to run "cockroach" from your PATH.
4+
automatically downloads the latest stable cockroach binary for your runtimeOS,
5+
or attempts to run "cockroach" from your PATH.
66

77
### Example
88
To run the test server, call `NewTestServer(opts)` and with test server options.
@@ -63,4 +63,4 @@ NewTestServer()`.
6363

6464
### Test Server for Multi Tenants
6565
The usage of test server as a tenant server is still under development. Please
66-
check `testserver/tenant.go` for more information.
66+
check `testserver/tenant.go` for more information.

testserver/binaries.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ const (
4646
)
4747

4848
const (
49-
linuxUrlpat = "https://binaries.cockroachdb.com/cockroach-v%s.linux-amd64.tgz"
50-
macUrlpat = "https://binaries.cockroachdb.com/cockroach-v%s.darwin-10.9-amd64.tgz"
49+
linuxUrlpat = "https://binaries.cockroachdb.com/cockroach-v%s.linux-%s.tgz"
50+
macUrlpat = "https://binaries.cockroachdb.com/cockroach-v%s.darwin-%s-%s.tgz"
5151
winUrlpat = "https://binaries.cockroachdb.com/cockroach-v%s.windows-6.2-amd64.zip"
5252
sourceUrlPat = "https://binaries.cockroachdb.com/cockroach-v%s.src.tgz)"
5353
)
@@ -266,9 +266,14 @@ func getLatestStableVersionInfo() (string, string, error) {
266266
func getDownloadUrlForVersion(version string) string {
267267
switch runtime.GOOS {
268268
case "linux":
269-
return fmt.Sprintf(linuxUrlpat, version)
269+
return fmt.Sprintf(linuxUrlpat, version, runtime.GOARCH)
270270
case "darwin":
271-
return fmt.Sprintf(macUrlpat, version)
271+
switch runtime.GOARCH {
272+
case "arm64":
273+
return fmt.Sprintf(macUrlpat, version, "11.0", runtime.GOARCH)
274+
case "amd64":
275+
return fmt.Sprintf(macUrlpat, version, "10.9", runtime.GOARCH)
276+
}
272277
case "windows":
273278
return fmt.Sprintf(winUrlpat, version)
274279
}

testserver/testserver.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
// permissions and limitations under the License.
1414

1515
// Package testserver provides helpers to run a cockroach binary within tests.
16-
// It automatically downloads the latest cockroach binary for your platform
17-
// (Linux-amd64 and Darwin-amd64 only for now), or attempts to run "cockroach"
18-
// from your PATH.
16+
// It automatically downloads the latest cockroach binary for your platform,
17+
// or attempts to run "cockroach" from your PATH.
1918
//
2019
// To use, run as follows:
2120
//

0 commit comments

Comments
 (0)