@@ -18,7 +18,6 @@ package e2e
18
18
19
19
import (
20
20
"context"
21
- "encoding/json"
22
21
"flag"
23
22
"fmt"
24
23
"log"
@@ -42,7 +41,6 @@ import (
42
41
"sigs.k8s.io/blob-csi-driver/pkg/util"
43
42
"sigs.k8s.io/blob-csi-driver/test/utils/azure"
44
43
"sigs.k8s.io/blob-csi-driver/test/utils/credentials"
45
- "sigs.k8s.io/blob-csi-driver/test/utils/testutil"
46
44
)
47
45
48
46
const (
@@ -82,24 +80,11 @@ func TestE2E(t *testing.T) {
82
80
var _ = ginkgo .SynchronizedBeforeSuite (func (ctx ginkgo.SpecContext ) []byte {
83
81
creds , err := credentials .CreateAzureCredentialFile ()
84
82
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
85
- azureClient , err := azure .GetClient (creds .Cloud , creds .SubscriptionID , creds .AADClientID , creds .TenantID , creds .AADClientSecret )
83
+ azureClient , err := azure .GetClient (creds .Cloud , creds .SubscriptionID , creds .AADClientID , creds .TenantID , creds .AADClientSecret , creds . AADFederatedTokenFile )
86
84
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
87
85
_ , err = azureClient .EnsureResourceGroup (ctx , creds .ResourceGroup , creds .Location , nil )
88
86
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
89
87
90
- if testutil .IsRunningInProw () {
91
- // Need to login to ACR using SP credential if we are running in Prow so we can push test images.
92
- // If running locally, user should run 'docker login' before running E2E tests
93
- registry := os .Getenv ("REGISTRY" )
94
- gomega .Expect (registry ).NotTo (gomega .Equal ("" ))
95
-
96
- log .Println ("Attempting docker login with Azure service principal" )
97
- cmd := exec .Command ("docker" , "login" , fmt .Sprintf ("--username=%s" , creds .AADClientID ), fmt .Sprintf ("--password=%s" , creds .AADClientSecret ), registry )
98
- err = cmd .Run ()
99
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
100
- log .Println ("docker login is successful" )
101
- }
102
-
103
88
// Install Azure Blob Storage CSI driver on cluster from project root
104
89
e2eBootstrap := testCmd {
105
90
command : "make" ,
@@ -115,25 +100,8 @@ var _ = ginkgo.SynchronizedBeforeSuite(func(ctx ginkgo.SpecContext) []byte {
115
100
endLog : "metrics service created" ,
116
101
}
117
102
execTestCmd ([]testCmd {e2eBootstrap , createMetricsSVC })
118
-
119
- if testutil .IsRunningInProw () {
120
- data , err := json .Marshal (creds )
121
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
122
- return data
123
- }
124
-
125
103
return nil
126
104
}, func (ctx ginkgo.SpecContext , data []byte ) {
127
- if testutil .IsRunningInProw () {
128
- creds := & credentials.Credentials {}
129
- err := json .Unmarshal (data , creds )
130
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
131
- // set env for azidentity.EnvironmentCredential
132
- os .Setenv ("AZURE_TENANT_ID" , creds .TenantID )
133
- os .Setenv ("AZURE_CLIENT_ID" , creds .AADClientID )
134
- os .Setenv ("AZURE_CLIENT_SECRET" , creds .AADClientSecret )
135
- }
136
-
137
105
// k8s.io/kubernetes/test/e2e/framework requires env KUBECONFIG to be set
138
106
// it does not fall back to defaults
139
107
if os .Getenv (kubeconfigEnvVar ) == "" {
@@ -226,7 +194,7 @@ func execTestCmd(cmds []testCmd) {
226
194
func checkAccountCreationLeak (ctx context.Context ) {
227
195
creds , err := credentials .CreateAzureCredentialFile ()
228
196
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
229
- azureClient , err := azure .GetClient (creds .Cloud , creds .SubscriptionID , creds .AADClientID , creds .TenantID , creds .AADClientSecret )
197
+ azureClient , err := azure .GetClient (creds .Cloud , creds .SubscriptionID , creds .AADClientID , creds .TenantID , creds .AADClientSecret , creds . AADFederatedTokenFile )
230
198
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
231
199
232
200
accountNum , err := azureClient .GetAccountNumByResourceGroup (ctx , creds .ResourceGroup )
0 commit comments