From 6cf256731800906daede28c051c57a094f9b3937 Mon Sep 17 00:00:00 2001 From: Prarit Bhargava Date: Wed, 15 Jun 2022 11:38:57 -0400 Subject: [PATCH] tests: Update tests Add tests. Resolves: bz2094575 Signed-off-by: Prarit Bhargava --- tests/.gitignore | 3 +++ tests/run_tests.sh | 12 ++++++++++++ tests/tests.yml | 9 +++++++++ tests/version.sh | 15 +++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 tests/.gitignore create mode 100755 tests/run_tests.sh create mode 100644 tests/tests.yml create mode 100755 tests/version.sh diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..2d14f87 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,3 @@ +artifacts/ +*.patch +*.diff diff --git a/tests/run_tests.sh b/tests/run_tests.sh new file mode 100755 index 0000000..3d858f7 --- /dev/null +++ b/tests/run_tests.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# fail the whole test set if any of the command pipelines fail +set -ex + +# when running this in 1minutetip the PATH must be specified to execute +# in the local directory. +echo "Setting path to local directory" +PATH=$PATH:$(pwd) + +# simple version test +version.sh diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..b83c0a1 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,9 @@ +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + tests: + - simple: + dir: . # switch to subfolder. This parameter is REQUIRED, use `dir: .` for current folder + run: ./run_tests.sh # this is your test command, its exit code is the outcome of the test diff --git a/tests/version.sh b/tests/version.sh new file mode 100755 index 0000000..bfa84ac --- /dev/null +++ b/tests/version.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# +# This is a simple version test to satisfy the RHEL8.1 onboard gating +# requirement. + +# fail the whole test if any of the command pipelines below fails +set -ex + +version=$(mcelog --version 2>&1 | awk ' { print $2 } ') +if [ "$version" == "unknown" ]; then + echo "mcelog version is unknown." + exit 1 +fi + +# if we get here, it's OK