Skip to content

Commit 02602f5

Browse files
authored
Merge pull request #45 from csi-driver/refator-test-infra
test: refactor test infra
2 parents d0c8d33 + 1cd1e52 commit 02602f5

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: 5 additions & 1 deletion
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"

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

Lines changed: 11 additions & 4 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
@@ -29,7 +36,7 @@ if [ -v aadClientSecret ]; then
2936
sed -i "s/location-input/$location/g" $AZURE_CREDENTIAL_FILE
3037
fi
3138

32-
test/integration/run-test.sh "tcp://127.0.0.1:10000" "/tmp/testmount1" "AzurePublicCloud"
39+
sudo test/integration/run-test.sh "tcp://127.0.0.1:10000" "/tmp/testmount1" "AzurePublicCloud"
3340

3441
# run test on AzureChinaCloud
3542
if [ -v aadClientSecret_china ]; then
@@ -43,5 +50,5 @@ if [ -v aadClientSecret_china ]; then
4350
sed -i "s/resourceGroup-input/${resourceGroup_china}/g" $AZURE_CREDENTIAL_FILE
4451
sed -i "s/location-input/${location_china}/g" $AZURE_CREDENTIAL_FILE
4552

46-
test/integration/run-test.sh "tcp://127.0.0.1:10001" "/tmp/testmount2" "AzureChinaCloud"
53+
sudo test/integration/run-test.sh "tcp://127.0.0.1:10001" "/tmp/testmount2" "AzureChinaCloud"
4754
fi

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)