diff --git a/.github/workflows/runtime-tests.yml b/.github/workflows/runtime-tests.yml index 6c094348..eb80de7b 100644 --- a/.github/workflows/runtime-tests.yml +++ b/.github/workflows/runtime-tests.yml @@ -46,25 +46,3 @@ jobs: run: pip install jsonschema - name: "Run Assembler Tests" run: sudo env "PATH=$PATH" python3 -m unittest -v test.test_assemblers - - stage_tests: - name: "Stage Tests" - runs-on: ubuntu-latest - steps: - - name: "Clone Repository" - uses: actions/checkout@v2 - - name: "Install Dependencies" - run: | - sudo apt-get update - sudo apt-get -y install \ - systemd-container \ - tar \ - yum - - name: "Set up Python" - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - name: Install Python Packages - run: pip install jsonschema - - name: "Run Stage Tests" - run: sudo env "PATH=$PATH" python3 -m unittest -v test.test_stages diff --git a/test/stages_tests/chrony/a.json b/test/data/stages/chrony/a.json similarity index 100% rename from test/stages_tests/chrony/a.json rename to test/data/stages/chrony/a.json diff --git a/test/stages_tests/chrony/b.json b/test/data/stages/chrony/b.json similarity index 100% rename from test/stages_tests/chrony/b.json rename to test/data/stages/chrony/b.json diff --git a/test/stages_tests/chrony/diff.json b/test/data/stages/chrony/diff.json similarity index 100% rename from test/stages_tests/chrony/diff.json rename to test/data/stages/chrony/diff.json diff --git a/test/stages_tests/copy/a.json b/test/data/stages/copy/a.json similarity index 100% rename from test/stages_tests/copy/a.json rename to test/data/stages/copy/a.json diff --git a/test/stages_tests/copy/b.json b/test/data/stages/copy/b.json similarity index 100% rename from test/stages_tests/copy/b.json rename to test/data/stages/copy/b.json diff --git a/test/stages_tests/copy/diff.json b/test/data/stages/copy/diff.json similarity index 100% rename from test/stages_tests/copy/diff.json rename to test/data/stages/copy/diff.json diff --git a/test/stages_tests/firewall/a.json b/test/data/stages/firewall/a.json similarity index 100% rename from test/stages_tests/firewall/a.json rename to test/data/stages/firewall/a.json diff --git a/test/stages_tests/firewall/b.json b/test/data/stages/firewall/b.json similarity index 100% rename from test/stages_tests/firewall/b.json rename to test/data/stages/firewall/b.json diff --git a/test/stages_tests/firewall/diff.json b/test/data/stages/firewall/diff.json similarity index 100% rename from test/stages_tests/firewall/diff.json rename to test/data/stages/firewall/diff.json diff --git a/test/stages_tests/first-boot/a.json b/test/data/stages/first-boot/a.json similarity index 100% rename from test/stages_tests/first-boot/a.json rename to test/data/stages/first-boot/a.json diff --git a/test/stages_tests/first-boot/b.json b/test/data/stages/first-boot/b.json similarity index 100% rename from test/stages_tests/first-boot/b.json rename to test/data/stages/first-boot/b.json diff --git a/test/stages_tests/first-boot/diff.json b/test/data/stages/first-boot/diff.json similarity index 100% rename from test/stages_tests/first-boot/diff.json rename to test/data/stages/first-boot/diff.json diff --git a/test/stages_tests/fstab/a.json b/test/data/stages/fstab/a.json similarity index 100% rename from test/stages_tests/fstab/a.json rename to test/data/stages/fstab/a.json diff --git a/test/stages_tests/fstab/b.json b/test/data/stages/fstab/b.json similarity index 100% rename from test/stages_tests/fstab/b.json rename to test/data/stages/fstab/b.json diff --git a/test/stages_tests/fstab/diff.json b/test/data/stages/fstab/diff.json similarity index 100% rename from test/stages_tests/fstab/diff.json rename to test/data/stages/fstab/diff.json diff --git a/test/stages_tests/groups/a.json b/test/data/stages/groups/a.json similarity index 100% rename from test/stages_tests/groups/a.json rename to test/data/stages/groups/a.json diff --git a/test/stages_tests/groups/b.json b/test/data/stages/groups/b.json similarity index 100% rename from test/stages_tests/groups/b.json rename to test/data/stages/groups/b.json diff --git a/test/stages_tests/groups/diff.json b/test/data/stages/groups/diff.json similarity index 100% rename from test/stages_tests/groups/diff.json rename to test/data/stages/groups/diff.json diff --git a/test/stages_tests/hostname/a.json b/test/data/stages/hostname/a.json similarity index 100% rename from test/stages_tests/hostname/a.json rename to test/data/stages/hostname/a.json diff --git a/test/stages_tests/hostname/b.json b/test/data/stages/hostname/b.json similarity index 100% rename from test/stages_tests/hostname/b.json rename to test/data/stages/hostname/b.json diff --git a/test/stages_tests/hostname/diff.json b/test/data/stages/hostname/diff.json similarity index 100% rename from test/stages_tests/hostname/diff.json rename to test/data/stages/hostname/diff.json diff --git a/test/stages_tests/kernel-cmdline/a.json b/test/data/stages/kernel-cmdline/a.json similarity index 100% rename from test/stages_tests/kernel-cmdline/a.json rename to test/data/stages/kernel-cmdline/a.json diff --git a/test/stages_tests/kernel-cmdline/b.json b/test/data/stages/kernel-cmdline/b.json similarity index 100% rename from test/stages_tests/kernel-cmdline/b.json rename to test/data/stages/kernel-cmdline/b.json diff --git a/test/stages_tests/kernel-cmdline/diff.json b/test/data/stages/kernel-cmdline/diff.json similarity index 100% rename from test/stages_tests/kernel-cmdline/diff.json rename to test/data/stages/kernel-cmdline/diff.json diff --git a/test/stages_tests/keymap/a.json b/test/data/stages/keymap/a.json similarity index 100% rename from test/stages_tests/keymap/a.json rename to test/data/stages/keymap/a.json diff --git a/test/stages_tests/keymap/b.json b/test/data/stages/keymap/b.json similarity index 100% rename from test/stages_tests/keymap/b.json rename to test/data/stages/keymap/b.json diff --git a/test/stages_tests/keymap/diff.json b/test/data/stages/keymap/diff.json similarity index 100% rename from test/stages_tests/keymap/diff.json rename to test/data/stages/keymap/diff.json diff --git a/test/stages_tests/locale/a.json b/test/data/stages/locale/a.json similarity index 100% rename from test/stages_tests/locale/a.json rename to test/data/stages/locale/a.json diff --git a/test/stages_tests/locale/b.json b/test/data/stages/locale/b.json similarity index 100% rename from test/stages_tests/locale/b.json rename to test/data/stages/locale/b.json diff --git a/test/stages_tests/locale/diff.json b/test/data/stages/locale/diff.json similarity index 100% rename from test/stages_tests/locale/diff.json rename to test/data/stages/locale/diff.json diff --git a/test/stages_tests/rpm/a.json b/test/data/stages/rpm/a.json similarity index 100% rename from test/stages_tests/rpm/a.json rename to test/data/stages/rpm/a.json diff --git a/test/stages_tests/rpm/b.json b/test/data/stages/rpm/b.json similarity index 100% rename from test/stages_tests/rpm/b.json rename to test/data/stages/rpm/b.json diff --git a/test/stages_tests/rpm/diff.json b/test/data/stages/rpm/diff.json similarity index 100% rename from test/stages_tests/rpm/diff.json rename to test/data/stages/rpm/diff.json diff --git a/test/stages_tests/systemd/a.json b/test/data/stages/systemd/a.json similarity index 100% rename from test/stages_tests/systemd/a.json rename to test/data/stages/systemd/a.json diff --git a/test/stages_tests/systemd/b.json b/test/data/stages/systemd/b.json similarity index 100% rename from test/stages_tests/systemd/b.json rename to test/data/stages/systemd/b.json diff --git a/test/stages_tests/systemd/diff.json b/test/data/stages/systemd/diff.json similarity index 100% rename from test/stages_tests/systemd/diff.json rename to test/data/stages/systemd/diff.json diff --git a/test/stages_tests/timezone/a.json b/test/data/stages/timezone/a.json similarity index 100% rename from test/stages_tests/timezone/a.json rename to test/data/stages/timezone/a.json diff --git a/test/stages_tests/timezone/b.json b/test/data/stages/timezone/b.json similarity index 100% rename from test/stages_tests/timezone/b.json rename to test/data/stages/timezone/b.json diff --git a/test/stages_tests/timezone/diff.json b/test/data/stages/timezone/diff.json similarity index 100% rename from test/stages_tests/timezone/diff.json rename to test/data/stages/timezone/diff.json diff --git a/test/stages_tests/users/a.json b/test/data/stages/users/a.json similarity index 100% rename from test/stages_tests/users/a.json rename to test/data/stages/users/a.json diff --git a/test/stages_tests/users/b.json b/test/data/stages/users/b.json similarity index 100% rename from test/stages_tests/users/b.json rename to test/data/stages/users/b.json diff --git a/test/stages_tests/users/diff.json b/test/data/stages/users/diff.json similarity index 100% rename from test/stages_tests/users/diff.json rename to test/data/stages/users/diff.json diff --git a/test/stages_tests/zipl/a.json b/test/data/stages/zipl/a.json similarity index 100% rename from test/stages_tests/zipl/a.json rename to test/data/stages/zipl/a.json diff --git a/test/stages_tests/zipl/b.json b/test/data/stages/zipl/b.json similarity index 100% rename from test/stages_tests/zipl/b.json rename to test/data/stages/zipl/b.json diff --git a/test/stages_tests/zipl/diff.json b/test/data/stages/zipl/diff.json similarity index 100% rename from test/stages_tests/zipl/diff.json rename to test/data/stages/zipl/diff.json diff --git a/test/test_stages.py b/test/run/test_stages.py similarity index 89% rename from test/test_stages.py rename to test/run/test_stages.py index cc91d03c..30020740 100644 --- a/test/test_stages.py +++ b/test/run/test_stages.py @@ -1,3 +1,7 @@ +# +# Runtime tests for the individual stages. +# + import difflib import json import os @@ -5,10 +9,12 @@ import pprint import tempfile import unittest -from . import test +from .. import test -class TestDescriptions(test.TestBase): +@unittest.skipUnless(test.TestBase.have_test_data(), "no test-data access") +@unittest.skipUnless(test.TestBase.have_tree_diff(), "tree-diff missing") +class TestStages(test.TestBase): def assertTreeDiffsEqual(self, tree_diff1, tree_diff2): """ @@ -113,19 +119,8 @@ class TestDescriptions(test.TestBase): self.assertTreeDiffsEqual(expected_diff, actual_diff) - -def generate_test_case(path): - @unittest.skipUnless(test.TestBase.have_tree_diff(), "tree-diff missing") - def test_case(self): - self.run_stage_test(path) - - return test_case - - -def init_tests(): - test_dir = 'test/stages_tests' - for name in os.listdir(test_dir): - setattr(TestDescriptions, f"test_{name}", generate_test_case(f"{test_dir}/{name}")) - - -init_tests() + def test_stages(self): + path = os.path.join(self.locate_test_data(), "stages") + for name in os.listdir(path): + with self.subTest(stage=name): + self.run_stage_test(os.path.join(path, name))