From 2f71a635afdcaa2a9c21a037419ab4ce57ae16b7 Mon Sep 17 00:00:00 2001 From: Paco Xu Date: Tue, 14 Mar 2023 14:03:33 +0800 Subject: [PATCH 1/5] get pvc again to get the pv name that bound to the PVC Signed-off-by: Paco Xu --- test/e2e/storage/csi_mock/csi_volume_expansion.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/e2e/storage/csi_mock/csi_volume_expansion.go b/test/e2e/storage/csi_mock/csi_volume_expansion.go index 298197bfe8e..e1f00cb0b39 100644 --- a/test/e2e/storage/csi_mock/csi_volume_expansion.go +++ b/test/e2e/storage/csi_mock/csi_volume_expansion.go @@ -201,7 +201,7 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() { }) } }) - ginkgo.Context("CSI online volume expansion with secret[Feature:CSINodeExpandSecret]", func() { + ginkgo.Context("CSI online volume expansion with secret", func() { var stringSecret = map[string]string{ "username": "admin", "password": "t0p-Secret", @@ -274,6 +274,11 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() { err = e2epod.WaitForPodNameRunningInNamespace(ctx, m.cs, pod.Name, pod.Namespace) framework.ExpectNoError(err, "Failed to start pod1: %v", err) + pvc, err = m.cs.CoreV1().PersistentVolumeClaims(pvc.Namespace).Get(ctx, pvc.Name, metav1.GetOptions{}) + if err != nil { + framework.Failf("failed to get pvc %s, %v", pvc.Name, err) + } + gomega.Expect(pvc.Spec.VolumeName).ShouldNot(gomega.BeEquivalentTo(""), "while provisioning a volume for resizing") pv, err := m.cs.CoreV1().PersistentVolumes().Get(ctx, pvc.Spec.VolumeName, metav1.GetOptions{}) if err != nil { framework.Failf("failed to get pv %s, %v", pvc.Spec.VolumeName, err) From 40d543a59d82ae4d0292ef4540b8de2a0b3842e1 Mon Sep 17 00:00:00 2001 From: Paco Xu Date: Tue, 14 Mar 2023 15:30:58 +0800 Subject: [PATCH 2/5] check node expand secret ref and fix CSI calls compare failure Signed-off-by: Paco Xu --- test/e2e/storage/csi_mock/csi_volume_expansion.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/e2e/storage/csi_mock/csi_volume_expansion.go b/test/e2e/storage/csi_mock/csi_volume_expansion.go index e1f00cb0b39..bdaa901e84a 100644 --- a/test/e2e/storage/csi_mock/csi_volume_expansion.go +++ b/test/e2e/storage/csi_mock/csi_volume_expansion.go @@ -286,6 +286,9 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() { if pv.Spec.CSI == nil || pv.Spec.CSI.NodeExpandSecretRef == nil { framework.Fail("creating pv without 'NodeExpandSecretRef'") } + if pv.Spec.CSI.NodeExpandSecretRef.Namespace != f.Namespace.Name || pv.Spec.CSI.NodeExpandSecretRef.Name != secretName { + framework.Failf("failed to set node expand secret ref, namespace: %s name: %s", pv.Spec.CSI.NodeExpandSecretRef.Namespace, pv.Spec.CSI.NodeExpandSecretRef.Name) + } ginkgo.By("Expanding current pvc") newSize := resource.MustParse("6Gi") @@ -303,6 +306,10 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() { err = testsuites.WaitForControllerVolumeResize(ctx, pvc, m.cs, csiResizeWaitPeriod) framework.ExpectNoError(err, "While waiting for PV resize to finish") + ginkgo.By("Waiting for PVC resize to finish") + pvc, err = testsuites.WaitForFSResize(ctx, pvc, m.cs) + framework.ExpectNoError(err, "while waiting for PVC to finish") + ginkgo.By("Waiting for all remaining expected CSI calls") err = wait.Poll(time.Second, csiResizeWaitPeriod, func() (done bool, err error) { _, index, err := compareCSICalls(ctx, trackedCalls, test.expectedCalls, m.driver.GetCalls) @@ -321,10 +328,6 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() { }) framework.ExpectNoError(err, "while waiting for all CSI calls") - ginkgo.By("Waiting for PVC resize to finish") - pvc, err = testsuites.WaitForFSResize(ctx, pvc, m.cs) - framework.ExpectNoError(err, "while waiting for PVC to finish") - pvcConditions := pvc.Status.Conditions framework.ExpectEqual(len(pvcConditions), 0, "pvc should not have conditions") }) From 4e5171b396a423fee9f13de9b507f87cdfc5e30f Mon Sep 17 00:00:00 2001 From: Paco Xu Date: Tue, 14 Mar 2023 15:43:20 +0800 Subject: [PATCH 3/5] upgrade csi provisioner to v3.4.0 Signed-off-by: Paco Xu --- .../e2e/testing-manifests/storage-csi/gce-pd/controller_ss.yaml | 2 +- .../storage-csi/hostpath/hostpath/csi-hostpath-plugin.yaml | 2 +- .../e2e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml | 2 +- test/e2e/testing-manifests/storage-csi/mock/csi-mock-proxy.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/e2e/testing-manifests/storage-csi/gce-pd/controller_ss.yaml b/test/e2e/testing-manifests/storage-csi/gce-pd/controller_ss.yaml index 0ca5a187f33..e6be99ae536 100644 --- a/test/e2e/testing-manifests/storage-csi/gce-pd/controller_ss.yaml +++ b/test/e2e/testing-manifests/storage-csi/gce-pd/controller_ss.yaml @@ -39,7 +39,7 @@ spec: - name: socket-dir mountPath: /csi - name: csi-provisioner - image: registry.k8s.io/sig-storage/csi-provisioner:v3.3.0 + image: registry.k8s.io/sig-storage/csi-provisioner:v3.4.0 args: - "--v=5" - "--csi-address=/csi/csi.sock" diff --git a/test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-plugin.yaml b/test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-plugin.yaml index 33cf06a9a5e..6a41a023913 100644 --- a/test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-plugin.yaml +++ b/test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-plugin.yaml @@ -323,7 +323,7 @@ spec: name: socket-dir - name: csi-provisioner - image: registry.k8s.io/sig-storage/csi-provisioner:v3.3.0 + image: registry.k8s.io/sig-storage/csi-provisioner:v3.4.0 args: - -v=5 - --csi-address=/csi/csi.sock diff --git a/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml b/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml index 29570e39f17..4493deccc09 100644 --- a/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml +++ b/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml @@ -15,7 +15,7 @@ spec: serviceAccountName: csi-mock containers: - name: csi-provisioner - image: registry.k8s.io/sig-storage/csi-provisioner:v3.3.0 + image: registry.k8s.io/sig-storage/csi-provisioner:v3.4.0 args: - "--csi-address=$(ADDRESS)" # Topology support is needed for the pod rescheduling test diff --git a/test/e2e/testing-manifests/storage-csi/mock/csi-mock-proxy.yaml b/test/e2e/testing-manifests/storage-csi/mock/csi-mock-proxy.yaml index ba27f936749..d1aa8ece864 100644 --- a/test/e2e/testing-manifests/storage-csi/mock/csi-mock-proxy.yaml +++ b/test/e2e/testing-manifests/storage-csi/mock/csi-mock-proxy.yaml @@ -15,7 +15,7 @@ spec: serviceAccountName: csi-mock containers: - name: csi-provisioner - image: registry.k8s.io/sig-storage/csi-provisioner:v3.3.0 + image: registry.k8s.io/sig-storage/csi-provisioner:v3.4.0 args: - "--csi-address=$(ADDRESS)" # Topology support is needed for the pod rescheduling test From a5587de2e40e323ebba4b531a1e01a3859053e5a Mon Sep 17 00:00:00 2001 From: Paco Xu Date: Tue, 14 Mar 2023 18:03:08 +0800 Subject: [PATCH 4/5] print all calls when compare CSI call failed --- test/e2e/storage/csi_mock/csi_volume_expansion.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/e2e/storage/csi_mock/csi_volume_expansion.go b/test/e2e/storage/csi_mock/csi_volume_expansion.go index bdaa901e84a..4fd0b79ce86 100644 --- a/test/e2e/storage/csi_mock/csi_volume_expansion.go +++ b/test/e2e/storage/csi_mock/csi_volume_expansion.go @@ -311,8 +311,10 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() { framework.ExpectNoError(err, "while waiting for PVC to finish") ginkgo.By("Waiting for all remaining expected CSI calls") + var allCalls []drivers.MockCSICall err = wait.Poll(time.Second, csiResizeWaitPeriod, func() (done bool, err error) { - _, index, err := compareCSICalls(ctx, trackedCalls, test.expectedCalls, m.driver.GetCalls) + var index int + allCalls, index, err = compareCSICalls(ctx, trackedCalls, test.expectedCalls, m.driver.GetCalls) if err != nil { return true, err } @@ -326,7 +328,7 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() { } return false, nil }) - framework.ExpectNoError(err, "while waiting for all CSI calls") + framework.ExpectNoError(err, fmt.Sprintf("while waiting for all CSI calls: %s", allCalls)) pvcConditions := pvc.Status.Conditions framework.ExpectEqual(len(pvcConditions), 0, "pvc should not have conditions") From 80ff4b90a519e9e5e625d810f505c51e3a421f76 Mon Sep 17 00:00:00 2001 From: zhucan Date: Tue, 14 Mar 2023 19:49:55 +0800 Subject: [PATCH 5/5] e2e: test for node expand volume with secrets failed Signed-off-by: zhucan --- test/e2e/storage/csi_mock/base.go | 4 ++-- test/e2e/storage/csi_mock/csi_volume_expansion.go | 5 ++--- test/e2e/storage/drivers/csi.go | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/test/e2e/storage/csi_mock/base.go b/test/e2e/storage/csi_mock/base.go index c822509ed29..4dc451d6e84 100644 --- a/test/e2e/storage/csi_mock/base.go +++ b/test/e2e/storage/csi_mock/base.go @@ -836,8 +836,8 @@ func compareCSICalls(ctx context.Context, trackedCalls []string, expectedCallSeq // if the secret is not nil, compare it if expectedCall.expectedSecret != nil { - if !reflect.DeepEqual(expectedCall.expectedSecret, c.Request.Secret) { - return allCalls, i, fmt.Errorf("Unexpected secret: expected %v, got %v", expectedCall.expectedSecret, c.Request.Secret) + if !reflect.DeepEqual(expectedCall.expectedSecret, c.Request.Secrets) { + return allCalls, i, fmt.Errorf("Unexpected secret: expected %v, got %v", expectedCall.expectedSecret, c.Request.Secrets) } } diff --git a/test/e2e/storage/csi_mock/csi_volume_expansion.go b/test/e2e/storage/csi_mock/csi_volume_expansion.go index 4fd0b79ce86..cbc840f098d 100644 --- a/test/e2e/storage/csi_mock/csi_volume_expansion.go +++ b/test/e2e/storage/csi_mock/csi_volume_expansion.go @@ -311,10 +311,9 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() { framework.ExpectNoError(err, "while waiting for PVC to finish") ginkgo.By("Waiting for all remaining expected CSI calls") - var allCalls []drivers.MockCSICall err = wait.Poll(time.Second, csiResizeWaitPeriod, func() (done bool, err error) { var index int - allCalls, index, err = compareCSICalls(ctx, trackedCalls, test.expectedCalls, m.driver.GetCalls) + _, index, err = compareCSICalls(ctx, trackedCalls, test.expectedCalls, m.driver.GetCalls) if err != nil { return true, err } @@ -328,7 +327,7 @@ var _ = utils.SIGDescribe("CSI Mock volume expansion", func() { } return false, nil }) - framework.ExpectNoError(err, fmt.Sprintf("while waiting for all CSI calls: %s", allCalls)) + framework.ExpectNoError(err, "while waiting for all CSI calls") pvcConditions := pvc.Status.Conditions framework.ExpectEqual(len(pvcConditions), 0, "pvc should not have conditions") diff --git a/test/e2e/storage/drivers/csi.go b/test/e2e/storage/drivers/csi.go index b41c485e843..09548a1c2f4 100644 --- a/test/e2e/storage/drivers/csi.go +++ b/test/e2e/storage/drivers/csi.go @@ -379,7 +379,7 @@ type MockCSICall struct { Method string Request struct { VolumeContext map[string]string `json:"volume_context"` - Secret map[string]string `json:"secret"` + Secrets map[string]string `json:"secrets"` } FullError struct { Code codes.Code `json:"code"`