diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..937d848 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +--- !Policy +product_versions: + - rhel-10 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} + - !PassingTestCaseRule {test_case_name: rhsmci.brew-build.tier1.functional} diff --git a/tests/smoke/smoke.sh b/tests/smoke/smoke.sh new file mode 100755 index 0000000..5951da1 --- /dev/null +++ b/tests/smoke/smoke.sh @@ -0,0 +1,61 @@ +#!/bin/bash + + +while getopts ":c" opt; do + case $opt in + c) IN_CONTAINER=true;; + *) IN_CONTAINER=false;; + esac +done + +# takes in a command and makes sure that it returns success +# and that nothing is sent to stderr +function smoke { + echo -n "Smoke test: '$@': " + ERROR=$("$@" 2>&1> /dev/null) + RETVAL=$? + + if [ -z "$ERROR" ] && [[ $RETVAL == 0 ]]; then + echo "PASS" + else + echo "FAIL" + echo "RETVAL: $RETVAL" + echo "STDERR: $ERROR" + exit 1 + fi +} + +function smoke_container { + echo -n "Smoke Container test: '$@': " + ERROR=$("$@" 2>&1> /dev/null) + RETVAL=$? + + if [[ ! -z "$ERROR" ]] && [[ $RETVAL == 78 ]]; then + echo "PASS" + else + echo "FAIL" + echo "RETVAL: $RETVAL" + echo "STDERR: $ERROR" + exit 1 + fi +} + +SMOKE_CMDS="subscription-manager --help +subscription-manager config +subscription-manager facts +subscription-manager repos +subscription-manager version" + +if [[ "$IN_CONTAINER" == "true" ]]; then + TEST_CMD="smoke_container" + SMOKE_CMDS="subscription-manager config +subscription-manager facts +subscription-manager repos +subscription-manager version" +else + TEST_CMD="smoke" +fi + +while read -r CMD; do + $TEST_CMD $CMD +done <<<"$SMOKE_CMDS" diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..0160fec --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,21 @@ +--- +- hosts: localhost + tags: + - classic + - atomic + roles: + - role: standard-test-basic + tests: + - smoke: + dir: smoke + run: ./smoke.sh + +- hosts: localhost + tags: + - container + roles: + - role: standard-test-basic + tests: + - smoke: + dir: smoke + run: ./smoke.sh -c