From 39b8779b2aa6207895a01b27b26d69fa9766664f Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Sun, 17 Oct 2021 06:00:28 +0000 Subject: [PATCH] test: add sanity test github action fix sanity test failure fix test failure skip one test --- .github/workflows/linux.yaml | 29 +++++++++++++++++++++++++++++ Makefile | 2 +- test/sanity/run-test.sh | 5 +++-- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/linux.yaml diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml new file mode 100644 index 00000000..0482f443 --- /dev/null +++ b/.github/workflows/linux.yaml @@ -0,0 +1,29 @@ +name: Linux Unit tests +on: + pull_request: {} + push: {} + +jobs: + + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.17 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Sanity test + env: + GITHUB_ACTIONS: true + run: | + export PATH=$PATH:$HOME/.local/bin + make + echo "is running in github actions: $GITHUB_ACTIONS" + make sanity-test diff --git a/Makefile b/Makefile index 108850cf..7711daac 100644 --- a/Makefile +++ b/Makefile @@ -18,5 +18,5 @@ all: build include release-tools/build.make .PHONY: sanity-test -sanity-test: build +sanity-test: ./test/sanity/run-test.sh diff --git a/test/sanity/run-test.sh b/test/sanity/run-test.sh index 10850642..f149487c 100755 --- a/test/sanity/run-test.sh +++ b/test/sanity/run-test.sh @@ -69,12 +69,13 @@ else fi echo 'Begin to run sanity test...' +skipTests='Controller Server|should work|should be idempotent|should remove target path' CSI_SANITY_BIN=$GOPATH/bin/csi-sanity if [ -z "$GITHUB_ACTIONS" ] then # if not running on github actions, do not use 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='Controller Server|should work|should be idempotent' + "$CSI_SANITY_BIN" --ginkgo.v --csi.secrets="$(pwd)/test/sanity/secrets.yaml" --csi.testvolumeparameters="$(pwd)/test/sanity/params.yaml" --csi.endpoint="$endpoint" --ginkgo.skip="$skipTests" else # if running on github actions, use sudo - 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='Controller Server|should work|should be idempotent' + 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="$skipTests" fi