# README
Integration test for hyper cli
Functional test for hyper cli.
use apirouter service on packet(dev env) or zenlayer(online env) as backend.
- Project status
- Test case name
- Command list
- Run test case
Project status
cli test case
- cli_attach_test
- cli_attach_unix_test
- cli_config_test
- cli_create_test
- cli_commit_test
- cli_exec_test
- cli_exec_unix_test
- cli_fip_test
- cli_help_test
- cli_history_test
- cli_images_test
- cli_info_test
- cli_inspect_experimental_test
- cli_inspect_test
- cli_kill_test
- cli_links_test
- cli_links_unix_test
- cli_load_basic_test
- cli_load_large_test
- cli_load_legacy_test
- cli_load_local_test
- cli_login_test
- cli_logs_test
- cli_port_test
- cli_ps_test
- cli_pull_test
- cli_push_test
- cli_region_test
- cli_rename_test
- cli_restart_test
- cli_rm_test
- cli_rmi_test
- cli_run_test
- cli_run_unix_test
- cli_search_test
- cli_share_volume_test
- cli_snapshot_test
- cli_start_test
- cli_stats_test
- cli_version_test
- cli_volume_test
api test case
- api_attach_test
- api_containers_test
- api_create_test
- api_exec_test
- api_exec_resize_test
- api_images_test
- api_info_test
- api_inspect_test
- api_logs_test
- api_stats_test
- api_snapshots_test
- api_version_test
- api_volumes_test
extra
skip
not support build, tag
- cli_authz_unix_test
- cli_build_test
- cli_build_unix_test
- cli_by_digest_test
- cli_cp_from_container_test
- cli_cp_test
- cli_cp_to_container_test
- cli_cp_utils
- cli_daemon_test
- cli_diff_test
- cli_events_test
- cli_events_unix_test
- cli_experimental_test
- cli_export_import_test
- cli_external_graphdriver_unix_test
- cli_import_test
- cli_nat_test
- cli_netmode_test
- cli_network_unix_test
- cli_oom_killed_test
- cli_pause_test
- cli_proxy_test
- cli_pull_local_test
- cli_pull_trusted_test
- cli_save_load_test
- cli_save_load_unix_test
- cli_sni_test
- cli_start_volume_driver_unix_test
- cli_tag_test
- cli_top_test
- cli_update_unix_test
- cli_v2_only_test
- cli_volume_driver_compat_unix_test
- cli_wait_test
Test case name
- TestCliConfig
- TestCliCreate
- TestCliCommit
- TestCliExec
- TestCliFip
- TestCliHelp
- TestCliHistory
- TestCliInfo
- TestCliInspect
- TestCliKill
- TestCliLinks
- TestCliLoadFromUrl
- TestCliLoadFromLocal
- TestCliLogin
- TestCliLogs
- TestCliPort
- TestCliPs
- TestCliPull
- TestCliPush
- TestCliRename
- TestCliRestart
- TestCliRmi
- TestCliRm
- TestCliRun
- TestCliSearch
- TestCliSnapshot
- TestCliStart
- TestCliVersion
- TestCliVolume
Command list
hyper only
config fip snapshot
both
attach create exec history images
info inspect kill login logout
logs port ps pull rename
restart rm rmi run search
start stats stop version volume
docker only
not support for hyper currently
build commit cp diff events
export import load network pause
push save tag top unpause
update wait
Run test case
Clone hypercli repo
$ git clone https://github.com/hyperhq/hypercli.git
Run test in docker container for dev
build docker image for dev
build docker image in host OS Use
CentOS
as test env Image name ishyperhq/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
andSECRET_KEY
inintegration-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 [email protected]: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 ishyperhq/hypercli-auto-test:qa
// run in dir hypercli/integration-cli on host os
$ ./util.sh build-qa
run test in docker container
run all test case for qa
run test via util.sh
$ cd integration-cli
//test master branch
$ ./util.sh qa
//test integration-test branch
$ ./util.sh qa integration-test
//test PR
$ ./util.sh qa "#222"
run test via docker cli
Required parameters:
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
run test via hyper cli
Just replace docker
with hyper
in command line.
# Functions
NewDaemon returns a Daemon instance to be used for testing.
# Constants
DefaultImage is the name of the base image for the majority of tests that are run across suites.
WindowsBaseImage is the name of the base image for Windows testing.
# Variables
List test requirements.
List test requirements.
List test requirements.
List test requirements.
List test requirements.
List test requirements.
List test requirements.
List test requirements.
List test requirements.
List test requirements.
List test requirements.
List test requirements.
List test requirements.
SysInfo stores information about which features a kernel supports.
List test requirements.
# Structs
Daemon represents a Docker daemon for the testing framework.
FakeContext creates directories that can be used as a build context.
# Interfaces
FakeStorage is a static file server.