#!/bin/bash # Tests the multi-tenancy feature of cloud and remote worker API. # # Note that the power of this is very limited. It cannot check that a certain # tenant can only access jobs on its channel. It has its value though that # it checks the whole E2E setup including parsing of the JWT token which is # not tested in the unit test. set -euo pipefail OSBUILD_COMPOSER_TEST_DATA=/usr/share/tests/osbuild-composer/ # Get OS data. source /usr/libexec/osbuild-composer-test/set-env-variables.sh # Provision the software under test. /usr/libexec/osbuild-composer-test/provision.sh jwt # Source common functions source /usr/libexec/tests/osbuild-composer/api/common/common.sh source /usr/libexec/tests/osbuild-composer/shared_lib.sh greenprint "Registering clean ups" KILL_PIDS=() function cleanup() { greenprint "== Script execution stopped or finished - Cleaning up ==" set +eu greenprint "Stopping containers" sudo /usr/libexec/osbuild-composer-test/run-koji-container.sh stop greenprint "Removing generated CA cert" sudo rm \ /etc/pki/ca-trust/source/anchors/osbuild-composer-tests-ca-crt.pem sudo update-ca-trust for P in "${KILL_PIDS[@]}"; do sudo pkill -P "$P" done /usr/libexec/osbuild-composer-test/run-mock-auth-servers.sh stop set -eu } trap cleanup EXIT greenprint "Adding the testsuite's CA cert to the system trust store" # the worker cannot handle koji with self-signed certs sudo cp \ /etc/osbuild-composer/ca-crt.pem \ /etc/pki/ca-trust/source/anchors/osbuild-composer-tests-ca-crt.pem sudo update-ca-trust greenprint "Starting containers" sudo /usr/libexec/osbuild-composer-test/run-koji-container.sh start greenprint "Adding kerberos config" sudo cp \ /tmp/osbuild-composer-koji-test/client.keytab \ /etc/osbuild-worker/client.keytab sudo cp \ "${OSBUILD_COMPOSER_TEST_DATA}"/kerberos/krb5-local.conf \ /etc/krb5.conf.d/local DISTRO=rhel-8.7 function s3_request { cat </dev/null <