k3s/tests/e2e
Derek Nola efab09bc1f
E2E Improvements and groundwork for test-pad tool (#5593)
* Add rancher install sript, taints to cp/etcd roles
* Revert back to generic/ubuntu2004, libvirt networking is unreliable on opensuse
* Added support for alpine
* Rancher deployment script
* Refactor installType into function
* Cleanup splitserver test
Signed-off-by: Derek Nola <derek.nola@suse.com>
2022-06-13 13:36:26 -07:00
..
amd64_resource_files Added option to deploy hardened k3s (#5415) 2022-04-14 15:00:48 -07:00
arm_resource_files
scripts E2E Improvements and groundwork for test-pad tool (#5593) 2022-06-13 13:36:26 -07:00
secretsencryption E2E Improvements and groundwork for test-pad tool (#5593) 2022-06-13 13:36:26 -07:00
splitserver E2E Improvements and groundwork for test-pad tool (#5593) 2022-06-13 13:36:26 -07:00
upgradecluster E2E Improvements and groundwork for test-pad tool (#5593) 2022-06-13 13:36:26 -07:00
validatecluster E2E Improvements and groundwork for test-pad tool (#5593) 2022-06-13 13:36:26 -07:00
Dockerfile.build
README.md Testing directory and documentation rework. (#5256) 2022-03-15 10:29:56 -07:00
testutils.go E2E Split Server Test (#5286) 2022-03-17 16:56:10 -07:00
vagrantdefaults.rb E2E Improvements and groundwork for test-pad tool (#5593) 2022-06-13 13:36:26 -07:00

End-to-End (E2E) Tests

E2E tests cover multi-node K3s configuration and administration: bringup, update, teardown etc. across a wide range of operating systems. E2E tests are run nightly as part of K3s quality assurance (QA).

Framework

End-to-end tests utilize Ginkgo and Gomega like the integration tests, but rely on Vagrant to provide the underlying cluster configuration.

Currently tested operating systems are:

Format

All E2E tests should be placed under tests/e2e/<TEST_NAME>.
All E2E test functions should be named: Test_E2E<TEST_NAME>.
A E2E test consists of two parts:

  1. Vagrantfile: a vagrant file which describes and configures the VMs upon which the cluster and test will run
  2. <TEST_NAME>.go: A go test file which calls vagrant up and controls the actual testing of the cluster

See the validate cluster test as an example.

Running

Generally, E2E tests are run as a nightly Jenkins job for QA. They can still be run locally but additional setup may be required. By default, all E2E tests are designed with libvirt as the underlying VM provider. Instructions for installing libvirt and its associated vagrant plugin, vagrant-libvirt can be found here. VirtualBox is also supported as a backup VM provider.

Once setup is complete, all E2E tests can be run with:

go test -timeout=15m ./tests/e2e/... -run E2E

Tests can be run individually with:

go test -timeout=15m ./tests/e2e/validatecluster/... -run E2E
#or
go test -timeout=15m ./tests/e2e/... -run E2EClusterValidation

Additionally, to generate junit reporting for the tests, the Ginkgo CLI is used. Installation instructions can be found here.

To run the all E2E tests and generate JUnit testing reports:

ginkgo --junit-report=result.xml ./tests/e2e/...

Note: The go test default timeout is 10 minutes, thus the -timeout flag should be used. The ginkgo default timeout is 1 hour, no timeout flag is needed.