mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Final fix for test_script failures
This commit is contained in:
parent
ab900b9375
commit
60a9edf235
3 changed files with 6 additions and 35 deletions
5
.github/workflows/test-action.yml
vendored
5
.github/workflows/test-action.yml
vendored
|
@ -1119,6 +1119,7 @@ jobs:
|
|||
RAISE_DEPRECATIONS_RUNTIME_ERRORS: "1"
|
||||
SALT_TRANSPORT: ${{ matrix.transport }}
|
||||
TMPDIR: ${{ runner.temp }}
|
||||
shell: powershell
|
||||
run: >
|
||||
nox --force-color -e ${{ inputs.nox-session }} -- ${{ matrix.tests-chunk }} --
|
||||
-k "win" --suppress-no-test-exit-code
|
||||
|
@ -1145,6 +1146,7 @@ jobs:
|
|||
RAISE_DEPRECATIONS_RUNTIME_ERRORS: "1"
|
||||
SALT_TRANSPORT: ${{ matrix.transport }}
|
||||
TMPDIR: ${{ runner.temp }}
|
||||
shell: powershell
|
||||
run: >
|
||||
nox --force-color -e ${{ inputs.nox-session }} -- ${{ matrix.tests-chunk }} --
|
||||
-k "win" --suppress-no-test-exit-code --no-fast-tests --slow-tests
|
||||
|
@ -1171,6 +1173,7 @@ jobs:
|
|||
RAISE_DEPRECATIONS_RUNTIME_ERRORS: "1"
|
||||
SALT_TRANSPORT: ${{ matrix.transport }}
|
||||
TMPDIR: ${{ runner.temp }}
|
||||
shell: powershell
|
||||
run: >
|
||||
nox --force-color -e ${{ inputs.nox-session }} -- ${{ matrix.tests-chunk }} --
|
||||
-k "win" --suppress-no-test-exit-code --no-fast-tests --core-tests
|
||||
|
@ -1197,6 +1200,7 @@ jobs:
|
|||
RAISE_DEPRECATIONS_RUNTIME_ERRORS: "1"
|
||||
SALT_TRANSPORT: ${{ matrix.transport }}
|
||||
TMPDIR: ${{ runner.temp }}
|
||||
shell: powershell
|
||||
run: >
|
||||
nox --force-color -e ${{ inputs.nox-session }} -- ${{ matrix.tests-chunk }} --
|
||||
-k "win" --suppress-no-test-exit-code --no-fast-tests --flaky-jail
|
||||
|
@ -1223,6 +1227,7 @@ jobs:
|
|||
RAISE_DEPRECATIONS_RUNTIME_ERRORS: "1"
|
||||
SALT_TRANSPORT: ${{ matrix.transport }}
|
||||
TMPDIR: ${{ runner.temp }}
|
||||
shell: powershell
|
||||
run: >
|
||||
nox --force-color -e ${{ inputs.nox-session }} -- ${{ matrix.tests-chunk }} --
|
||||
--slow-tests --core-tests -k "win" --test-group-count=${{ matrix.test-group-count || 1 }} --test-group=${{ matrix.test-group || 1 }}
|
||||
|
|
|
@ -2942,35 +2942,6 @@ def script(
|
|||
cmd_path = _cmd_quote(path, escape=False)
|
||||
else:
|
||||
cmd_path = path
|
||||
# import pathlib
|
||||
# if not env:
|
||||
# env = {}
|
||||
# if shell.lower() == "powershell":
|
||||
# mod_paths = [
|
||||
# pathlib.Path(
|
||||
# rf'{os.getenv("SystemRoot")}\System32\WindowsPowerShell\v1.0\Modules'
|
||||
# ),
|
||||
# pathlib.Path(rf'{os.getenv("ProgramFiles")}\WindowsPowerShell\Modules'),
|
||||
# ]
|
||||
# else:
|
||||
# mod_paths = [
|
||||
# pathlib.Path(rf'{os.getenv("ProgramFiles")}\PowerShell\Modules'),
|
||||
# pathlib.Path(rf'{os.getenv("ProgramFiles")}\PowerShell\6.0.0\Modules'),
|
||||
# pathlib.Path(rf'{os.getenv("ProgramFiles")}\PowerShell\7\Modules'),
|
||||
# ]
|
||||
# ps_module_path = [
|
||||
# pathlib.Path(x) for x in os.getenv("PSModulePath", "").split(";")
|
||||
# ]
|
||||
# for mod_path in mod_paths:
|
||||
# if mod_path.exists():
|
||||
# if mod_path not in ps_module_path:
|
||||
# ps_module_path.append(mod_path)
|
||||
# mod_paths = ""
|
||||
# for mod_path in ps_module_path:
|
||||
# if mod_path:
|
||||
# mod_paths += f"{str(path)};"
|
||||
# env.update({"PSModulePath": mod_paths})
|
||||
# env.update({"PSModulePath": ""})
|
||||
else:
|
||||
cmd_path = _cmd_quote(path)
|
||||
|
||||
|
|
|
@ -57,12 +57,7 @@ def test_windows_script_args_powershell(cmd, shell, issue_56195):
|
|||
)
|
||||
script = "salt://issue-56195/test.ps1"
|
||||
|
||||
ps_path = {"PSModulePath": ""}
|
||||
ret = cmd.script(source=script, args=args, shell=shell, saltenv="base", env=ps_path)
|
||||
|
||||
import_result = cmd.run("Import-Module Microsoft.PowerShell.Security", shell=shell)
|
||||
powershell_version = cmd.run("$PSVersionTable", shell=shell)
|
||||
ps_module_path = cmd.run("$env:PSModulePath", shell=shell)
|
||||
ret = cmd.script(source=script, args=args, shell=shell, saltenv="base")
|
||||
|
||||
assert ret["stdout"] == password
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue