fix: change CSC install step

This commit is contained in:
Jiaxun Song 2020-11-19 04:50:59 +00:00
parent bfdc82f398
commit 77511ab075

View File

@ -16,6 +16,10 @@
set -eo pipefail set -eo pipefail
if [[ -z "$(command -v csc)" ]]; then
GO111MODULE=off go get github.com/rexray/gocsi/csc
fi
function cleanup { function cleanup {
echo 'pkill -f nfsplugin' echo 'pkill -f nfsplugin'
pkill -f nfsplugin pkill -f nfsplugin
@ -24,16 +28,6 @@ function cleanup {
} }
trap cleanup EXIT trap cleanup EXIT
function install_csc_bin {
echo 'Installing CSC binary...'
export set GOPATH=$HOME/go
export set PATH=$PATH:$GOPATH/bin
go get github.com/rexray/gocsi/csc
pushd $GOPATH/src/github.com/rexray/gocsi/csc
make build
popd
}
function provision_nfs_server { function provision_nfs_server {
echo 'Installing NFS server on localhost' echo 'Installing NFS server on localhost'
apt-get update -y apt-get update -y
@ -42,8 +36,9 @@ function provision_nfs_server {
} }
provision_nfs_server provision_nfs_server
install_csc_bin
readonly CSC_BIN="$GOBIN/csc"
readonly cap="1,mount,"
readonly volname="citest-$(date +%s)" readonly volname="citest-$(date +%s)"
readonly volsize="2147483648" readonly volsize="2147483648"
readonly endpoint="unix:///tmp/csi.sock" readonly endpoint="unix:///tmp/csi.sock"
@ -63,34 +58,27 @@ echo 'Begin to run integration test...'
# Begin to run CSI functions one by one # Begin to run CSI functions one by one
echo "Create volume test:" echo "Create volume test:"
value="$(csc controller new --endpoint "$endpoint" --cap 1,block "$volname" --req-bytes "$volsize" --params "$params")" value="$("$CSC_BIN" controller new --endpoint "$endpoint" --cap "$cap" "$volname" --req-bytes "$volsize" --params "$params")"
sleep 15 sleep 15
volumeid="$(echo "$value" | awk '{print $1}' | sed 's/"//g')" volumeid="$(echo "$value" | awk '{print $1}' | sed 's/"//g')"
echo "Got volume id: $volumeid" echo "Got volume id: $volumeid"
csc controller validate-volume-capabilities --endpoint "$endpoint" --cap 1,block "$volumeid" "$CSC_BIN" controller validate-volume-capabilities --endpoint "$endpoint" --cap "$cap" "$volumeid"
echo "stage volume test:"
csc node stage --endpoint "$endpoint" --cap 1,block --staging-target-path "$staging_target_path" "$volumeid"
echo "publish volume test:" echo "publish volume test:"
csc node publish --endpoint "$endpoint" --cap 1,block --vol-context "$params" --target-path "$target_path" "$volumeid" "$CSC_BIN" node publish --endpoint "$endpoint" --cap "$cap" --vol-context "$params" --target-path "$target_path" "$volumeid"
sleep 2 sleep 2
echo "unpublish volume test:" echo "unpublish volume test:"
csc node unpublish --endpoint "$endpoint" --target-path "$target_path" "$volumeid" "$CSC_BIN" node unpublish --endpoint "$endpoint" --target-path "$target_path" "$volumeid"
sleep 2
echo "unstage volume test:"
csc node unstage --endpoint "$endpoint" --staging-target-path "$staging_target_path" "$volumeid"
sleep 2 sleep 2
echo "Delete volume test:" echo "Delete volume test:"
csc controller del --endpoint "$endpoint" "$volumeid" "$CSC_BIN" controller del --endpoint "$endpoint" "$volumeid" --timeout 10m
sleep 15 sleep 15
csc identity plugin-info --endpoint "$endpoint" "$CSC_BIN" identity plugin-info --endpoint "$endpoint"
csc node get-info --endpoint "$endpoint" "$CSC_BIN" node get-info --endpoint "$endpoint"
echo "Integration test is completed." echo "Integration test is completed."