diff --git a/pkg/common/oras/authprovider/azure/azureidentity_test.go b/pkg/common/oras/authprovider/azure/azureidentity_test.go index af33afe44f..11fb48f5f7 100644 --- a/pkg/common/oras/authprovider/azure/azureidentity_test.go +++ b/pkg/common/oras/authprovider/azure/azureidentity_test.go @@ -191,6 +191,11 @@ func TestMIProvide_RefreshAAD(t *testing.T) { func TestMIProvide_Failure_InvalidHostName(t *testing.T) { provider := &MIAuthProvider{ + tenantID: "test_tenant", + clientID: "test_client", + identityToken: azcore.AccessToken{ + Token: "test_token", + }, getRegistryHost: func(_ string) (string, error) { return "", errors.New("invalid hostname") }, diff --git a/pkg/common/oras/authprovider/azure/azureworkloadidentity_test.go b/pkg/common/oras/authprovider/azure/azureworkloadidentity_test.go index bbfd29eb93..1b58e18fe9 100644 --- a/pkg/common/oras/authprovider/azure/azureworkloadidentity_test.go +++ b/pkg/common/oras/authprovider/azure/azureworkloadidentity_test.go @@ -247,6 +247,11 @@ func TestWIProvide_RefreshAAD(t *testing.T) { func TestWIProvide_Failure_InvalidHostName(t *testing.T) { provider := &WIAuthProvider{ + aadToken: confidential.AuthResult{ + AccessToken: "mockToken", + ExpiresOn: time.Now(), + }, + tenantID: "mockTenantID", getRegistryHost: func(_ string) (string, error) { return "", errors.New("invalid hostname") },