Skip to content

Commit 95a1911

Browse files
yanjing1104cyb70289
authored andcommitted
e2e: Add e2e test for SMA NvmfTCP
- Start a spdkdev container to simulate IPU node with spdk_tgt process and SMA server running inside - Add e2e test for SMA NvmfTCP, deploy the nodeserver-config-map when deploying the k8s cluster, check the controller statefulset, node deamonset - Add a test scenario to the SMA NvmfTCP e2e test that the test pod claims multiple pvcs, and check data persistency - Add log verification to check SMA calls Signed-off-by: Jing Yan <[email protected]> Change-Id: Iaf47b2168acced29922046f58ba10840967ddef2 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk-csi/+/16855 Tested-by: SPDK CI Jenkins <[email protected]> Reviewed-by: Antti Kervinen <[email protected]> Reviewed-by: Yibo Cai <[email protected]> Reviewed-by: Xin Yang <[email protected]>
1 parent 6dc6b5a commit 95a1911

File tree

8 files changed

+405
-27
lines changed

8 files changed

+405
-27
lines changed

e2e/multi-pvc.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright (c) Arm Limited and Contributors
3+
# Copyright (c) Intel Corporation
4+
---
5+
apiVersion: v1
6+
kind: PersistentVolumeClaim
7+
metadata:
8+
name: spdkcsi-pvc1
9+
spec:
10+
accessModes:
11+
- ReadWriteOnce
12+
resources:
13+
requests:
14+
storage: 128Mi
15+
storageClassName: spdkcsi-sc
16+
17+
---
18+
apiVersion: v1
19+
kind: PersistentVolumeClaim
20+
metadata:
21+
name: spdkcsi-pvc2
22+
spec:
23+
accessModes:
24+
- ReadWriteOnce
25+
resources:
26+
requests:
27+
storage: 128Mi
28+
storageClassName: spdkcsi-sc
29+
30+
---
31+
apiVersion: v1
32+
kind: PersistentVolumeClaim
33+
metadata:
34+
name: spdkcsi-pvc3
35+
spec:
36+
accessModes:
37+
- ReadWriteOnce
38+
resources:
39+
requests:
40+
storage: 128Mi
41+
storageClassName: spdkcsi-sc

e2e/sma-nvmf.go

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
package e2e
2+
3+
import (
4+
"time"
5+
6+
ginkgo "github.com/onsi/ginkgo/v2"
7+
"k8s.io/kubernetes/test/e2e/framework"
8+
)
9+
10+
const (
11+
smaNVMFConfigMapData = `{
12+
"nodes": [
13+
{
14+
"name": "localhost",
15+
"rpcURL": "http://127.0.0.1:9009",
16+
"targetType": "nvme-tcp",
17+
"targetAddr": "127.0.0.1"
18+
}
19+
]
20+
}`
21+
)
22+
23+
var _ = ginkgo.Describe("SPDKCSI-SMA-NVMF", func() {
24+
f := framework.NewDefaultFramework("spdkcsi")
25+
ginkgo.BeforeEach(func() {
26+
deployConfigs(smaNVMFConfigMapData)
27+
deploySmaNvmfConfig()
28+
deployCsi()
29+
})
30+
31+
ginkgo.AfterEach(func() {
32+
deleteCsi()
33+
deleteSmaNvmfConfig()
34+
deleteConfigs()
35+
})
36+
37+
ginkgo.Context("Test SPDK CSI SMA NVMF", func() {
38+
ginkgo.It("Test SPDK CSI SMA NVMF", func() {
39+
ginkgo.By("checking controller statefulset is running", func() {
40+
err := waitForControllerReady(f.ClientSet, 4*time.Minute)
41+
if err != nil {
42+
ginkgo.Fail(err.Error())
43+
}
44+
})
45+
46+
ginkgo.By("checking node daemonset is running", func() {
47+
err := waitForNodeServerReady(f.ClientSet, 2*time.Minute)
48+
if err != nil {
49+
ginkgo.Fail(err.Error())
50+
}
51+
})
52+
53+
ginkgo.By("log verification for SMA grpc connection", func() {
54+
expLogerrMsgMap := map[string]string{
55+
"connected to SMA server 127.0.0.1:5114 with TargetType as xpu-sma-nvmftcp": "failed to catch the log about the connection to SMA server from node",
56+
}
57+
err := verifyNodeServerLog(expLogerrMsgMap)
58+
if err != nil {
59+
ginkgo.Fail(err.Error())
60+
}
61+
})
62+
63+
ginkgo.By("create multiple pvcs and a pod with multiple pvcs attached, and check data persistence after the pod is removed and recreated", func() {
64+
deployMultiPvcs()
65+
deployTestPodWithMultiPvcs()
66+
err := waitForTestPodReady(f.ClientSet, 5*time.Minute)
67+
if err != nil {
68+
ginkgo.Fail(err.Error())
69+
}
70+
71+
err = checkDataPersistForMultiPvcs(f)
72+
if err != nil {
73+
ginkgo.Fail(err.Error())
74+
}
75+
76+
deleteMultiPvcsAndTestPodWithMultiPvcs()
77+
err = waitForTestPodGone(f.ClientSet)
78+
if err != nil {
79+
ginkgo.Fail(err.Error())
80+
}
81+
for _, pvcName := range []string{"spdkcsi-pvc1", "spdkcsi-pvc2", "spdkcsi-pvc3"} {
82+
err = waitForPvcGone(f.ClientSet, pvcName)
83+
if err != nil {
84+
ginkgo.Fail(err.Error())
85+
}
86+
}
87+
})
88+
89+
ginkgo.By("log verification for SMA workflow", func() {
90+
expLogerrMsgMap := map[string]string{
91+
"SMA.CreateDevice": "failed to catch the log about the SMA.CreateDevice phase",
92+
"SMA.AttachVolume": "failed to catch the log about the SMA.AttachVolume phase",
93+
"SMA.DetachVolume": "failed to catch the log about the SMA.DetachVolume phase",
94+
"SMA.DeleteDevice": "failed to catch the log about the SMA.DeleteDevice phase",
95+
}
96+
err := verifyNodeServerLog(expLogerrMsgMap)
97+
if err != nil {
98+
ginkgo.Fail(err.Error())
99+
}
100+
})
101+
})
102+
})
103+
})

e2e/sma-nvmf.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright (c) Arm Limited and Contributors
3+
# Copyright (c) Intel Corporation
4+
---
5+
apiVersion: v1
6+
kind: ConfigMap
7+
metadata:
8+
name: spdkcsi-nodeservercm
9+
data:
10+
# sma.targetType: xpu-sma-nvmftcp, xpu-sma-virtioblk, xpu-sma-nvme
11+
# sma.targetAddr: URL to connect the SMA server on every cluster node,
12+
# http://IPADDR:PORT
13+
# unix:///path/and/sma.sock
14+
nodeserver-config.json: |-
15+
{
16+
"smaList": [
17+
{
18+
"name": "IPU0",
19+
"targetType": "xpu-sma-nvmftcp",
20+
"targetAddr": "127.0.0.1:5114"
21+
}
22+
]
23+
}

e2e/testpod-multi-pvc.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright (c) Arm Limited and Contributors
3+
# Copyright (c) Intel Corporation
4+
---
5+
apiVersion: v1
6+
kind: Pod
7+
metadata:
8+
name: spdkcsi-test
9+
labels:
10+
app: spdkcsi-pvc
11+
spec:
12+
containers:
13+
- name: alpine
14+
image: alpine:3
15+
imagePullPolicy: "IfNotPresent"
16+
command: ["sleep", "365d"]
17+
volumeMounts:
18+
- mountPath: "/spdkvol1"
19+
name: spdk-volume1
20+
- mountPath: "/spdkvol2"
21+
name: spdk-volume2
22+
- mountPath: "/spdkvol3"
23+
name: spdk-volume3
24+
volumes:
25+
- name: spdk-volume1
26+
persistentVolumeClaim:
27+
claimName: spdkcsi-pvc1
28+
- name: spdk-volume2
29+
persistentVolumeClaim:
30+
claimName: spdkcsi-pvc2
31+
- name: spdk-volume3
32+
persistentVolumeClaim:
33+
claimName: spdkcsi-pvc3

0 commit comments

Comments
 (0)