Run integration tests at an external k8s cluster
Some times is needed to run nmstate integration tests or debug-shell inside an external cluster like openshift, this change make it possible by setting env vars `KUBEVIRT_PROVIDER=external` and `KUBECONFIG=...` Signed-off-by: Quique Llorente <ellorent@redhat.com>
This commit is contained in:
parent
84791c96f4
commit
60d9c95b0f
@ -140,3 +140,16 @@ cd tests/integration
|
||||
# Set TEST_IB_CONNECTED_MODE=1 when cards are configured as connected mode
|
||||
sudo env TEST_REAL_NIC=mlx5_ib0 pytest-3 -vv ./infiniband_test.py
|
||||
```
|
||||
|
||||
### Run tests at a Kubernetes cluster
|
||||
|
||||
By default if `automation/run-tests.sh` is call with `--k8s` option it will
|
||||
startup an internal k8s cluster running in top of qemu with one node, it
|
||||
will install a pod that wraps the nmstate-dev image selected and will run the
|
||||
selected tests inside of the pod.
|
||||
|
||||
The pod mounts the NetworkManager and ovs sockets from nodes so nmstate tests
|
||||
are running over node network configuration.
|
||||
|
||||
For external clusters the env vars KUBEVIRT_PROVIDER=external and KUBECONFIG
|
||||
need to be set, the rest works the same.
|
||||
|
@ -118,12 +118,16 @@ function k8s::pre_test_setup {
|
||||
|
||||
}
|
||||
function k8s::start_cluster {
|
||||
KUBEVIRT_NUM_SECONDARY_NICS=2
|
||||
k8s/up.sh
|
||||
if [ "${KUBEVIRT_PROVIDER}" != "external" ]; then
|
||||
KUBEVIRT_NUM_SECONDARY_NICS=2
|
||||
k8s/up.sh
|
||||
fi
|
||||
}
|
||||
|
||||
function k8s::stop_cluster {
|
||||
k8s/down.sh
|
||||
if [ "${KUBEVIRT_PROVIDER}" != "external" ]; then
|
||||
k8s/down.sh
|
||||
fi
|
||||
}
|
||||
|
||||
function k8s::cleanup {
|
||||
@ -133,12 +137,15 @@ function k8s::cleanup {
|
||||
function k8s::collect_artifacts {
|
||||
rm -rf ${EXPORT_DIR}
|
||||
mkdir -p ${EXPORT_DIR}
|
||||
k8s::cli ssh node01 -- sudo journalctl > ${EXPORT_DIR}/journalctl.log
|
||||
k8s::cli ssh node01 -- sudo dmesg > ${EXPORT_DIR}/dmesg.log
|
||||
k8s::cli ssh node01 -- sudo cat /var/log/openvswitch/ovsdb-server.log > ${EXPORT_DIR}/ovsdb-server.log
|
||||
# TODO: Parameterize how to do SSH to external providers
|
||||
if [ "${KUBEVIRT_PROVIDER}" != "external" ]; then
|
||||
k8s::cli ssh node01 -- sudo journalctl > ${EXPORT_DIR}/journalctl.log
|
||||
k8s::cli ssh node01 -- sudo dmesg > ${EXPORT_DIR}/dmesg.log
|
||||
k8s::cli ssh node01 -- sudo cat /var/log/openvswitch/ovsdb-server.log > ${EXPORT_DIR}/ovsdb-server.log
|
||||
fi
|
||||
${KUBECTL_CMD} cp -n nmstate conformance:${CONTAINER_WORKSPACE}/pytest-run.log $EXPORT_DIR/pytest-run.log
|
||||
# To use wildcard we have to use exec
|
||||
./k8s/kubectl.sh exec -i -n nmstate conformance -- bash -c "cd ${CONTAINER_WORKSPACE} && tar cf - *.xml" | tar xf - -C $EXPORT_DIR
|
||||
${KUBECTL_CMD} exec -i -n nmstate conformance -- bash -c "cd ${CONTAINER_WORKSPACE} && tar cf - *.xml" | tar xf - -C $EXPORT_DIR
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user