@@ -122,6 +122,7 @@ func TestIAMSigner(t *testing.T) {
122122 conf := & internal.AuthConfig {
123123 Opts : optsWithTokenSource ,
124124 ServiceAccountID : "test-service-account" ,
125+ Version : testVersion ,
125126 }
126127 signer , err := newIAMSigner (ctx , conf )
127128 if err != nil {
@@ -155,6 +156,7 @@ func TestIAMSignerHTTPError(t *testing.T) {
155156 conf := & internal.AuthConfig {
156157 Opts : optsWithTokenSource ,
157158 ServiceAccountID : "test-service-account" ,
159+ Version : testVersion ,
158160 }
159161 signer , err := newIAMSigner (context .Background (), conf )
160162 if err != nil {
@@ -182,6 +184,7 @@ func TestIAMSignerUnknownHTTPError(t *testing.T) {
182184 conf := & internal.AuthConfig {
183185 Opts : optsWithTokenSource ,
184186 ServiceAccountID : "test-service-account" ,
187+ Version : testVersion ,
185188 }
186189 signer , err := newIAMSigner (context .Background (), conf )
187190 if err != nil {
@@ -208,7 +211,8 @@ func TestIAMSignerUnknownHTTPError(t *testing.T) {
208211func TestIAMSignerWithMetadataService (t * testing.T ) {
209212 ctx := context .Background ()
210213 conf := & internal.AuthConfig {
211- Opts : optsWithTokenSource ,
214+ Opts : optsWithTokenSource ,
215+ Version : testVersion ,
212216 }
213217
214218 signer , err := newIAMSigner (ctx , conf )
@@ -253,7 +257,8 @@ func TestIAMSignerWithMetadataService(t *testing.T) {
253257func TestIAMSignerNoMetadataService (t * testing.T ) {
254258 ctx := context .Background ()
255259 conf := & internal.AuthConfig {
256- Opts : optsWithTokenSource ,
260+ Opts : optsWithTokenSource ,
261+ Version : testVersion ,
257262 }
258263
259264 signer , err := newIAMSigner (ctx , conf )
@@ -340,6 +345,10 @@ func iamServer(t *testing.T, serviceAcct, signature string) *httptest.Server {
340345 if r .URL .Path != wantPath {
341346 t .Errorf ("Path = %q; want = %q" , r .URL .Path , wantPath )
342347 }
348+ xGoogAPIClientHeader := internal .GetMetricsHeader (testVersion )
349+ if h := r .Header .Get ("x-goog-api-client" ); h != xGoogAPIClientHeader {
350+ t .Errorf ("x-goog-api-client header = %q; want = %q" , h , xGoogAPIClientHeader )
351+ }
343352
344353 w .Header ().Set ("Content-Type" , "application/json" )
345354 b , err := json .Marshal (resp )
0 commit comments