Skip to content

Commit

Permalink
Setup SMB Server for sanity tests
Browse files Browse the repository at this point in the history
  • Loading branch information
boddumanohar committed Apr 4, 2021
1 parent c16b61d commit e2b281b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/sanity/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source: "//127.0.0.1/share"
18 changes: 13 additions & 5 deletions test/sanity/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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'
3 changes: 3 additions & 0 deletions test/sanity/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NodeStageVolumeSecret:
username: sanity
password: sanitytestpassword

0 comments on commit e2b281b

Please sign in to comment.