Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit f62bbcc

Browse files
committed
[integration-test] support test PR
1 parent e2b6174 commit f62bbcc

File tree

4 files changed

+43
-8
lines changed

4 files changed

+43
-8
lines changed

Dockerfile.qa

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ ENV DOCKER_CERT_PATH=fixtures/hyper_ssl
2828
ENV DOCKER_TLS_VERIFY=
2929

3030
ENV DOCKER_HOST="tcp://us-west-1.hyper.sh:443"
31+
## if BRANCH start with '#', then it means PR number, otherwise it means branch name
3132
ENV BRANCH="master"
3233

3334
ENV ACCESS_KEY=

hack/generate-hyper-conf-qa.sh

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
#!/bin/bash
22

3+
env
4+
35
# set default value of DOCKER_HOST and BRANCH
46
if [[ "$DOCKER_HOST" == "" ]];then
57
DOCKER_HOST="tcp://us-west-1.hyper.sh:443"
68
fi
7-
if [[ "$BRANCH" == "" ]];then
8-
BRANCH="master"
9+
10+
PR=""
11+
if [[ "${BRANCH:0:1}" == "#" ]];then
12+
PR=${BRANCH:1}
13+
BRANCH=""
14+
echo "========== Task: test PR #${PR} =========="
15+
else
16+
if [[ "${BRANCH}" == "" ]];then
17+
BRANCH="master"
18+
fi
19+
echo "========== Task: test BRANCH ${BRANCH} =========="
920
fi
1021

1122

@@ -23,8 +34,6 @@ if [[ "$@" != "./build.sh" ]];then
2334
}
2435
EOF
2536

26-
env
27-
2837
echo "========== config git proxy =========="
2938
if [ "${http_proxy}" != "" ];then
3039
git config --global http.proxy ${http_proxy}
@@ -34,16 +43,27 @@ if [ "${https_proxy}" != "" ];then
3443
fi
3544
git config --list | grep proxy
3645

46+
echo "========== ping github.com =========="
47+
ping -c 6 -W 10 github.com
48+
3749
echo "========== Clone hypercli repo =========="
3850
mkdir -p /go/src/github.com/{hyperhq,docker}
3951
cd /go/src/github.com/hyperhq
4052
git clone https://github.com/hyperhq/hypercli.git
4153

4254
echo "========== Build hypercli =========="
4355
cd /go/src/github.com/hyperhq/hypercli
44-
git checkout $BRANCH
56+
if [[ "${BRANCH}" != "" ]];then
57+
echo "checkout branch :${BRANCH}"
58+
git checkout ${BRANCH}
59+
elif [[ "${PR}" != "" ]];then
60+
echo "checkout pr :#$PR"
61+
git fetch origin pull/${PR}/head:pr-${PR}
62+
git checkout pr-${PR}
63+
fi
64+
4565
if [[ $? -ne 0 ]];then
46-
echo "Branch $BRANCH not exist!"
66+
echo "Branch ${BRANCH} not exist!"
4767
exit 1
4868
fi
4969
./build.sh
@@ -67,6 +87,7 @@ fi
6787

6888
#execute command
6989
if [[ $# -ne 0 ]];then
90+
echo "========== Test Cmd: $@ =========="
7091
cd /go/src/github.com/hyperhq/hypercli/integration-cli && eval $@
7192
if [[ "$@" == "./build.sh" ]];then
7293
#show make result

integration-cli/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ $ ./util.sh qa
322322
323323
//test integration-test branch
324324
$ ./util.sh qa integration-test
325+
326+
//test PR
327+
$ ./util.sh qa "#222"
325328
```
326329

327330
#### run test via docker cli
@@ -337,14 +340,24 @@ $ docker run -it --rm \
337340
-e SECRET_KEY=${SECRET_KEY} \
338341
hyperhq/hypercli-auto-test:qa go test -check.f TestCli -timeout 180m
339342
343+
344+
//test `specified PR`
345+
$ docker run -it --rm \
346+
-e ACCESS_KEY=${ACCESS_KEY} \
347+
-e SECRET_KEY=${SECRET_KEY} \
348+
-e BRANCH="#221" \
349+
hyperhq/hypercli-auto-test:qa go test -check.f TestCli -timeout 180m
350+
351+
340352
//test `specified branch` with `packet` apirouter
341353
$ docker run -it --rm \
342354
-e ACCESS_KEY=${ACCESS_KEY} \
343355
-e SECRET_KEY=${SECRET_KEY} \
344356
-e BRANCH=integration-test \
345-
-e DOCKER_HOST=tcp://147.75.195.39:6443 \
357+
-e DOCKER_HOST=tcp://147.75.x.x:6443 \
346358
hyperhq/hypercli-auto-test:qa go test -check.f TestCli -timeout 180m
347359
360+
348361
//test with http proxy
349362
$ docker run -it --rm \
350363
-e ACCESS_KEY=${ACCESS_KEY} \

integration-cli/util.conf.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export DOCKER_REMOTE_DAEMON=1
77
#########################################
88
#packet env
99
#########################################
10-
#export HYPER_HOST="tcp://147.75.195.39:6443" #packet
10+
#export HYPER_HOST="tcp://147.75.x.x:6443" #packet
1111
export HYPER_HOST="tcp://us-west-1.hyper.sh:443" #zenlayer
1212

1313
#Hyper Credentials

0 commit comments

Comments
 (0)