Skip to content

Commit

Permalink
Add some debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
twangboy committed Nov 4, 2024
1 parent 6c5647c commit 59c85d4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
- name: Add Salt to Path
run: |
$env:Path = "$env:Path;C:\Program Files\Salt Project\Salt"
Write-Output $env:Path
- name: Test Bootstrap
run: |
Expand Down
22 changes: 18 additions & 4 deletions tests/integration/test_installation.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import json
import logging
import os
import platform
import subprocess
import json

import pytest

log = logging.getLogger(__name__)


@pytest.fixture
def path():
if platform.system() == "Windows":
os.environ["path"] = (
f'{os.environ["path"]};C:\\Program Files\\Salt Project\\Salt'
)
yield os.environ["path"]


def run_salt_call(cmd):
"""
Runs salt call command and returns a dictionary
Expand All @@ -16,21 +29,22 @@ def run_salt_call(cmd):
return json_data["local"]


def test_ping():
def test_ping(path):
cmd = ["salt-call", "--local", "test.ping"]
result = run_salt_call(cmd)
path = os.getenv("path")
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]}
py_maj_ver = result["pythonversion"][0]
assert py_maj_ver == target_python_version


def test_target_salt_version(target_salt_version):
def test_target_salt_version(path, target_salt_version):
cmd = ["salt-call", "--local", "grains.item", "saltversion", "--timeout=120"]
result = run_salt_call(cmd)
# Returns: {'saltversion': '3006.9+217.g53cfa53040'}
Expand Down

0 comments on commit 59c85d4

Please sign in to comment.