From f52fea9e1d22c71d64feaac1f5581ccf4934c6f1 Mon Sep 17 00:00:00 2001 From: David Murphy Date: Tue, 12 Nov 2024 10:59:50 -0700 Subject: [PATCH] Added debugging and setting test version as github environment variable --- .github/workflows/test-linux.yml | 13 +++++++++++++ .github/workflows/test-macos.yml | 13 +++++++++++++ bootstrap-salt.sh | 4 +++- tests/conftest.py | 20 +++++++++++++++++++- tests/integration/test_installation.py | 5 +++++ 5 files changed, 53 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 3b325fc..fd4da53 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -61,6 +61,19 @@ jobs: echo "DGM plain pip for distro-slug ${{ inputs.distro-slug }}" python3 -m pip install -r tests/requirements.txt + - name: Get Version + run: | + # We need to get the version here and make it an environment variable + # It is used to install via bootstrap and in the test + # The version is in the instance name + # sed 1st - becomes space, 2nd - becomes dot + echo "matrix instance ,${{ matrix.instance }}," + vt_parms=$(echo "${{ matrix.instance }}" | sed 's/-/ /') + vt_parms2=$(echo "$vt_parms" | sed 's/-/./') + vt_parm_ver=$(echo "$vt_parms2" | awk -F ' ' '{print $2}') + echo "bt parms ,$vt_parms, vt_parms2 ,$vt_parms2, vt_parms_ver ,$vt_parm_ver," + echo ""SaltVersion=$vt_parm_ver" >> $GITHUB_ENV + - name: Bootstrap Salt run: | # sed 1st - becomes space, 2nd - becomes dot diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 57e96b9..052ff92 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -51,6 +51,19 @@ jobs: run: | python3 -m pip install -r tests/requirements.txt + - name: Get Version + run: | + # We need to get the version here and make it an environment variable + # It is used to install via bootstrap and in the test + # The version is in the instance name + # sed 1st - becomes space, 2nd - becomes dot + echo "matrix instance ,${{ matrix.instance }}," + vt_parms=$(echo "${{ matrix.instance }}" | sed 's/-/ /') + vt_parms2=$(echo "$vt_parms" | sed 's/-/./') + vt_parm_ver=$(echo "$vt_parms2" | awk -F ' ' '{print $2}') + echo "bt parms ,$vt_parms, vt_parms2 ,$vt_parms2, vt_parms_ver ,$vt_parm_ver," + echo ""SaltVersion=$vt_parm_ver" >> $GITHUB_ENV + - name: Bootstrap Salt run: | # sed 1st - becomes space, 2nd - becomes dot diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d5a47e3..3006848 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -618,7 +618,9 @@ __check_services_systemd_functional # Define installation type if [ "$#" -gt 0 ];then __check_unparsed_options "$*" - ITYPE=$1 + ## DGM ITYPE=$1 + # get first arguement + ITYPE=$(echo $1 | awk -F ' ' '{print $1}') shift fi diff --git a/tests/conftest.py b/tests/conftest.py index 154b257..2186d06 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -19,6 +19,11 @@ def target_salt_version(): target_salt = os.environ.get("SaltVersion", "") + print( + f"DGM conftest target_salt_version, target_salt '{target_salt}', os.environ '{os.environ}'", + flush=True, + ) + html_response = requests.get(API_URL) content = json.loads(html_response.text) folders = content["children"] @@ -32,10 +37,23 @@ def target_salt_version(): versions[maj_version] = version versions["latest"] = version + print( + f"DGM conftest target_salt_version, target_salt '{target_salt}', versions '{versions}'", + flush=True, + ) + if target_salt.startswith("v"): target_salt = target_salt[1:] if target_salt not in versions: pytest.skip(f"Invalid testing version: {target_salt}") - if target_salt in ("default", "latest", "master", "nightly"): + if target_salt in ( + "default", + "latest", + "master", + "nightly", + "stable", + "onedir", + "git", + ): pytest.skip("Don't have a specific salt version to test against") return versions[target_salt] diff --git a/tests/integration/test_installation.py b/tests/integration/test_installation.py index 7272401..714b8e1 100644 --- a/tests/integration/test_installation.py +++ b/tests/integration/test_installation.py @@ -74,5 +74,10 @@ def test_target_salt_version(path, target_salt_version): pytest.skip(f"No target version specified") cmd = ["salt-call", "--local", "grains.item", "saltversion", "--timeout=120"] result = run_salt_call(cmd) + dgm_saltversion = result["saltversion"] + print( + f"DGM test_target_salt_version, target_salt_version '{target_salt_version}', result saltversion '{dgm_saltversion }', result '{result}'", + flush=True, + ) # Returns: {'saltversion': '3006.9+217.g53cfa53040'} assert result["saltversion"] == target_salt_version