From e2b281b8575e591eda56d65f2ddab331b3927a21 Mon Sep 17 00:00:00 2001 From: Manohar Reddy Date: Sun, 21 Mar 2021 17:31:05 +0530 Subject: [PATCH] Setup SMB Server for sanity tests --- .github/workflows/linux.yaml | 2 ++ test/sanity/params.yaml | 1 + test/sanity/run-test.sh | 18 +++++++++++++----- test/sanity/secrets.yaml | 3 +++ 4 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 test/sanity/params.yaml create mode 100644 test/sanity/secrets.yaml diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index ad75d5b62e1..eba301ca181 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -42,6 +42,8 @@ jobs: run: | export PATH=$PATH:$HOME/.local/bin make + echo "CHECK GITHUB ACTIONS\n" + sudo su make sanity-test - name: Send coverage diff --git a/test/sanity/params.yaml b/test/sanity/params.yaml new file mode 100644 index 00000000000..09bf4b7c595 --- /dev/null +++ b/test/sanity/params.yaml @@ -0,0 +1 @@ +source: "//127.0.0.1/share" diff --git a/test/sanity/run-test.sh b/test/sanity/run-test.sh index 9ed1e66d883..5eae266db8c 100755 --- a/test/sanity/run-test.sh +++ b/test/sanity/run-test.sh @@ -17,11 +17,12 @@ set -eo pipefail function cleanup { - echo 'pkill -f smbplugin' - pkill -f smbplugin echo 'Deleting CSI sanity test binary' rm -rf csi-test + echo 'Uninstalling samba server on localhost' + docker rm samba -f } + trap cleanup EXIT function install_csi_sanity_bin { @@ -36,6 +37,13 @@ function install_csi_sanity_bin { popd } +function provision_samba_server { + echo 'Running samba server on localhost' + docker run -e PERMISSIONS=0777 -p 445:445 -d andyzhangx/samba:win-fix -s "share;/smbshare/;yes;no;no;all;none" -u "sanity;sanitytestpassword" -p +} + +provision_samba_server + if [[ -z "$(command -v csi-sanity)" ]]; then install_csi_sanity_bin fi @@ -46,8 +54,8 @@ if [[ "$#" -gt 0 ]] && [[ -n "$1" ]]; then nodeid="$1" fi -_output/smbplugin --endpoint "$endpoint" --nodeid "$nodeid" -v=5 & +sudo _output/smbplugin --endpoint "$endpoint" --nodeid "$nodeid" -v=5 & echo 'Begin to run sanity test...' -readonly CSI_SANITY_BIN='csi-sanity' -"$CSI_SANITY_BIN" --ginkgo.v --ginkgo.noColor --csi.endpoint="$endpoint" --ginkgo.skip='should fail when the requested volume does not exist|should work|create a volume with already existing name and different capacity|should be idempotent|should fail when volume does not exist on the specified path' +CSI_SANITY_BIN=$GOPATH/bin/csi-sanity +sudo "$CSI_SANITY_BIN" --ginkgo.v --csi.secrets="$(pwd)/test/sanity/secrets.yaml" --csi.testvolumeparameters="$(pwd)/test/sanity/params.yaml" --csi.endpoint="$endpoint" --ginkgo.skip='should fail when the requested volume does not exist|should work|create a volume with already existing name and different capacity|should be idempotent' diff --git a/test/sanity/secrets.yaml b/test/sanity/secrets.yaml new file mode 100644 index 00000000000..bfd8b037c28 --- /dev/null +++ b/test/sanity/secrets.yaml @@ -0,0 +1,3 @@ +NodeStageVolumeSecret: + username: sanity + password: sanitytestpassword