build docker image in host OS
Use CentOS as test env
Image name is hyperhq/hypercli-auto-test:dev
// run in dir hypercli/integration-cli on host os
$ ./util.sh build-dev
make hyper cli
build hyper cli binary from source code
// run in dir hypercli/integration-cli on host os
$ ./util.sh make
enter container
update ACCESS_KEY and SECRET_KEY in integration-cli/util.conf
// run in dir hypercli/integration-cli on host os
$ ./util.sh enter
run test in container
$ ./util.sh test all
Run test on localhost for dev
prepare
// ensure hyperhq and docker dir
mkdir -p $GOPATH/src/github.com/{hyperhq,docker}
// clone and build hypercli
cd $GOPATH/src/github.com/hyperhq
git clone git@github.com:hyperhq/hypercli.git
cd hypercli
./build.sh
// copy hyper binary to /usr/bin/hyper
sudo cp hyper/hyper /usr/bin/hyper
// create link
cd $GOPATH/src/github.com/docker
ln -s ../hyperhq/hypercli docker
// generate util.conf
$ cd $GOPATH/src/github.com/hyperhq/hypercli
$ git checkout integration-test
$ cd integration-cli
$ ./util.sh
// config util.conf
$ vi util.conf
ACCESS_KEY="<hyper access key>"
SECRET_KEY="<hyper secret key>"
run test case
// run all test cases
$ ./util.sh test all
// run test case with timeout
$ ./util.sh test all -timout 20m
// run specified test case
$ ./util.sh test -check.f ^TestCliLoadFromLocalTar$
// run test cases start with specified prefix
$ ./util.sh test -check.f TestCliLoadFromLocalTar
// combined use
$ ./util.sh test -check.f 'TestCliLoadFromLocalTarEmpty|TestCliLoadFromLocalPullAndLoad' -timeout 20m
Run test in docker container for qa
build docker image for qa
build docker image in host OS
Use CentOS as test env
Image name is hyperhq/hypercli-auto-test:qa
// run in dir hypercli/integration-cli on host os
$ ./util.sh build-qa
APIROUTER: apirouter entrypoint REGION: could be us-west-1(zl2), eu-central-1(eu1), RegionOne(packet) ACCESS_KEY,SECRET_KEY: Hyper credential for test BRANCH: hyper cli branch name or PR number
//test `master` branch of hypercli with `eu-west-1` apirouter
$ docker run -it --rm \
-e ACCESS_KEY=${ACCESS_KEY} \
-e SECRET_KEY=${SECRET_KEY} \
-e DOCKER_HOST=tcp://us-west-1.hyper.sh:443 \
-e REGION=us-west-1 \
-e BRANCH=master \
hyperhq/hypercli-auto-test:qa go test -check.f TestCli -timeout 180m
//test `specified PR`
$ docker run -it --rm \
-e DOCKER_HOST=${APIROUTER} \
-e REGION=${REGION} \
-e ACCESS_KEY=${ACCESS_KEY} \
-e SECRET_KEY=${SECRET_KEY} \
-e BRANCH="#221" \
hyperhq/hypercli-auto-test:qa go test -check.f TestCli -timeout 180m
//test `specified case name`
$ docker run -it --rm \
-e DOCKER_HOST=${APIROUTER} \
-e REGION=${REGION} \
-e ACCESS_KEY="${ACCESS_KEY}" \
-e SECRET_KEY="${SECRET_KEY}" \
-e BRANCH=${BRANCH} \
hyperhq/hypercli-auto-test:qa go test -check.f 'TestCliInfo|TestCliFip' -timeout 180m
//test with `packet` apirouter
$ docker run -it --rm \
-e ACCESS_KEY=${ACCESS_KEY} \
-e SECRET_KEY=${SECRET_KEY} \
-e BRANCH=${BRANCH} \
-e DOCKER_HOST=tcp://147.75.x.x:6443 \
-e REGION=RegionOne \
hyperhq/hypercli-auto-test:qa go test -check.f TestCli -timeout 180m
//test with http proxy
$ docker run -it --rm \
-e DOCKER_HOST=${APIROUTER} \
-e REGION=${REGION} \
-e ACCESS_KEY=${ACCESS_KEY} \
-e SECRET_KEY=${SECRET_KEY} \
-e BRANCH=${BRANCH} \
-e http_proxy=${http_proxy} \
-e https_proxy=${https_proxy} \
hyperhq/hypercli-auto-test:qa go test -check.f TestCliInfo
//test basic test case only
$ docker run -it --rm \
-e DOCKER_HOST=${APIROUTER} \
-e REGION=${REGION} \
-e ACCESS_KEY=${ACCESS_KEY} \
-e SECRET_KEY=${SECRET_KEY} \
-e BRANCH=${BRANCH} \
hyperhq/hypercli-auto-test:qa go test -check.f "TestCli.*Basic" -timeout 180m