Skip to content

Files

Latest commit

db3a2e3 · Feb 11, 2024

History

History
This branch is 4223 commits behind kubevirt/kubevirt:main.

tests

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Mar 20, 2022
Jan 16, 2023
Feb 7, 2024
Mar 28, 2023
Oct 24, 2023
Dec 8, 2023
Nov 29, 2023
Aug 4, 2022
Jun 28, 2023
Feb 5, 2024
Feb 8, 2023
Jan 16, 2024
Jan 18, 2024
Feb 9, 2024
Feb 5, 2024
Jan 22, 2024
Jan 25, 2024
Sep 15, 2023
Feb 14, 2023
Nov 6, 2023
Jan 29, 2024
Feb 8, 2024
Nov 29, 2023
Feb 8, 2024
Jan 1, 2023
Dec 20, 2022
Feb 6, 2024
Feb 7, 2024
Jan 30, 2024
Feb 11, 2024
Feb 1, 2024
Feb 9, 2024
Nov 29, 2023
Feb 1, 2024
Jan 19, 2024
Jan 19, 2024
Nov 26, 2023
Jul 5, 2023
Feb 11, 2024
Nov 13, 2023
Feb 6, 2024
Dec 1, 2023
Jul 7, 2022
Jan 1, 2024
Jan 11, 2024
Feb 22, 2023
Feb 7, 2024
Dec 17, 2018
Jun 6, 2023
Nov 15, 2022
Feb 1, 2024
May 9, 2023
Jan 30, 2024
Jan 3, 2024
Jan 18, 2022
Feb 8, 2024
Apr 3, 2022
Jan 18, 2022
Jan 31, 2024
Dec 17, 2018
Jan 29, 2024
Jan 1, 2024
Jun 12, 2023
Jan 29, 2024
Dec 26, 2023
Jan 30, 2024
Dec 26, 2023
Jan 30, 2024
Sep 6, 2023
Jan 30, 2024
Jan 29, 2024
Jan 11, 2023
Jun 22, 2022
Jan 1, 2024
Jan 29, 2024
Jan 26, 2024
Mar 28, 2023
Jan 29, 2024
Jan 11, 2023
Feb 9, 2024
Jan 11, 2023
Jan 26, 2024
Feb 11, 2024
Feb 3, 2024
Oct 3, 2023
Feb 3, 2024
Feb 9, 2024
Jan 11, 2023
Feb 8, 2024
Jan 29, 2024
Sep 6, 2023
Jan 4, 2023
Jan 11, 2023
Jan 30, 2024
Jan 31, 2024
Jul 20, 2023
Sep 6, 2023
Dec 20, 2022
Jan 11, 2023
Jan 29, 2024
Jan 29, 2024
Jan 30, 2024
Jan 11, 2023
Jan 26, 2024

Integration tests

Writing e2e tests

We aim to run e2e tests in parallel by default. As such the following rules should be followed:

  • Use cirros and alpine VMs for testing wherever possible. If you have to use another OS, discuss on the PR why it is needed.
  • Stay within the boundary of the Testnamespaces which we prove. If you have to create resources outside the test namespaces, discuss potential solutions on such a PR.
  • If you really have to run tests serial (destructive tests, infra-tests, ...), mark the test with a [Serial] tag and add the Serial decorator to the test.
  • If tests are not using the default cleanup code, additional custom preparations may be necessary.

The following types of tests need to be marked as [Serial] right now:

  • Tests which use PVCs or DataVolumes (parallelizing these is on the way).
  • Tests which use BeforeAll.

Additional suggestions:

  • The [Disruptive] tag is recognized by the test suite but is not yet mandatory. Feel free to set it on destructive tests.
  • Conformance tests need to be marked with a [Conformance] tag.
  • We try to mark tests that require advanced/special storage capabilities with [storage-req],
    So they are easy to skip when lanes with new storage solutions are introduced.
    At the point of writing this we use rook-ceph-block which certainly qualifies for running them.

Test Namespaces

If tests are executed in parallel, every test gets its unique set of namespaces to test in. If you write a test and reference the namespaces test.NamespaceTestDefault, test.NamespaceTestAlternative or tests.NamespaceTestOperator, you get different values, based on the ginkgo execution node.

For as long as test resources are created by referencing these namespaces, there is no test conflict to expect.

Running integration tests

Integration tests require a running Kubevirt cluster. Once you have a running Kubevirt cluster, you can use the -master and the -kubeconfig flags to point the tests to the cluster.

Running networking tests for outside connectivity

When running the tests with no internet connection, some networking tests ,that test outside connectivity, might fail, and you might want to skip them. For that some additional flags are needed to be passed. In addition, if you'd like to test outside connectivity using different addresses than the default (8.8.8.8, 2001:db8:1::1 and google.com), you can achive that with the designated flags as well.

For each method detailed below, there is note about the needed flags to the outside connectivity tests and how to pass them.

Run them on an arbitrary KubeVirt installation

cd tests # from the git repo root folder
go test -kubeconfig=path/to/my/config -config=default-config.json

outside connectivity tests: The tests will run by default. To skip the outside connectivity tests add -ginkgo.skip='\[outside_connectivity\]' To your go command. To change the IPV4, IPV6 or DNS used for outside connectivity tests, add conn-check-ipv4-address, conn-check-ipv6-address or conn-check-dns to your go command, with the desired value. For example:

go test -kubeconfig=$KUBECONFIG -config=default-config.json \
-conn-check-ipv4-address=8.8.4.4 -conn-check-ipv6-address=2620:119:35::35 \
-conn-check-dns=amazon.com \

Run them on one of the core KubeVirt providers

There is a make target to run this with the config taken from hack/config.sh:

# from the git repo root folder
make functest

outside connectivity tests: The tests will run by default. To skip the tests export KUBEVIRT_E2E_SKIP='\[outside_connectivity\]' environment variable before running the tests. To change the IPV4, IPV6 or DNS used for outside connectivity tests, you can export CONN_CHECK_IPV4_ADDRESS, CONN_CHECK_IPV6_ADDRESS and
CONN_CHECK_DNS with the desired values. For example:

export CONN_CHECK_IPV4_ADDRESS=8.8.4.4
export CONN_CHECK_IPV6_ADDRESS=2620:119:35::35
export CONN_CHECK_DNS=amazon.com

Run them anywhere inside of container

# Create directory for data / results / kubectl binary
mkdir -p /tmp/kubevirt-tests-data
# Make sure that eveybody can write there
setfacl -m d:o:rwx /tmp/kubevirt-tests-data
setfacl -m o:rwx /tmp/kubevirt-tests-data

docker run \
    -v /tmp/kubevirt-tests-data:/home/kubevirt-tests/data:rw,z --rm \
    kubevirt/tests:latest \
        --kubeconfig=data/openshift-master.kubeconfig \
        --container-tag=latest \
        --container-prefix=quay.io/kubevirt \
        --test.timeout 180m \
        --junit-output=data/results/junit.xml \
        --deploy-testing-infra \
        --path-to-testing-infra-manifests=data/manifests