Skip to content

Commit

Permalink
test/api: add some greenprints
Browse files Browse the repository at this point in the history
  • Loading branch information
achilleas-k committed Nov 15, 2023
1 parent b1b6cb9 commit 70bb02c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/cases/api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ case $CLOUD_PROVIDER in
esac

# Verify that this script is running in the right environment.
greenprint "Verifying environment"
checkEnv
# Check that needed variables are set to register to RHSM (RHEL only)
[[ "$ID" == "rhel" ]] && printenv API_TEST_SUBSCRIPTION_ORG_ID API_TEST_SUBSCRIPTION_ACTIVATION_KEY_V2 > /dev/null
Expand All @@ -200,6 +201,7 @@ function dump_db() {
WORKDIR=$(mktemp -d)
KILL_PIDS=()
function cleanups() {
greenprint "Cleaning up"
set +eu

cleanup
Expand All @@ -220,6 +222,7 @@ function cleanups() {
trap cleanups EXIT

# make a dummy rpm and repo to test payload_repositories
greenprint "Setting up dummy rpm and repo"
sudo dnf install -y rpm-build createrepo
DUMMYRPMDIR=$(mktemp -d)
DUMMYSPECFILE="$DUMMYRPMDIR/dummy.spec"
Expand Down Expand Up @@ -259,6 +262,7 @@ popd
#
# Install the necessary cloud provider client tools
#
greenprint "Installing cloud provider client tools"
installClient

#
Expand Down Expand Up @@ -437,6 +441,7 @@ export FIREWALL_CUSTOMIZATION_BLOCK
# generate a temp key for user tests
ssh-keygen -t rsa-sha2-512 -f "${WORKDIR}/usertest" -C "usertest" -N ""

greenprint "Creating request file"
createReqFile

#
Expand Down Expand Up @@ -581,10 +586,12 @@ function waitForImgState() {
REQUEST_FILE2="${WORKDIR}/request2.json"
jq '.customizations.packages = [ "jesuisunpaquetquinexistepas" ]' "$REQUEST_FILE" > "$REQUEST_FILE2"

greenprint "Sending compose: Fail test"
sendCompose "$REQUEST_FILE2"
waitForState "failure"

# crashed/stopped/killed worker should result in the job being retried
greenprint "Sending compose: Retry test"
sendCompose "$REQUEST_FILE"
waitForState "building"
sudo systemctl stop "osbuild-remote-worker@*"
Expand All @@ -610,6 +617,7 @@ sudo "${CONTAINER_RUNTIME}" exec "${DB_CONTAINER_NAME}" psql -U postgres -d osbu
sudo systemctl start "osbuild-remote-worker@localhost:8700.service"

# full integration case
greenprint "Sending compose: Full test"
INIT_COMPOSES="$(collectMetrics)"
sendCompose "$REQUEST_FILE"
waitForState
Expand Down Expand Up @@ -646,11 +654,13 @@ fi
#
# Verify the Cloud-provider specific upload_status options
#
greenprint "Checking upload status options"
checkUploadStatusOptions

#
# Verify the image landed in the appropriate cloud provider, and delete it.
#
greenprint "Verifying image upload"
verify

# Verify selected package (postgresql) is included in package list
Expand All @@ -671,11 +681,13 @@ function verifyPackageList() {
fi
}

greenprint "Verifying package list"
verifyPackageList

#
# Verify oauth2
#
greenprint "Verifying oauth2"
cat <<EOF | sudo tee "/etc/osbuild-composer/osbuild-composer.toml"
[koji]
enable_tls = false
Expand Down Expand Up @@ -763,4 +775,5 @@ TOKEN="$(curl --request POST \
sudo systemctl restart osbuild-remote-worker@localhost:8700.service
sudo systemctl is-active --quiet osbuild-remote-worker@localhost:8700.service

greenprint "DONE"
exit 0

0 comments on commit 70bb02c

Please sign in to comment.