Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
cloudinit
cniproxy
echo-socket-activated
empty-image
image
inspect
rkt-monitor
stub-stage1
testutils
README.md
aws.sh
build-and-run-tests.sh
env_file_test.conf
functional.mk
install-deps.sh
key1.gpg
key2.gpg
rkt_ace_validator_test.go
rkt_api_service_bench_test.go
rkt_api_service_nspawn_test.go
rkt_api_service_test.go
rkt_app_isolator_nspawn_test.go
rkt_app_isolator_test.go
rkt_app_sandbox_test.go
rkt_attach_test.go
rkt_auth_test.go
rkt_caps_kvm_test.go
rkt_caps_nspawn_test.go
rkt_caps_test.go
rkt_cat_manifest_test.go
rkt_config_test.go
rkt_devices_test.go
rkt_diagnostic_test.go
rkt_dns_test.go
rkt_env_test.go
rkt_error_output_test.go
rkt_etc_hosts_test.go
rkt_exec_test.go
rkt_exit_test.go
rkt_export_container_test.go
rkt_export_fly_test.go
rkt_export_test.go
rkt_fetch_test.go
rkt_flavor.go
rkt_flavor_coreos.go
rkt_flavor_default.go
rkt_flavor_fly.go
rkt_flavor_host.go
rkt_flavor_kvm.go
rkt_flavor_src.go
rkt_fly_test.go
rkt_gc_nspawn_test.go
rkt_gc_test.go
rkt_hostname_test.go
rkt_image_cat_manifest_test.go
rkt_image_dependencies_test.go
rkt_image_export_test.go
rkt_image_extract_test.go
rkt_image_gc_test.go
rkt_image_list_test.go
rkt_image_render_test.go
rkt_image_rm_test.go
rkt_image_verify_test.go
rkt_interactive_test.go
rkt_ipcns_test.go
rkt_journal_test.go
rkt_list_test.go
rkt_metadata_service_test.go
rkt_mount_overlay_test.go
rkt_mount_test.go
rkt_mountns_test.go
rkt_mtab_test.go
rkt_net_kvm_test.go
rkt_net_nspawn_test.go
rkt_net_test.go
rkt_no_new_privs_test.go
rkt_non_root_test.go
rkt_oom_score_adj_test.go
rkt_os_arch_test.go
rkt_paths_test.go
rkt_pid_file_kvm_test.go
rkt_pid_file_nspawn_test.go
rkt_pid_file_test.go
rkt_prepare_test.go
rkt_rm_nspawn_test.go
rkt_rm_test.go
rkt_root_commands_test.go
rkt_run_pod_manifest_test.go
rkt_run_test.go
rkt_run_user_group_test.go
rkt_seccomp_test.go
rkt_service_file_test.go
rkt_socket_activation_test.go
rkt_socket_proxyd_test.go
rkt_stage1_loading_test.go
rkt_status_test.go
rkt_stop_test.go
rkt_supplementary_gids_test.go
rkt_tests.go
rkt_trust_test.go
rkt_userns_test.go
rkt_volume_mount_fly_test.go
rkt_volume_mount_generic_test.go
rkt_volume_mount_test.go
rkt_volume_nspawn_test.go
rkt_volume_test.go
secring.gpg
test-on-several-distro.md
tests.mk

README.md

rkt functional tests

This directory contains a set of functional tests for rkt. The tests use gexpect to spawn various rkt run commands and look for expected output.

Semaphore Continuous Integration System

The tests run on the Semaphore CI system through the rktbot user, which is part of the coreos org on Semaphore. This user is authorized against the corresponding rktbot GitHub account. The credentials for rktbot are currently managed by CoreOS.

The tests are executed on Semaphore at each Pull Request (PR). Each GitHub PR page should have a link to the test results on Semaphore.

Developers can disable the tests by adding [skip ci] in the last commit message of the PR.

Build settings

Select the "Other" language. We don't use "Go" language setting, because rkt is not a typical go project (building it with a go get won't get you too far). Also, the "Go" setting is creating a proper GOPATH directory structure with some symlinks on top, which rkt does not need at all and some go tools we use do not like the symlinks in GOPATH at all.

The tests will run on two VMs. The "Setup" and "Post thread" sections will be executed on both VMs. The "Thread 1" and "Thread 2" will be executed in parallel in separate VMs.

Setup

sudo groupadd rkt
sudo gpasswd -a runner rkt
./tests/install-deps.sh

Thread 1

./tests/build-and-run-tests.sh -f none -c
./tests/build-and-run-tests.sh -f kvm -c

Thread 2

./tests/build-and-run-tests.sh -f coreos -c
./tests/build-and-run-tests.sh -f host -c

Post thread

git clean -ffdx

Other possible commands

The LKVM stage1 or other versions of systemd are not currently tested. It would be possible to add more tests with the following commands:

./tests/build-and-run-tests.sh -f src -s v227 -c
./tests/build-and-run-tests.sh -f src -s master -c
./tests/build-and-run-tests.sh -f src -s v229 -c

build-and-run-tests.sh parameters description

The build script has the following parameters:

  • -c - Run cleanup. Cleanup has two phases: after build and after tests. In the after build phase, this script removes artifacts from external dependencies (like kernel sources in the kvm flavor). In the after tests phase, it removes rkt build artifacts and (if the build is running on CI or if the -x flag is used) it unmounts the remaining rkt mountpoints, removes unused rkt NICs and flushes the current state of IPAM IP reservation.
  • -d - Run build based on current state of local rkt repository instead of commited changes.
  • -f - Select flavor for rkt. You can choose only one from the following list: "coreos, host, kvm, none, src".
  • -j - Build without running unit and functional tests. Artifacts are available after build.
  • -s - Systemd version. You can choose master or a tag from the systemd GitHub repository.
  • -u - Show usage message and exit.
  • -x - Force after-test cleanup on a non-CI system. WARNING: This flag can affect your system. Use with caution.

Platform

Select Ubuntu 14.04 LTS v1503 (beta with Docker support). The platform with Docker support means the tests will run in a VM.

Manually running the tests

The tests can be run manually. There is a rule to run unit, functional and all tests.

Unit tests

The unit tests can be run with make unit-check after you built the project.

Functional tests

The functional tests require to pass --enable-functional-tests to the configure script, then, after building the project, you can run the tests.

./autogen.sh
./configure --enable-functional-tests
make -j4
make functional-check

For more details about the --enable-functional-tests parameter, see configure script parameters documentation.

All tests

To run all tests, see functional tests to configure and build it with functional tests enabled. Instead of make functional-check you have to call make check to run all tests.

Passing additional parameters

You can use a GO_TEST_FUNC_ARGS variable to pass additional parameters to go test. This is mostly useful for running only the selected functional tests. The variable is ignored in unit tests.

make check GO_TEST_FUNC_ARGS='-run NameOfTheTest'
make functional-check GO_TEST_FUNC_ARGS='-run NameOfTheTest'

Run go help testflag to get more informations about possible flags accepted by go test.

Running the benchmark

Running the benchmark is similar to running the other tests, we just need to pass additional parameters to go test:

make check GO_TEST_FUNC_ARGS='-bench=. -run=Benchmark'
make functional-check GO_TEST_FUNC_ARGS='-bench=. -run=Benchmark'