Skip to content

Commit e409e73

Browse files
committed
test: use wi for e2e test
1 parent bbccd9a commit e409e73

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+145
-6041
lines changed

deploy/example/storageclass-blob-nfs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ metadata:
66
provisioner: blob.csi.azure.com
77
parameters:
88
protocol: nfs
9+
useDataPlaneAPI: "false"
910
volumeBindingMode: Immediate
1011
allowVolumeExpansion: true
1112
mountOptions:

deploy/example/storageclass-blobfuse.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ metadata:
66
provisioner: blob.csi.azure.com
77
parameters:
88
skuName: Premium_LRS # available values: Standard_LRS, Premium_LRS, Standard_GRS, Standard_RAGRS, Standard_ZRS, Premium_ZRS
9+
useDataPlaneAPI: "false"
910
reclaimPolicy: Delete
1011
volumeBindingMode: Immediate
1112
allowVolumeExpansion: true

deploy/example/storageclass-blobfuse2.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ provisioner: blob.csi.azure.com
77
parameters:
88
skuName: Premium_LRS # available values: Standard_LRS, Premium_LRS, Standard_GRS, Standard_RAGRS, Standard_ZRS, Premium_ZRS
99
protocol: fuse2
10+
useDataPlaneAPI: "false"
1011
reclaimPolicy: Delete
1112
volumeBindingMode: Immediate
1213
allowVolumeExpansion: true

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ require (
1919
github.com/onsi/ginkgo/v2 v2.19.1
2020
github.com/onsi/gomega v1.34.0
2121
github.com/pborman/uuid v1.2.1
22-
github.com/pelletier/go-toml v1.9.5
2322
github.com/pkg/errors v0.9.1
2423
github.com/satori/go.uuid v1.2.0
2524
github.com/stretchr/testify v1.9.0

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,6 @@ github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaL
216216
github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec=
217217
github.com/pborman/uuid v1.2.1 h1:+ZZIw58t/ozdjRaXh/3awHfmWRbzYxJoAdNJxe/3pvw=
218218
github.com/pborman/uuid v1.2.1/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
219-
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
220-
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
221219
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
222220
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
223221
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=

hack/verify-examples.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ rollout_and_wait() {
2828
}
2929

3030
echo "begin to create deployment examples ..."
31+
32+
kubectl config set-context --current --namespace=default
33+
3134
if [ -v EXTERNAL_E2E_TEST_BLOBFUSE_v2 ]; then
3235
echo "create blobfuse2 storage class ..."
3336
kubectl apply -f deploy/example/storageclass-blobfuse2.yaml

pkg/util/util.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ func parseAzcopyJobShow(jobshow string) (AzcopyJobState, string, error) {
331331
func GetKubeClient(kubeconfig string, kubeAPIQPS float64, kubeAPIBurst int, userAgent string) (kubernetes.Interface, error) {
332332
var err error
333333
var kubeCfg *rest.Config
334+
if kubeconfig == "no-need-kubeconfig" {
335+
klog.V(2).Infof("kubeconfig is set as no-need-kubeconfig, kubeClient will be nil")
336+
return nil, nil
337+
}
334338
if kubeCfg, err = clientcmd.BuildConfigFromFlags("", kubeconfig); err != nil {
335339
return nil, err
336340
}

test/e2e/dynamic_provisioning_test.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
962962
Pod: pod,
963963
PodWithClonedVolume: podWithClonedVolume,
964964
StorageClassParameters: map[string]string{
965+
"useDataPlaneAPI": "true",
965966
"skuName": "Premium_LRS",
966967
"protocol": "nfs",
967968
"mountPermissions": "0755",
@@ -994,6 +995,7 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
994995
Pod: pod,
995996
PodWithClonedVolume: podWithClonedVolume,
996997
StorageClassParameters: map[string]string{
998+
"useDataPlaneAPI": "true",
997999
"skuName": "Premium_LRS",
9981000
"protocol": "nfs",
9991001
"mountPermissions": "0755",
@@ -1027,8 +1029,9 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
10271029
Pod: pod,
10281030
PodWithClonedVolume: podWithClonedVolume,
10291031
StorageClassParameters: map[string]string{
1030-
"skuName": "Standard_LRS",
1031-
"protocol": "fuse2",
1032+
"useDataPlaneAPI": "true",
1033+
"skuName": "Standard_LRS",
1034+
"protocol": "fuse2",
10321035
},
10331036
}
10341037
test.Run(ctx, cs, ns)
@@ -1059,8 +1062,9 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
10591062
Pod: pod,
10601063
PodWithClonedVolume: podWithClonedVolume,
10611064
StorageClassParameters: map[string]string{
1062-
"skuName": "Standard_LRS",
1063-
"protocol": "fuse2",
1065+
"useDataPlaneAPI": "true",
1066+
"skuName": "Standard_LRS",
1067+
"protocol": "fuse2",
10641068
},
10651069
}
10661070
test.Run(ctx, cs, ns)
@@ -1090,12 +1094,14 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
10901094
Pod: pod,
10911095
PodWithClonedVolume: podWithClonedVolume,
10921096
StorageClassParameters: map[string]string{
1097+
"useDataPlaneAPI": "true",
10931098
"skuName": "Premium_LRS",
10941099
"protocol": "nfs",
10951100
"mountPermissions": "0755",
10961101
"allowsharedkeyaccess": "true",
10971102
},
10981103
ClonedStorageClassParameters: map[string]string{
1104+
"useDataPlaneAPI": "true",
10991105
"skuName": "Standard_LRS",
11001106
"protocol": "nfs",
11011107
"mountPermissions": "0755",
@@ -1130,12 +1136,14 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Dynamic Provisioning", func() {
11301136
Pod: pod,
11311137
PodWithClonedVolume: podWithClonedVolume,
11321138
StorageClassParameters: map[string]string{
1133-
"skuName": "Standard_LRS",
1134-
"protocol": "fuse2",
1139+
"useDataPlaneAPI": "true",
1140+
"skuName": "Standard_LRS",
1141+
"protocol": "fuse2",
11351142
},
11361143
ClonedStorageClassParameters: map[string]string{
1137-
"skuName": "Premium_LRS",
1138-
"protocol": "fuse2",
1144+
"useDataPlaneAPI": "true",
1145+
"skuName": "Premium_LRS",
1146+
"protocol": "fuse2",
11391147
},
11401148
}
11411149
test.Run(ctx, cs, ns)

test/e2e/pre_provisioning_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Pre-Provisioned", func() {
219219
})
220220

221221
ginkgo.It("should use Key Vault", func(ctx ginkgo.SpecContext) {
222+
ginkgo.Skip("test case is not available currently due to test-infra migration")
222223
volumeSize := fmt.Sprintf("%dGi", defaultVolumeSize)
223224
reclaimPolicy := v1.PersistentVolumeReclaimRetain
224225
volumeBindingMode := storagev1.VolumeBindingImmediate
@@ -252,6 +253,7 @@ var _ = ginkgo.Describe("[blob-csi-e2e] Pre-Provisioned", func() {
252253
})
253254

254255
ginkgo.It("should use SAS token", func(ctx ginkgo.SpecContext) {
256+
ginkgo.Skip("test case is not available currently due to test-infra migration")
255257
pods := []testsuites.PodDetails{
256258
{
257259
Cmd: "echo 'hello world' > /mnt/test-1/data && grep 'hello world' /mnt/test-1/data",

test/e2e/suite_test.go

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package e2e
1818

1919
import (
2020
"context"
21-
"encoding/json"
2221
"flag"
2322
"fmt"
2423
"log"
@@ -42,7 +41,6 @@ import (
4241
"sigs.k8s.io/blob-csi-driver/pkg/util"
4342
"sigs.k8s.io/blob-csi-driver/test/utils/azure"
4443
"sigs.k8s.io/blob-csi-driver/test/utils/credentials"
45-
"sigs.k8s.io/blob-csi-driver/test/utils/testutil"
4644
)
4745

4846
const (
@@ -90,24 +88,11 @@ func TestE2E(t *testing.T) {
9088
var _ = ginkgo.SynchronizedBeforeSuite(func(ctx ginkgo.SpecContext) []byte {
9189
creds, err := credentials.CreateAzureCredentialFile()
9290
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)
9492
gomega.Expect(err).NotTo(gomega.HaveOccurred())
9593
_, err = azureClient.EnsureResourceGroup(ctx, creds.ResourceGroup, creds.Location, nil)
9694
gomega.Expect(err).NotTo(gomega.HaveOccurred())
9795

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-
11196
// Install Azure Blob Storage CSI driver on cluster from project root
11297
e2eBootstrap := testCmd{
11398
command: "make",
@@ -123,25 +108,8 @@ var _ = ginkgo.SynchronizedBeforeSuite(func(ctx ginkgo.SpecContext) []byte {
123108
endLog: "metrics service created",
124109
}
125110
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-
133111
return nil
134112
}, 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-
145113
// k8s.io/kubernetes/test/e2e/framework requires env KUBECONFIG to be set
146114
// it does not fall back to defaults
147115
if os.Getenv(kubeconfigEnvVar) == "" {
@@ -230,7 +198,7 @@ func execTestCmd(cmds []testCmd) {
230198
func checkAccountCreationLeak(ctx context.Context) {
231199
creds, err := credentials.CreateAzureCredentialFile()
232200
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)
234202
gomega.Expect(err).NotTo(gomega.HaveOccurred())
235203

236204
accountNum, err := azureClient.GetAccountNumByResourceGroup(ctx, creds.ResourceGroup)

0 commit comments

Comments
 (0)