From 1b3368b13dc9f9363fc44738cd22bb069a41eca3 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Wed, 15 May 2024 19:41:10 +0100 Subject: [PATCH 1/4] There's no such thing as `pytest.skipTest` --- tests/pytests/functional/modules/test_pkg.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/pytests/functional/modules/test_pkg.py b/tests/pytests/functional/modules/test_pkg.py index 527f461aac8..324cdef767f 100644 --- a/tests/pytests/functional/modules/test_pkg.py +++ b/tests/pytests/functional/modules/test_pkg.py @@ -396,7 +396,7 @@ def test_pkg_upgrade_has_pending_upgrades(grains, modules): Test running a system upgrade when there are packages that need upgrading """ if grains["os"] == "Arch": - pytest.skipTest("Arch moved to Python 3.8 and we're not ready for it yet") + pytest.skip("Arch moved to Python 3.8 and we're not ready for it yet") modules.pkg.upgrade() @@ -434,7 +434,7 @@ def test_pkg_upgrade_has_pending_upgrades(grains, modules): ret = modules.pkg.install(target, version=old) if not isinstance(ret, dict): if ret.startswith("ERROR"): - pytest.skipTest(f"Could not install older {target} to complete test.") + pytest.skip(f"Could not install older {target} to complete test.") # Run a system upgrade, which should catch the fact that the # targeted package needs upgrading, and upgrade it. @@ -448,7 +448,7 @@ def test_pkg_upgrade_has_pending_upgrades(grains, modules): else: ret = modules.pkg.list_upgrades() if ret == "" or ret == {}: - pytest.skipTest( + pytest.skip( "No updates available for this machine. Skipping pkg.upgrade test." ) else: From 23ee362db6fbd529cd4980cd2dc1839ace1175ea Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 14 May 2024 08:50:24 +0100 Subject: [PATCH 2/4] Special-case Ubuntu 24.04 --- tests/pytests/functional/modules/test_pkg.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/pytests/functional/modules/test_pkg.py b/tests/pytests/functional/modules/test_pkg.py index 324cdef767f..e2380c2932d 100644 --- a/tests/pytests/functional/modules/test_pkg.py +++ b/tests/pytests/functional/modules/test_pkg.py @@ -213,11 +213,14 @@ def test_mod_del_repo_multiline_values(modules): @pytest.mark.requires_salt_modules("pkg.owner") -def test_owner(modules): +def test_owner(modules, grains): """ test finding the package owning a file """ - binary = shutil.which("ls") + binary = "/bin/ls" + if grains["os"] == "Ubuntu" and grains["osmajorrelease"] >= 24: + binary = "/usr/bin/ls" + ret = modules.pkg.owner(binary) assert len(ret) != 0 @@ -225,11 +228,14 @@ def test_owner(modules): # Similar to pkg.owner, but for FreeBSD's pkgng @pytest.mark.skip_on_freebsd(reason="test for new package manager for FreeBSD") @pytest.mark.requires_salt_modules("pkg.which") -def test_which(modules): +def test_which(modules, grains): """ test finding the package owning a file """ - ret = modules.pkg.which("/usr/local/bin/salt-call") + binary = "/bin/ls" + if grains["os"] == "Ubuntu" and grains["osmajorrelease"] >= 24: + binary = "/usr/bin/ls" + ret = modules.pkg.which(binary) assert len(ret) != 0 From 4656263cfccc0a36e476498cf462adb4a3867901 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 16 May 2024 09:17:34 +0100 Subject: [PATCH 3/4] Throttle before merging reports. Sometimes we just need to wait a little. --- .github/workflows/test-action-linux.yml | 5 +++++ .github/workflows/test-action-macos.yml | 5 +++++ .github/workflows/test-action-windows.yml | 5 +++++ .github/workflows/test-packages-action-linux.yml | 5 +++++ .github/workflows/test-packages-action-macos.yml | 5 +++++ .github/workflows/test-packages-action-windows.yml | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/.github/workflows/test-action-linux.yml b/.github/workflows/test-action-linux.yml index 70f0ed01935..55364495e33 100644 --- a/.github/workflows/test-action-linux.yml +++ b/.github/workflows/test-action-linux.yml @@ -310,6 +310,11 @@ jobs: - name: Checkout Source Code uses: actions/checkout@v4 + - name: "Throttle Builds" + shell: bash + run: | + t=$(shuf -i 1-30 -n 1); echo "Sleeping $t seconds"; sleep "$t" + - name: Merge JUnit XML Test Run Artifacts uses: actions/upload-artifact/merge@v4 with: diff --git a/.github/workflows/test-action-macos.yml b/.github/workflows/test-action-macos.yml index 00b22518ba1..e61ab82ae58 100644 --- a/.github/workflows/test-action-macos.yml +++ b/.github/workflows/test-action-macos.yml @@ -338,6 +338,11 @@ jobs: - name: Checkout Source Code uses: actions/checkout@v4 + - name: "Throttle Builds" + shell: bash + run: | + t=$(shuf -i 1-30 -n 1); echo "Sleeping $t seconds"; sleep "$t" + - name: Merge JUnit XML Test Run Artifacts uses: actions/upload-artifact/merge@v4 with: diff --git a/.github/workflows/test-action-windows.yml b/.github/workflows/test-action-windows.yml index 69a128732a9..a01a55ba34a 100644 --- a/.github/workflows/test-action-windows.yml +++ b/.github/workflows/test-action-windows.yml @@ -311,6 +311,11 @@ jobs: - name: Checkout Source Code uses: actions/checkout@v4 + - name: "Throttle Builds" + shell: bash + run: | + t=$(shuf -i 1-30 -n 1); echo "Sleeping $t seconds"; sleep "$t" + - name: Merge JUnit XML Test Run Artifacts uses: actions/upload-artifact/merge@v4 with: diff --git a/.github/workflows/test-packages-action-linux.yml b/.github/workflows/test-packages-action-linux.yml index fc243e83baa..a319f9f262e 100644 --- a/.github/workflows/test-packages-action-linux.yml +++ b/.github/workflows/test-packages-action-linux.yml @@ -239,6 +239,11 @@ jobs: - name: Checkout Source Code uses: actions/checkout@v4 + - name: "Throttle Builds" + shell: bash + run: | + t=$(shuf -i 1-30 -n 1); echo "Sleeping $t seconds"; sleep "$t" + - name: Merge Test Run Artifacts uses: actions/upload-artifact/merge@v4 with: diff --git a/.github/workflows/test-packages-action-macos.yml b/.github/workflows/test-packages-action-macos.yml index 1716f2a0e09..df107359f03 100644 --- a/.github/workflows/test-packages-action-macos.yml +++ b/.github/workflows/test-packages-action-macos.yml @@ -222,6 +222,11 @@ jobs: - name: Checkout Source Code uses: actions/checkout@v4 + - name: "Throttle Builds" + shell: bash + run: | + t=$(shuf -i 1-30 -n 1); echo "Sleeping $t seconds"; sleep "$t" + - name: Merge Test Run Artifacts uses: actions/upload-artifact/merge@v4 with: diff --git a/.github/workflows/test-packages-action-windows.yml b/.github/workflows/test-packages-action-windows.yml index 72cab193bcf..a3198ac6ffb 100644 --- a/.github/workflows/test-packages-action-windows.yml +++ b/.github/workflows/test-packages-action-windows.yml @@ -238,6 +238,11 @@ jobs: - name: Checkout Source Code uses: actions/checkout@v4 + - name: "Throttle Builds" + shell: bash + run: | + t=$(shuf -i 1-30 -n 1); echo "Sleeping $t seconds"; sleep "$t" + - name: Merge Test Run Artifacts uses: actions/upload-artifact/merge@v4 with: From 6052a1ede23bfe2d8dfed8fe6d53ded8796bbb0d Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 14 May 2024 21:13:16 +0100 Subject: [PATCH 4/4] Temporary skip tests on PhotonOS 5 --- tests/pytests/functional/states/test_docker_container.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/pytests/functional/states/test_docker_container.py b/tests/pytests/functional/states/test_docker_container.py index 2cfc5b7a343..3caf0d4475d 100644 --- a/tests/pytests/functional/states/test_docker_container.py +++ b/tests/pytests/functional/states/test_docker_container.py @@ -170,7 +170,10 @@ def docker_container(states): @pytest.fixture(scope="module") -def image(tmp_path_factory): +def image(grains, tmp_path_factory): + if grains["os"] == "VMware Photon OS" and grains["osmajorrelease"] == 5: + pytest.skip(f"Temporary skip on {grains['osfinger']}") + if not salt.utils.path.which("docker"): # Somehow the above skip_if_binaries_missing marker for docker # only get's evaluated after this fixture?!?