From de5f8d4292425d5f6cf163b803210fa7654f9e5f Mon Sep 17 00:00:00 2001 From: twangboy Date: Mon, 4 Nov 2024 13:18:55 -0700 Subject: [PATCH] Update tests on Windows --- .github/workflows/ci.yml | 17 ---------- .github/workflows/templates/generate.py | 2 -- .github/workflows/test-windows.yml | 1 - kitchen.windows.yml | 42 ------------------------- tests/integration/test_installation.py | 19 ++++++----- tests/requirements.txt | 1 + 6 files changed, 10 insertions(+), 72 deletions(-) delete mode 100644 kitchen.windows.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc4b306f0..e55ea4e9b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -144,22 +144,6 @@ jobs: instances: '["stable-3006", "stable-3006-8", "stable-3007", "stable-3007-1", "latest"]' - - windows-2019: - name: Windows 2019 - if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true' - uses: ./.github/workflows/test-windows.yml - needs: - - lint - - generate-actions-workflow - with: - distro-slug: windows-2019 - display-name: Windows 2019 - timeout: 20 - runs-on: windows-2019 - instances: '["stable-3006", "stable-3006-8", "stable-3007", "stable-3007-1", "latest"]' - - windows-2022: name: Windows 2022 if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true' @@ -480,7 +464,6 @@ jobs: - generate-actions-workflow - macos-12 - macos-13 - - windows-2019 - windows-2022 - almalinux-8 - almalinux-9 diff --git a/.github/workflows/templates/generate.py b/.github/workflows/templates/generate.py index 0fb618158..f285da8c4 100755 --- a/.github/workflows/templates/generate.py +++ b/.github/workflows/templates/generate.py @@ -32,7 +32,6 @@ "ubuntu-2404", ] WINDOWS = [ - "windows-2019", "windows-2022", ] @@ -265,7 +264,6 @@ "ubuntu-2404": "Ubuntu 24.04", "macos-12": "macOS 12", "macos-13": "macOS 13", - "windows-2019": "Windows 2019", "windows-2022": "Windows 2022", } diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 4bc98f4d4..719e34f8b 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -41,7 +41,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python 3.10 uses: actions/setup-python@v5 with: diff --git a/kitchen.windows.yml b/kitchen.windows.yml deleted file mode 100644 index a2b88e2e3..000000000 --- a/kitchen.windows.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- -driver: - name: proxy - host: localhost - reset_command: "exit 0" - port: 5985 - username: kitchen - password: Password1 - -provisioner: - salt_bootstrap_url: D:/a/salt-bootstrap/salt-bootstrap/bootstrap-salt.ps1 - salt_bootstrap_options: -Version %s -Verbose - init_environment: '' - -platforms: - - name: windows-2022 - - name: windows-2019 - -suites: - - name: stable-3006 - provisioner: - salt_version: 3006 - salt_call_command: c:\Program Files\Salt Project\Salt\salt-call.exe - - name: stable-3006-8 - provisioner: - salt_version: 3006.8 - salt_call_command: c:\Program Files\Salt Project\Salt\salt-call.exe - - name: stable-3007 - provisioner: - salt_version: 3007 - salt_call_command: c:\Program Files\Salt Project\Salt\salt-call.exe - - name: stable-3007-1 - provisioner: - salt_version: 3007.1 - salt_call_command: c:\Program Files\Salt Project\Salt\salt-call.exe - - name: latest - provisioner: - salt_version: latest - salt_call_command: c:\Program Files\Salt Project\Salt\salt-call.exe - -verifier: - command: pytest --cache-clear -v -s -ra --log-cli-level=debug -k "not test_ping" tests/integration/ diff --git a/tests/integration/test_installation.py b/tests/integration/test_installation.py index 8d0b41467..f8427b675 100644 --- a/tests/integration/test_installation.py +++ b/tests/integration/test_installation.py @@ -1,12 +1,11 @@ import json import logging +import os import platform import subprocess import pytest -## from Demos.win32cred_demo import target - log = logging.getLogger(__name__) @@ -26,19 +25,17 @@ def run_salt_call(cmd): """ cmd.append("--out=json") result = subprocess.run(cmd, capture_output=True, text=True) - if result.stdout: - json_data = json.loads(result.stdout) - return json_data["local"] - return None + json_data = json.loads(result.stdout) + return json_data["local"] -def test_ping(): +def test_ping(path): cmd = ["salt-call", "--local", "test.ping"] result = run_salt_call(cmd) assert result == True -def test_target_python_version(target_python_version): +def test_target_python_version(path, target_python_version): cmd = ["salt-call", "--local", "grains.item", "pythonversion", "--timeout=120"] result = run_salt_call(cmd) # Returns: {'pythonversion': [3, 10, 11, 'final', 0]} @@ -46,8 +43,10 @@ def test_target_python_version(target_python_version): assert py_maj_ver == target_python_version -def test_target_salt_version(target_salt_version): +def test_target_salt_version(path, target_salt_version): + if not target_salt_version: + pytest.skip(f"No target version specified") cmd = ["salt-call", "--local", "grains.item", "saltversion", "--timeout=120"] result = run_salt_call(cmd) # Returns: {'saltversion': '3006.9+217.g53cfa53040'} - assert result["saltversion"] == target_salt_version + assert result["saltversion"] == target_salt_version \ No newline at end of file diff --git a/tests/requirements.txt b/tests/requirements.txt index e079f8a60..16d3b7789 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1 +1,2 @@ pytest +requests \ No newline at end of file