From b711d77eb7b23456e31543193caf7c82eaaf3932 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Wed, 14 Aug 2024 12:22:51 +0200 Subject: [PATCH] add gating test --- gating.yaml | 6 ++++++ tests/run_tests.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++ tests/tests.yml | 9 +++++++++ 3 files changed, 65 insertions(+) create mode 100644 gating.yaml create mode 100755 tests/run_tests.sh create mode 100644 tests/tests.yml diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..4ca9235 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-10 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/tests/run_tests.sh b/tests/run_tests.sh new file mode 100755 index 0000000..856aabb --- /dev/null +++ b/tests/run_tests.sh @@ -0,0 +1,50 @@ +#!/bin/sh + + +function ntimes +{ + I=0 + for((I=0;I<50;I++)) + do + "$@" + done +} + +function fail +{ + echo "FAIL: $1" >&2 + exit 1 +} + +# check output is always different +if [ -n "$(uuid -n 50 | uniq --repeated)" ] +then + fail "dulicated output" +fi + +# check it can parse uuid it generated +if ! uuid -d $(uuid -v1) >/dev/null 2>&1 +then + fail "can't decore uuid" +fi + +# check v3 uses same output for same seed +if ! [ "$({ uuid -n 5 -v3 ns:URL https://fedoraproject.org/; uuid -n 5 -v3 ns:URL https://fedoraproject.org/ ; } | wc -l)" = 10 ] +then + fail "v3 should have same output for same seed" +fi + +# check v5 uses same output for same seed +if ! [ "$({ uuid -n 5 -v3 ns:URL https://fedoraproject.org/; uuid -n 5 -v3 ns:URL https://fedoraproject.org/ ; } | wc -l)" = 10 ] +then + fail "v5 should have same output for same seed" +fi + +# check v3 and v5 use different hashes (output) +if ! [ "$({ uuid -n 5 -v3 ns:URL https://fedoraproject.org/; uuid -n 5 -v5 ns:URL https://fedoraproject.org/ ; } | uniq | wc -l)" = 2 ] +then + fail "v3 and v5 uuid shouldn't be the same" +fi + +echo "SUCCESS" +exit 0 diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..be50ecb --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,9 @@ +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + tests: + - simple: + dir: . + run: run_tests.sh