From 0f20c8f5cfae17f46e09c31216522fda0b3e661e Mon Sep 17 00:00:00 2001 From: Jakub Rusz Date: Mon, 21 Oct 2019 10:37:41 +0200 Subject: [PATCH] tests: Add new test to run 'test' and 'check' in cockpit ci (cherry picked from commit ac01d52fa6c27de274394dfaa144990f05d9b8df) Related: rhbz#1785154 --- test/check-cli | 12 ++++++++++++ test/run | 2 ++ tests/cli/test_ci.sh | 23 +++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100755 tests/cli/test_ci.sh diff --git a/test/check-cli b/test/check-cli index 05610961..196927c8 100755 --- a/test/check-cli +++ b/test/check-cli @@ -103,6 +103,18 @@ class TestTar(composertest.ComposerTestCase): # Run the test, on the booted image self.runImageTest("/tests/cli/test_boot_tar_kickstart.sh") +class TestPylint(composertest.ComposerTestCase): + def test_ci(self): + + # Create an empty folder for the upload bellow + self.execute(["mkdir", "/lorax"]) + + # Upload contents of repo for running the test + self.machine.upload(["../tests", "../src", "../share", "../docs", "../Makefile", + "../test-packages"], "/lorax") + + # Running the test + self.runImageTest("/tests/cli/test_ci.sh") if __name__ == '__main__': composertest.main() diff --git a/test/run b/test/run index d5fd9003..f6f17e56 100755 --- a/test/run +++ b/test/run @@ -11,6 +11,8 @@ if [ -n "$TEST_SCENARIO" ]; then test/check-cli TestQcow2 elif [ "$TEST_SCENARIO" == "tar" ]; then test/check-cli TestTar + elif [ "$TEST_SCENARIO" == "ci" ]; then + test/check-cli TestPylint else test/check-cloud TestCloud.test_$TEST_SCENARIO fi diff --git a/tests/cli/test_ci.sh b/tests/cli/test_ci.sh new file mode 100755 index 00000000..8cdad64b --- /dev/null +++ b/tests/cli/test_ci.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Note: execute this file from the project root directory + +set -e + +. /usr/share/beakerlib/beakerlib.sh + +yum-config-manager --enable epel + +dnf -y install $(cat /lorax/test-packages) + +pip3 install pocketlint + +cd /lorax + +rlJournalStart + rlPhaseStartTest "check" + # running with -k because of possible errors that would make "make test" to not run + rlRun "make ci -k" + rlPhaseEnd + +rlJournalEnd +rlJournalPrintText