1- //go:build !arm64
2- // +build !arm64
3-
41// Copyright 2018 Google LLC All Rights Reserved.
52//
63// Licensed under the Apache License, Version 2.0 (the "License");
@@ -59,9 +56,8 @@ const (
5956// out the gcloud dependency of gcloudSource. The exec package does this, too.
6057//
6158// See: https://www.joeshaw.org/testing-with-os-exec-and-testmain/
62- //
63- // TODO(#908): This doesn't work on arm64 or darwin for some reason.
6459func TestMain (m * testing.M ) {
60+ gcloudBin = os .Args [0 ]
6561 switch os .Getenv ("GO_TEST_MODE" ) {
6662 case "" :
6763 // Normal test mode
@@ -113,7 +109,7 @@ func TestGcloudErrors(t *testing.T) {
113109
114110 for _ , tc := range cases {
115111 t .Run (tc .env , func (t * testing.T ) {
116- GetGcloudCmd = newGcloudCmdMock (tc .env )
112+ getGcloudCmd = newGcloudCmdMock (tc .env )
117113
118114 if _ , err := NewGcloudAuthenticator (ctx ); err == nil {
119115 t .Errorf ("wanted error, got nil" )
@@ -130,7 +126,7 @@ func TestGcloudSuccess(t *testing.T) {
130126 var b bytes.Buffer
131127 logs .Debug .SetOutput (& b )
132128
133- GetGcloudCmd = newGcloudCmdMock ("success" )
129+ getGcloudCmd = newGcloudCmdMock ("success" )
134130
135131 auth , err := NewGcloudAuthenticator (ctx )
136132 if err != nil {
@@ -204,7 +200,7 @@ func TestKeychainGCRandAR(t *testing.T) {
204200 Keychain = & googleKeychain {}
205201
206202 // Gcloud should succeed.
207- GetGcloudCmd = newGcloudCmdMock ("success" )
203+ getGcloudCmd = newGcloudCmdMock ("success" )
208204
209205 if auth , err := Keychain .Resolve (mustRegistry (tc .host )); err != nil {
210206 t .Errorf ("expected success for %v, got: %v" , tc .host , err )
@@ -215,7 +211,7 @@ func TestKeychainGCRandAR(t *testing.T) {
215211 }
216212
217213 // Make gcloud fail to test that caching works.
218- GetGcloudCmd = newGcloudCmdMock ("badoutput" )
214+ getGcloudCmd = newGcloudCmdMock ("badoutput" )
219215
220216 if auth , err := Keychain .Resolve (mustRegistry (tc .host )); err != nil {
221217 t .Errorf ("expected success for %v, got: %v" , tc .host , err )
@@ -233,7 +229,7 @@ func TestKeychainError(t *testing.T) {
233229 t .Fatalf ("unexpected err os.Setenv: %v" , err )
234230 }
235231
236- GetGcloudCmd = newGcloudCmdMock ("badoutput" )
232+ getGcloudCmd = newGcloudCmdMock ("badoutput" )
237233
238234 // Reset the keychain to ensure we don't cache earlier results.
239235 Keychain = & googleKeychain {}
0 commit comments