File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 1
1
module github.com/centml/platform/ecr-anywhere
2
2
3
3
go 1.24.1
4
- toolchain go1.24.1
5
4
6
5
require (
7
6
k8s.io/api v0.30.2
Original file line number Diff line number Diff line change @@ -111,7 +111,8 @@ func (ecu *ecrCredentialInjector) Inject(secret *corev1.Secret) (patching.Operat
111
111
// Call the API to get ECR credentials
112
112
res , err := ecu .ecrClient .GetAuthorizationToken (context .Background (), & ecr.GetAuthorizationTokenInput {})
113
113
if err != nil {
114
- return nil , fmt .Errorf ("failed to get authorization token: %w" , err )
114
+ ecu .ErrorLogger .Printf ("Failed to get authorization token: %v" , err )
115
+ panic (fmt .Errorf ("failed to get authorization token: %w" , err ))
115
116
}
116
117
ecu .InfoLogger .Print ("Received authorization data" )
117
118
Original file line number Diff line number Diff line change @@ -254,15 +254,20 @@ func TestInject(t *testing.T) {
254
254
for _ , tt := range tests {
255
255
t .Run (tt .name , func (t * testing.T ) {
256
256
tt .setupMock ()
257
-
258
- patches , err := injector .Inject (tt .secret )
259
257
if tt .expectedError != "" {
260
- assert .EqualError (t , err , tt .expectedError )
258
+ if tt .name == "GetAuthorizationToken fails" {
259
+ assert .PanicsWithError (t , tt .expectedError , func () {
260
+ _ , _ = injector .Inject (tt .secret )
261
+ })
262
+ } else {
263
+ _ , err := injector .Inject (tt .secret )
264
+ assert .EqualError (t , err , tt .expectedError )
265
+ }
261
266
} else {
267
+ patches , err := injector .Inject (tt .secret )
262
268
assert .NoError (t , err )
263
269
assert .Equal (t , tt .expectedPatches , patches )
264
270
}
265
-
266
271
mockECRClient .AssertExpectations (t )
267
272
})
268
273
}
You can’t perform that action at this time.
0 commit comments