-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
3,385 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Default config from test suite line 1/6 | ||
#master: salt | ||
# Default config from test suite line 2/6 | ||
#id: | ||
# Default config from test suite line 3/6 | ||
# Default config from test suite line 4/6 | ||
# Default config from test suite line 5/6 | ||
# Default config from test suite line 6/6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@ echo off | ||
Set "CurDir=%~dp0" | ||
PowerShell -ExecutionPolicy RemoteSigned -File "%CurDir%\clean.ps1" %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<# | ||
.SYNOPSIS | ||
Clean the NSIS Tests directory | ||
.DESCRIPTION | ||
This script removes the venv directory and the test-setup.exe | ||
.EXAMPLE | ||
clean.ps1 | ||
.EXAMPLE | ||
clean.ps1 | ||
#> | ||
|
||
# Script Preferences | ||
$ProgressPreference = "SilentlyContinue" | ||
$ErrorActionPreference = "Stop" | ||
|
||
#------------------------------------------------------------------------------- | ||
# Script Variables | ||
#------------------------------------------------------------------------------- | ||
|
||
$SCRIPT_DIR = (Get-ChildItem "$($myInvocation.MyCommand.Definition)").DirectoryName | ||
|
||
#------------------------------------------------------------------------------- | ||
# Script Functions | ||
#------------------------------------------------------------------------------- | ||
|
||
function Write-Result($result, $ForegroundColor="Green") { | ||
$position = 80 - $result.Length - [System.Console]::CursorLeft | ||
Write-Host -ForegroundColor $ForegroundColor ("{0,$position}$result" -f "") | ||
} | ||
|
||
#------------------------------------------------------------------------------- | ||
# Start the Script | ||
#------------------------------------------------------------------------------- | ||
Write-Host $("=" * 80) | ||
Write-Host "Clean NSIS Test Environment" -ForegroundColor Cyan | ||
Write-Host $("-" * 80) | ||
|
||
#------------------------------------------------------------------------------- | ||
# Make sure we're not in a virtual environment | ||
#------------------------------------------------------------------------------- | ||
if ( $env:VIRTUAL_ENV ) { | ||
# I've tried deactivating from the script, but it doesn't work | ||
Write-Host "Please deactive the virtual environment" | ||
exit | ||
} | ||
|
||
#------------------------------------------------------------------------------- | ||
# Remove venv directory | ||
#------------------------------------------------------------------------------- | ||
if ( Test-Path -Path "$SCRIPT_DIR\venv" ) { | ||
Write-Host "Removing venv directory: " -NoNewline | ||
Remove-Item -Path "$SCRIPT_DIR\venv" -Recurse -Force | ||
if ( Test-Path -Path "$SCRIPT_DIR\venv" ) { | ||
Write-Result "Failed" -ForegroundColor Red | ||
exit 1 | ||
} else { | ||
Write-Result "Success" -ForegroundColor Green | ||
} | ||
} | ||
#------------------------------------------------------------------------------- | ||
# Remove test-setup.exe | ||
#------------------------------------------------------------------------------- | ||
if ( Test-Path -Path "$SCRIPT_DIR\test-setup.exe" ) { | ||
Write-Host "Removing test-setup.exe: " -NoNewline | ||
Remove-Item -Path "$SCRIPT_DIR\test-setup.exe" -Recurse -Force | ||
if ( Test-Path -Path "$SCRIPT_DIR\test-setup.exe" ) { | ||
Write-Result "Failed" -ForegroundColor Red | ||
exit 1 | ||
} else { | ||
Write-Result "Success" -ForegroundColor Green | ||
} | ||
} | ||
|
||
#------------------------------------------------------------------------------- | ||
# Script Completed | ||
#------------------------------------------------------------------------------- | ||
Write-Host $("-" * 80) | ||
Write-Host "Clean NSIS Test Environment Completed" -ForegroundColor Cyan | ||
Write-Host $("=" * 80) |
38 changes: 38 additions & 0 deletions
38
tests/pytests/pkg/installer/nsis/config_tests/test_custom_full_path.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def install(): | ||
pytest.helpers.clean_env() | ||
|
||
# Create a custom config | ||
pytest.helpers.custom_config() | ||
|
||
full_path_conf = rf"{pytest.REPO_DIR}\custom_conf" | ||
|
||
pytest.helpers.run_command( | ||
[pytest.INST_BIN, "/S", f"/custom-config={full_path_conf}"] | ||
) | ||
yield | ||
pytest.helpers.clean_env() | ||
|
||
|
||
def test_binaries_present(install): | ||
assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") | ||
|
||
|
||
def test_config_present(install): | ||
assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") | ||
|
||
|
||
def test_config_correct(install): | ||
# The config file should be the custom config, unchanged | ||
with open(rf"{pytest.REPO_DIR}\custom_conf") as f: | ||
expected = f.readlines() | ||
|
||
with open(rf"{pytest.DATA_DIR}\conf\minion") as f: | ||
result = f.readlines() | ||
|
||
assert result == expected |
44 changes: 44 additions & 0 deletions
44
tests/pytests/pkg/installer/nsis/config_tests/test_custom_master.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def install(): | ||
pytest.helpers.clean_env() | ||
|
||
# Create a custom config | ||
pytest.helpers.custom_config() | ||
|
||
pytest.helpers.run_command( | ||
[pytest.INST_BIN, "/S", "/custom-config=custom_conf", "/master=cli_master"] | ||
) | ||
yield | ||
pytest.helpers.clean_env() | ||
|
||
|
||
def test_binaries_present(install): | ||
assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") | ||
|
||
|
||
def test_config_present(install): | ||
assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") | ||
|
||
|
||
def test_config_correct(install): | ||
# The config file should be the custom config with only master set | ||
expected = [ | ||
"# Custom config from test suite line 1/6\n", | ||
"master: cli_master\n", | ||
"# Custom config from test suite line 2/6\n", | ||
"id: custom_minion\n", | ||
"# Custom config from test suite line 3/6\n", | ||
"# Custom config from test suite line 4/6\n", | ||
"# Custom config from test suite line 5/6\n", | ||
"# Custom config from test suite line 6/6\n", | ||
] | ||
|
||
with open(rf"{pytest.DATA_DIR}\conf\minion") as f: | ||
result = f.readlines() | ||
|
||
assert result == expected |
50 changes: 50 additions & 0 deletions
50
tests/pytests/pkg/installer/nsis/config_tests/test_custom_master_minion.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def install(): | ||
pytest.helpers.clean_env() | ||
|
||
# Create a custom config | ||
pytest.helpers.custom_config() | ||
|
||
pytest.helpers.run_command( | ||
[ | ||
pytest.INST_BIN, | ||
"/S", | ||
"/custom-config=custom_conf", | ||
"/master=cli_master", | ||
"/minion-name=cli_minion", | ||
] | ||
) | ||
yield | ||
pytest.helpers.clean_env() | ||
|
||
|
||
def test_binaries_present(install): | ||
assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") | ||
|
||
|
||
def test_config_present(install): | ||
assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") | ||
|
||
|
||
def test_config_correct(install): | ||
# The config file should be the custom config with master and minion set | ||
expected = [ | ||
"# Custom config from test suite line 1/6\n", | ||
"master: cli_master\n", | ||
"# Custom config from test suite line 2/6\n", | ||
"id: cli_minion\n", | ||
"# Custom config from test suite line 3/6\n", | ||
"# Custom config from test suite line 4/6\n", | ||
"# Custom config from test suite line 5/6\n", | ||
"# Custom config from test suite line 6/6\n", | ||
] | ||
|
||
with open(f"{pytest.DATA_DIR}\\conf\\minion") as f: | ||
result = f.readlines() | ||
|
||
assert result == expected |
49 changes: 49 additions & 0 deletions
49
tests/pytests/pkg/installer/nsis/config_tests/test_custom_minion.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def install(): | ||
pytest.helpers.clean_env() | ||
|
||
# Create a custom config | ||
pytest.helpers.custom_config() | ||
|
||
pytest.helpers.run_command( | ||
[ | ||
pytest.INST_BIN, | ||
"/S", | ||
"/custom-config=custom_conf", | ||
"/minion-name=cli_minion", | ||
] | ||
) | ||
yield | ||
pytest.helpers.clean_env() | ||
|
||
|
||
def test_binaries_present(install): | ||
assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") | ||
|
||
|
||
def test_config_present(install): | ||
assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") | ||
|
||
|
||
def test_config_correct(install): | ||
# The config file should be the custom config with only minion set | ||
expected = [ | ||
"# Custom config from test suite line 1/6\n", | ||
"master: custom_master\n", | ||
"# Custom config from test suite line 2/6\n", | ||
"id: cli_minion\n", | ||
"# Custom config from test suite line 3/6\n", | ||
"# Custom config from test suite line 4/6\n", | ||
"# Custom config from test suite line 5/6\n", | ||
"# Custom config from test suite line 6/6\n", | ||
] | ||
|
||
with open(rf"{pytest.DATA_DIR}\conf\minion") as f: | ||
result = f.readlines() | ||
|
||
assert result == expected |
34 changes: 34 additions & 0 deletions
34
tests/pytests/pkg/installer/nsis/config_tests/test_custom_rel_path.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def install(): | ||
pytest.helpers.clean_env() | ||
|
||
# Create a custom config | ||
pytest.helpers.custom_config() | ||
|
||
pytest.helpers.run_command([pytest.INST_BIN, "/S", "/custom-config=custom_conf"]) | ||
yield | ||
pytest.helpers.clean_env() | ||
|
||
|
||
def test_binaries_present(install): | ||
assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") | ||
|
||
|
||
def test_config_present(install): | ||
assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") | ||
|
||
|
||
def test_config_correct(install): | ||
# The config file should be the custom config, unchanged | ||
with open(rf"{pytest.REPO_DIR}\custom_conf") as f: | ||
expected = f.readlines() | ||
|
||
with open(rf"{pytest.DATA_DIR}\conf\minion") as f: | ||
result = f.readlines() | ||
|
||
assert result == expected |
30 changes: 30 additions & 0 deletions
30
tests/pytests/pkg/installer/nsis/config_tests/test_default.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def install(): | ||
pytest.helpers.clean_env() | ||
pytest.helpers.run_command([pytest.INST_BIN, "/S"]) | ||
yield | ||
pytest.helpers.clean_env() | ||
|
||
|
||
def test_binaries_present(install): | ||
assert os.path.exists(rf"{pytest.INST_DIR}\ssm.exe") | ||
|
||
|
||
def test_config_present(install): | ||
assert os.path.exists(rf"{pytest.DATA_DIR}\conf\minion") | ||
|
||
|
||
def test_config_correct(install): | ||
# The config file should be the default config, unchanged | ||
with open(rf"{pytest.REPO_DIR}\_files\minion") as f: | ||
expected = f.readlines() | ||
|
||
with open(rf"{pytest.DATA_DIR}\conf\minion") as f: | ||
result = f.readlines() | ||
|
||
assert result == expected |
Oops, something went wrong.