Skip to content

Commit

Permalink
tests/e2e: Add peer pods tests
Browse files Browse the repository at this point in the history
Add the ability to pass through ccruntime overlay config
in the e2e test scripts and add matrix to test peer-pods in
the cc runtime e2e tests.

Fixes: confidential-containers#336

Signed-off-by: stevenhorsman <[email protected]>
  • Loading branch information
stevenhorsman committed Feb 19, 2024
1 parent 31a4efa commit 601fe89
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ccruntime_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
- "az-ubuntu-2004"
- "az-ubuntu-2204"
- "s390x"
ccruntime_overlay:
- ''
- "peer-pods"
exclude:
- runtimeclass: "kata-clh"
instance: "s390x"
Expand Down Expand Up @@ -62,7 +65,7 @@ jobs:
if [ $RUNNING_INSTANCE = "s390x" ]; then
args=""
fi
./run-local.sh -t -r "${{ matrix.runtimeclass }}" "${args}"
./run-local.sh -t -r "${{ matrix.runtimeclass }}" -o "${{ matrix.ccruntime_overlay }}" "${args}"
env:
RUNNING_INSTANCE: ${{ matrix.instance }}

Expand Down
27 changes: 19 additions & 8 deletions tests/e2e/operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ install_ccruntime() {
local overlay_dir="${ccruntime_overlay_basedir}/${ccruntime_overlay}"

# Use the built pre-install image
kustomization_set_image "${ccruntime_overlay_basedir}/default" \
kustomization_set_image "${ccruntime_overlay_basedir}/${ccruntime_overlay}" \
"quay.io/confidential-containers/reqs-payload" \
"${PRE_INSTALL_IMG}"

Expand Down Expand Up @@ -294,8 +294,12 @@ usage() {
cat <<-EOF
Utility to build/install/uninstall the operator.
Use: $0 [-h|--help] [command], where:
Use: $0 [-h|--help] [-o CCRUNTIMEOVERLAY] [command], where:
-h | --help : show this usage
-o CCRUNTIMEOVERLAY: optional command (defaults to 'default') to specify which overlay to use to. Can be:
"default": Install the standard overlay (for x86 and local hypervisor). The default value on x86 hardware.
"s390x": Install the s390x local hypervisor overlay. Defaults to this if running on s390x hardware.
"peer-pods": Install the remote hypervisor overlay.
command : optional command (build and install by default). Can be:
"build": build only,
"install": install only,
Expand All @@ -305,10 +309,6 @@ usage() {
}

main() {
ccruntime_overlay="default"
if [ "$(uname -m)" = "s390x" ]; then
ccruntime_overlay="s390x"
fi
if [ $# -eq 0 ]; then
build_operator
install_operator
Expand All @@ -317,7 +317,7 @@ main() {
wait_for_stabilization
else
case $1 in
-h|--help) usage && exit 0;;
--help) usage && exit 0;;
build)
build_operator
build_pre_install_img
Expand All @@ -340,4 +340,15 @@ main() {
fi
}

main "$@"
ccruntime_overlay="default"
if [ "$(uname -m)" = "s390x" ]; then
ccruntime_overlay="s390x"
fi

while getopts "o:" flag; do
case "$flag" in
o) ccruntime_overlay=${OPTARG:-ccruntime_overlay};;
h) usage && exit 0;;
esac
done
main="${@:$OPTIND}"
15 changes: 12 additions & 3 deletions tests/e2e/run-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ step_bootstrap_env=0
step_start_cluster=0
step_install_operator=0
runtimeclass=""
ccruntimeclass=""
undo="false"
timeout="false"

Expand All @@ -24,8 +25,11 @@ usage() {
Important: it will change the system so ensure it is executed in a development
environment.
Use: $0 [-h|--help] [-r RUNTIMECLASS] [-u], where:
Use: $0 [-h|--help] [-o CCRUNTIMEOVERLAY] [-r RUNTIMECLASS] [-u], where:
-h | --help : show this usage
-o CCRUNTIMEOVERLAY: allows a user to specify the cc runtime overlay used
(default/s390x/peer-pods) to install local hypervisor
or remote hypervisor versison. Defaults to local hypervisor
-r RUNTIMECLASS: configure to use the RUNTIMECLASS (e.g. kata-clh) on
the tests. Defaults to "kata-qemu".
-u: undo the installation and configuration before exiting. Useful for
Expand All @@ -35,9 +39,10 @@ usage() {
}

parse_args() {
while getopts "hr:ut" opt; do
while getopts "ho:r:ut" opt; do
case $opt in
h) usage && exit 0;;
o) ccruntimeclass="$OPTARG";;
r) runtimeclass="$OPTARG";;
u) undo="true";;
t) timeout="true";;
Expand Down Expand Up @@ -111,7 +116,11 @@ main() {

echo "::info:: Build and install the operator"
step_install_operator=1
run 20m sudo -E PATH="$PATH" bash -c './operator.sh'
cmd="run 20m sudo -E PATH="${PATH}" bash -c './operator.sh'"
if [ -n "${ccruntimeclass}" ]; then
cmd+=" -c ${ccruntimeclass}"
fi
eval ${cmd}

echo "::info:: Run tests"
cmd="run 20m sudo -E PATH=\"$PATH\" bash -c "
Expand Down

0 comments on commit 601fe89

Please sign in to comment.