@@ -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 (
@@ -90,24 +88,11 @@ func TestE2E(t *testing.T) {
90
88
var _ = ginkgo .SynchronizedBeforeSuite (func (ctx ginkgo.SpecContext ) []byte {
91
89
creds , err := credentials .CreateAzureCredentialFile ()
92
90
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
93
- azureClient , err := azure .GetClient (creds .Cloud , creds .SubscriptionID , creds .AADClientID , creds .TenantID , creds .AADClientSecret )
91
+ azureClient , err := azure .GetClient (creds .Cloud , creds .SubscriptionID , creds .AADClientID , creds .TenantID , creds .AADClientSecret , creds . AADFederatedTokenFile )
94
92
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
95
93
_ , err = azureClient .EnsureResourceGroup (ctx , creds .ResourceGroup , creds .Location , nil )
96
94
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
97
95
98
- if testutil .IsRunningInProw () {
99
- // Need to login to ACR using SP credential if we are running in Prow so we can push test images.
100
- // If running locally, user should run 'docker login' before running E2E tests
101
- registry := os .Getenv ("REGISTRY" )
102
- gomega .Expect (registry ).NotTo (gomega .Equal ("" ))
103
-
104
- log .Println ("Attempting docker login with Azure service principal" )
105
- cmd := exec .Command ("docker" , "login" , fmt .Sprintf ("--username=%s" , creds .AADClientID ), fmt .Sprintf ("--password=%s" , creds .AADClientSecret ), registry )
106
- err = cmd .Run ()
107
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
108
- log .Println ("docker login is successful" )
109
- }
110
-
111
96
// Install Azure Blob Storage CSI driver on cluster from project root
112
97
e2eBootstrap := testCmd {
113
98
command : "make" ,
@@ -123,25 +108,8 @@ var _ = ginkgo.SynchronizedBeforeSuite(func(ctx ginkgo.SpecContext) []byte {
123
108
endLog : "metrics service created" ,
124
109
}
125
110
execTestCmd ([]testCmd {e2eBootstrap , createMetricsSVC })
126
-
127
- if testutil .IsRunningInProw () {
128
- data , err := json .Marshal (creds )
129
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
130
- return data
131
- }
132
-
133
111
return nil
134
112
}, func (ctx ginkgo.SpecContext , data []byte ) {
135
- if testutil .IsRunningInProw () {
136
- creds := & credentials.Credentials {}
137
- err := json .Unmarshal (data , creds )
138
- gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
139
- // set env for azidentity.EnvironmentCredential
140
- os .Setenv ("AZURE_TENANT_ID" , creds .TenantID )
141
- os .Setenv ("AZURE_CLIENT_ID" , creds .AADClientID )
142
- os .Setenv ("AZURE_CLIENT_SECRET" , creds .AADClientSecret )
143
- }
144
-
145
113
// k8s.io/kubernetes/test/e2e/framework requires env KUBECONFIG to be set
146
114
// it does not fall back to defaults
147
115
if os .Getenv (kubeconfigEnvVar ) == "" {
@@ -230,7 +198,7 @@ func execTestCmd(cmds []testCmd) {
230
198
func checkAccountCreationLeak (ctx context.Context ) {
231
199
creds , err := credentials .CreateAzureCredentialFile ()
232
200
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
233
- azureClient , err := azure .GetClient (creds .Cloud , creds .SubscriptionID , creds .AADClientID , creds .TenantID , creds .AADClientSecret )
201
+ azureClient , err := azure .GetClient (creds .Cloud , creds .SubscriptionID , creds .AADClientID , creds .TenantID , creds .AADClientSecret , creds . AADFederatedTokenFile )
234
202
gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
235
203
236
204
accountNum , err := azureClient .GetAccountNumByResourceGroup (ctx , creds .ResourceGroup )
0 commit comments