Skip to content

Commit 8953fd2

Browse files
committed
test: refactor test infra
fix travis ci config remove echo test: fix test failure test: fix integration test failure
1 parent d0c8d33 commit 8953fd2

File tree

5 files changed

+42
-22
lines changed

5 files changed

+42
-22
lines changed

.travis.yml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,28 @@ env:
77
- GO111MODULE=off
88

99
go:
10-
- "1.11.4"
10+
- "1.12.1"
1111

12-
before_install:
13-
- go get github.com/mattn/goveralls
14-
- go get github.com/rexray/gocsi/csc
15-
- go get github.com/golang/dep/cmd/dep
16-
17-
script:
18-
- hack/verify-all.sh
19-
- go test -covermode=count -coverprofile=profile.cov ./pkg/...
20-
- make blobfuse
21-
- make sanity-test
22-
- make integration-test
23-
- make blobfuse-windows
12+
jobs:
13+
include:
14+
- stage: test
15+
name: "build test"
16+
install:
17+
- GO111MODULE=off go get github.com/mattn/goveralls
18+
- go get github.com/golang/dep/cmd/dep
19+
script:
20+
- hack/verify-all.sh
21+
- make blobfuse
22+
- make blobfuse-windows
23+
- go test -covermode=count -coverprofile=profile.cov ./pkg/...
24+
- stage: test
25+
name: "sanity Test"
26+
script: make sanity-test
27+
after_failure: TRAVIS_TEST_RESULT=0
28+
- stage: test
29+
name: "integration Test"
30+
install:
31+
- GO111MODULE=off go get github.com/rexray/gocsi/csc
32+
script:
33+
- make blobfuse
34+
- make integration-test

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test:
3030
go test -covermode=count -coverprofile=profile.cov ./pkg/...
3131
$GOPATH/bin/goveralls -coverprofile=profile.cov -service=travis-ci
3232
integration-test:
33-
sudo test/integration/run-tests-all-clouds.sh
33+
test/integration/run-tests-all-clouds.sh
3434
sanity-test:
3535
test/sanity/run-tests-all-clouds.sh
3636
blobfuse:

test/integration/run-test.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717

1818
set -euo pipefail
1919

20-
csc=$GOPATH/bin/csc
20+
csc="csc"
21+
if [ -v GOPATH ]; then
22+
csc=$GOPATH/bin/csc
23+
fi
24+
2125
volname=`date +%s`
2226
volname="citest-$volname"
2327
volSize="2147483648"
@@ -68,15 +72,15 @@ if [ -v aadClientSecret ]; then
6872
if [ "$cloud" != "AzureChinaCloud" ]; then
6973
# blobfuse mount/unmount on travis VM does not work against AzureChinaCloud
7074
echo "mount volume test:"
71-
$csc node publish --endpoint $endpoint --cap 1,block --target-path $target_path $volumeid
75+
sudo $csc node publish --endpoint $endpoint --cap 1,block --target-path $target_path $volumeid
7276
retcode=$?
7377
if [ $retcode -gt 0 ]; then
7478
exit $retcode
7579
fi
7680
sleep 2
7781

7882
echo "unmount volume test:"
79-
$csc node unpublish --endpoint $endpoint --target-path $target_path $volumeid
83+
sudo $csc node unpublish --endpoint $endpoint --target-path $target_path $volumeid
8084
retcode=$?
8185
if [ $retcode -gt 0 ]; then
8286
exit $retcode

test/integration/run-tests-all-clouds.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,18 @@
1616

1717
set -euo pipefail
1818

19-
export set AZURE_CREDENTIAL_FILE=/tmp/azure.json
19+
if [ ! -v AZURE_CREDENTIAL_FILE ]; then
20+
export set AZURE_CREDENTIAL_FILE=/tmp/azure.json
21+
fi
2022

2123
# run test on AzurePublicCloud
22-
cp test/integration/azure.json $AZURE_CREDENTIAL_FILE
2324
if [ -v aadClientSecret ]; then
25+
cp test/integration/azure.json $AZURE_CREDENTIAL_FILE
26+
27+
# copy blobfuse binary
28+
sudo mkdir /usr/blob
29+
sudo cp test/sanity/blobfuse /usr/blob/blobfuse
30+
2431
sed -i "s/tenantId-input/$tenantId/g" $AZURE_CREDENTIAL_FILE
2532
sed -i "s/subscriptionId-input/$subscriptionId/g" $AZURE_CREDENTIAL_FILE
2633
sed -i "s/aadClientId-input/$aadClientId/g" $AZURE_CREDENTIAL_FILE

test/sanity/run-tests-all-clouds.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# set -euo pipefail
17+
set -euo pipefail
1818

1919
if [ ! -v AZURE_CREDENTIAL_FILE ]; then
2020
export set AZURE_CREDENTIAL_FILE=/tmp/azure.json
@@ -38,8 +38,6 @@ if [ -v aadClientSecret ]; then
3838
sed -i "s/location-input/$location/g" $AZURE_CREDENTIAL_FILE
3939

4040
sudo ${GO_BIN_PATH} test -v ./test/sanity/...
41-
# make it always succeed for now until enabled sanity test on CI
42-
exit 0
4341
else
4442
if [ -v subscriptionId ]; then
4543
echo "skip sanity test in CI env"

0 commit comments

Comments
 (0)