@@ -10,16 +10,19 @@ DELETE_DIRECTORY="./tests/csi-sanity/rmdir_in_pod.sh"
1010
1111# Define the list of tests to skip as an array
1212SKIP_TESTS=(
13- " WithCapacity"
14- # Need to skip it because we do not support volume snapshots
15- " should fail when the volume source volume is not found"
16- # This case fails because we currently do not support read only volume creation on the linode side
17- # but we are supporting it in the CSI driver by mounting the volume as read only
18- " should fail when the volume is already published but is incompatible"
13+ " WithCapacity"
14+ # Need to skip it because we do not support volume snapshots
15+ " should fail when the volume source volume is not found"
16+ # This case fails because we currently do not support read only volume creation on the linode side
17+ # but we are supporting it in the CSI driver by mounting the volume as read only
18+ " should fail when the volume is already published but is incompatible"
1919)
2020
2121# Join the array into a single string with '|' as the separator
22- SKIP_TESTS_STRING=$( IFS=' |' ; echo " ${SKIP_TESTS[*]} " )
22+ SKIP_TESTS_STRING=$(
23+ IFS=' |'
24+ echo " ${SKIP_TESTS[*]} "
25+ )
2326
2427# Install the latest version of csi-sanity
2528go install github.com/kubernetes-csi/csi-test/v5/cmd/csi-sanity@latest
@@ -30,8 +33,44 @@ kubectl apply -f tests/csi-sanity/socat.yaml
3033# Wait for pod to be ready
3134kubectl wait --for=condition=ready --timeout=60s pods/csi-socat-0
3235
36+ # Patch the NodeServer daemonset and add the LINODE_TOKEN and LINODE_API env vars.
37+ # The csi-sanity check require CrateVolume and ListVolume calls to be working.
38+
39+ # Warning: This patch expects the csi-linode-plugin container to be the 2nd container
40+ # in the manifest
41+ kubectl patch daemonset csi-linode-node \
42+ -n kube-system \
43+ --type=' json' \
44+ -p=' [
45+ {
46+ "op": "add",
47+ "path": "/spec/template/spec/containers/1/env/-",
48+ "value": {
49+ "name": "LINODE_URL",
50+ "value": "https://api.linode.com/v4"
51+ }
52+ },
53+ {
54+ "op": "add",
55+ "path": "/spec/template/spec/containers/1/env/-",
56+ "value": {
57+ "name": "LINODE_TOKEN",
58+ "valueFrom": {
59+ "secretKeyRef": {
60+ "name": "linode",
61+ "key": "token"
62+ }
63+ }
64+ }
65+ }
66+ ]'
67+
68+ echo " Waiting for daemonset csi-linode-node to be ready"
69+ kubectl rollout status daemonset/csi-linode-node -n kube-system
70+ kubectl wait --namespace kube-system --for=condition=Ready pods --selector=app=csi-linode-node --timeout=180s
71+
3372# Start the port forwarding in the background and log output to a file
34- nohup kubectl port-forward pods/csi-socat-0 10000:10000 > port-forward.log 2>&1 &
73+ nohup kubectl port-forward pods/csi-socat-0 10000:10000 > port-forward.log 2>&1 &
3574
3675# Run the csi-sanity tests with the specified parameters
3776csi-sanity --ginkgo.vv --ginkgo.trace --ginkgo.skip " $SKIP_TESTS_STRING " --csi.endpoint=" $CSI_ENDPOINT " --csi.createstagingpathcmd=" $CREATE_DIRECTORY " --csi.createmountpathcmd=" $CREATE_DIRECTORY " --csi.removestagingpathcmd=" $DELETE_DIRECTORY " --csi.removemountpathcmd=" $DELETE_DIRECTORY "
@@ -41,10 +80,10 @@ PID=$(lsof -t -i :10000 -sTCP:LISTEN)
4180
4281# Check if a PID was found and kill the process if it exists
4382if [ -z " $PID " ]; then
44- echo " No process found on port 10000."
83+ echo " No process found on port 10000."
4584else
46- kill -9 " $PID "
47- echo " Process on port 10000 with PID $PID has been killed."
85+ kill -9 " $PID "
86+ echo " Process on port 10000 with PID $PID has been killed."
4887fi
4988
5089# Remove the socat statefulset
0 commit comments