@@ -122,6 +122,7 @@ func TestIAMSigner(t *testing.T) {
122
122
conf := & internal.AuthConfig {
123
123
Opts : optsWithTokenSource ,
124
124
ServiceAccountID : "test-service-account" ,
125
+ Version : testVersion ,
125
126
}
126
127
signer , err := newIAMSigner (ctx , conf )
127
128
if err != nil {
@@ -155,6 +156,7 @@ func TestIAMSignerHTTPError(t *testing.T) {
155
156
conf := & internal.AuthConfig {
156
157
Opts : optsWithTokenSource ,
157
158
ServiceAccountID : "test-service-account" ,
159
+ Version : testVersion ,
158
160
}
159
161
signer , err := newIAMSigner (context .Background (), conf )
160
162
if err != nil {
@@ -182,6 +184,7 @@ func TestIAMSignerUnknownHTTPError(t *testing.T) {
182
184
conf := & internal.AuthConfig {
183
185
Opts : optsWithTokenSource ,
184
186
ServiceAccountID : "test-service-account" ,
187
+ Version : testVersion ,
185
188
}
186
189
signer , err := newIAMSigner (context .Background (), conf )
187
190
if err != nil {
@@ -208,7 +211,8 @@ func TestIAMSignerUnknownHTTPError(t *testing.T) {
208
211
func TestIAMSignerWithMetadataService (t * testing.T ) {
209
212
ctx := context .Background ()
210
213
conf := & internal.AuthConfig {
211
- Opts : optsWithTokenSource ,
214
+ Opts : optsWithTokenSource ,
215
+ Version : testVersion ,
212
216
}
213
217
214
218
signer , err := newIAMSigner (ctx , conf )
@@ -253,7 +257,8 @@ func TestIAMSignerWithMetadataService(t *testing.T) {
253
257
func TestIAMSignerNoMetadataService (t * testing.T ) {
254
258
ctx := context .Background ()
255
259
conf := & internal.AuthConfig {
256
- Opts : optsWithTokenSource ,
260
+ Opts : optsWithTokenSource ,
261
+ Version : testVersion ,
257
262
}
258
263
259
264
signer , err := newIAMSigner (ctx , conf )
@@ -340,6 +345,10 @@ func iamServer(t *testing.T, serviceAcct, signature string) *httptest.Server {
340
345
if r .URL .Path != wantPath {
341
346
t .Errorf ("Path = %q; want = %q" , r .URL .Path , wantPath )
342
347
}
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
+ }
343
352
344
353
w .Header ().Set ("Content-Type" , "application/json" )
345
354
b , err := json .Marshal (resp )
0 commit comments