1- //go:build !arm64
2-
31// Copyright 2018 Google LLC All Rights Reserved.
42//
53// Licensed under the Apache License, Version 2.0 (the "License");
@@ -58,9 +56,8 @@ const (
5856// out the gcloud dependency of gcloudSource. The exec package does this, too.
5957//
6058// See: https://www.joeshaw.org/testing-with-os-exec-and-testmain/
61- //
62- // TODO(#908): This doesn't work on arm64 or darwin for some reason.
6359func TestMain (m * testing.M ) {
60+ gcloudBin = os .Args [0 ]
6461 switch os .Getenv ("GO_TEST_MODE" ) {
6562 case "" :
6663 // Normal test mode
@@ -112,7 +109,7 @@ func TestGcloudErrors(t *testing.T) {
112109
113110 for _ , tc := range cases {
114111 t .Run (tc .env , func (t * testing.T ) {
115- GetGcloudCmd = newGcloudCmdMock (tc .env )
112+ getGcloudCmd = newGcloudCmdMock (tc .env )
116113
117114 if _ , err := NewGcloudAuthenticator (ctx ); err == nil {
118115 t .Errorf ("wanted error, got nil" )
@@ -129,7 +126,7 @@ func TestGcloudSuccess(t *testing.T) {
129126 var b bytes.Buffer
130127 logs .Debug .SetOutput (& b )
131128
132- GetGcloudCmd = newGcloudCmdMock ("success" )
129+ getGcloudCmd = newGcloudCmdMock ("success" )
133130
134131 auth , err := NewGcloudAuthenticator (ctx )
135132 if err != nil {
@@ -203,7 +200,7 @@ func TestKeychainGCRandAR(t *testing.T) {
203200 Keychain = & googleKeychain {}
204201
205202 // Gcloud should succeed.
206- GetGcloudCmd = newGcloudCmdMock ("success" )
203+ getGcloudCmd = newGcloudCmdMock ("success" )
207204
208205 if auth , err := Keychain .Resolve (mustRegistry (tc .host )); err != nil {
209206 t .Errorf ("expected success for %v, got: %v" , tc .host , err )
@@ -214,7 +211,7 @@ func TestKeychainGCRandAR(t *testing.T) {
214211 }
215212
216213 // Make gcloud fail to test that caching works.
217- GetGcloudCmd = newGcloudCmdMock ("badoutput" )
214+ getGcloudCmd = newGcloudCmdMock ("badoutput" )
218215
219216 if auth , err := Keychain .Resolve (mustRegistry (tc .host )); err != nil {
220217 t .Errorf ("expected success for %v, got: %v" , tc .host , err )
@@ -232,7 +229,7 @@ func TestKeychainError(t *testing.T) {
232229 t .Fatalf ("unexpected err os.Setenv: %v" , err )
233230 }
234231
235- GetGcloudCmd = newGcloudCmdMock ("badoutput" )
232+ getGcloudCmd = newGcloudCmdMock ("badoutput" )
236233
237234 // Reset the keychain to ensure we don't cache earlier results.
238235 Keychain = & googleKeychain {}
0 commit comments