mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge 3006.x into 3007.x
This commit is contained in:
commit
b22db6db8a
6 changed files with 89 additions and 177 deletions
24
.github/workflows/test-action-linux.yml
vendored
24
.github/workflows/test-action-linux.yml
vendored
|
@ -203,31 +203,13 @@ jobs:
|
|||
--nox-session=${{ inputs.nox-session }} ${{ inputs.distro-slug }} \
|
||||
${{ matrix.tests-chunk }}
|
||||
|
||||
- name: Run Fast/Changed Tests
|
||||
- name: Run Changed Tests
|
||||
id: run-fast-changed-tests
|
||||
if: ${{ fromJSON(inputs.testrun)['type'] != 'full' && fromJSON(inputs.testrun)['selected_tests']['fast'] == false }}
|
||||
if: ${{ fromJSON(inputs.testrun)['type'] != 'full' }}
|
||||
run: |
|
||||
tools --timestamps --no-output-timeout-secs=1800 --timeout-secs=14400 vm test --skip-requirements-install \
|
||||
--nox-session=${{ inputs.nox-session }} --rerun-failures -E SALT_TRANSPORT ${{ matrix.fips && '--fips ' || '' }}${{ inputs.distro-slug }} \
|
||||
${{ matrix.tests-chunk }} -- --suppress-no-test-exit-code \
|
||||
--from-filenames=testrun-changed-files.txt
|
||||
|
||||
- name: Run Slow/Changed Tests
|
||||
id: run-slow-changed-tests
|
||||
if: ${{ fromJSON(inputs.testrun)['type'] != 'full' && fromJSON(inputs.testrun)['selected_tests']['slow'] == false }}
|
||||
run: |
|
||||
tools --timestamps --no-output-timeout-secs=1800 --timeout-secs=14400 vm test --skip-requirements-install \
|
||||
--nox-session=${{ inputs.nox-session }} --rerun-failures -E SALT_TRANSPORT ${{ matrix.fips && '--fips ' || '' }}${{ inputs.distro-slug }} \
|
||||
${{ matrix.tests-chunk }} -- --no-fast-tests --slow-tests --suppress-no-test-exit-code \
|
||||
--from-filenames=testrun-changed-files.txt
|
||||
|
||||
- name: Run Core/Changed Tests
|
||||
id: run-core-changed-tests
|
||||
if: ${{ fromJSON(inputs.testrun)['type'] != 'full' && fromJSON(inputs.testrun)['selected_tests']['core'] == false }}
|
||||
run: |
|
||||
tools --timestamps --no-output-timeout-secs=1800 --timeout-secs=14400 vm test --skip-requirements-install \
|
||||
--nox-session=${{ inputs.nox-session }} --rerun-failures -E SALT_TRANSPORT ${{ matrix.fips && '--fips ' || '' }}${{ inputs.distro-slug }} \
|
||||
${{ matrix.tests-chunk }} -- --no-fast-tests --core-tests --suppress-no-test-exit-code \
|
||||
${{ matrix.tests-chunk }} -- --core-tests --slow-tests --suppress-no-test-exit-code \
|
||||
--from-filenames=testrun-changed-files.txt
|
||||
|
||||
- name: Run Fast Tests
|
||||
|
|
40
.github/workflows/test-action-macos.yml
vendored
40
.github/workflows/test-action-macos.yml
vendored
|
@ -181,7 +181,7 @@ jobs:
|
|||
run: |
|
||||
sudo -E nox --force-color -e ${{ inputs.nox-session }} -- ${{ matrix.tests-chunk }} -- -k "mac or darwin"
|
||||
|
||||
- name: Run Fast/Changed Tests
|
||||
- name: Run Changed Tests
|
||||
id: run-fast-changed-tests
|
||||
if: ${{ fromJSON(inputs.testrun)['type'] != 'full' && fromJSON(inputs.testrun)['selected_tests']['fast'] == false }}
|
||||
env:
|
||||
|
@ -196,43 +196,7 @@ jobs:
|
|||
COVERAGE_CONTEXT: ${{ inputs.distro-slug }}
|
||||
run: |
|
||||
sudo -E nox --force-color -e ${{ inputs.nox-session }} -- ${{ matrix.tests-chunk }} -- \
|
||||
-k "mac or darwin" --suppress-no-test-exit-code \
|
||||
--from-filenames=testrun-changed-files.txt
|
||||
|
||||
- name: Run Slow/Changed Tests
|
||||
id: run-slow-changed-tests
|
||||
if: ${{ fromJSON(inputs.testrun)['type'] != 'full' && fromJSON(inputs.testrun)['selected_tests']['slow'] == false }}
|
||||
env:
|
||||
SKIP_REQUIREMENTS_INSTALL: "1"
|
||||
PRINT_TEST_SELECTION: "0"
|
||||
PRINT_TEST_PLAN_ONLY: "0"
|
||||
PRINT_SYSTEM_INFO: "0"
|
||||
RERUN_FAILURES: "1"
|
||||
GITHUB_ACTIONS_PIPELINE: "1"
|
||||
SKIP_INITIAL_GH_ACTIONS_FAILURES: "1"
|
||||
SKIP_CODE_COVERAGE: "${{ inputs.skip-code-coverage && '1' || '0' }}"
|
||||
COVERAGE_CONTEXT: ${{ inputs.distro-slug }}
|
||||
run: |
|
||||
sudo -E nox --force-color -e ${{ inputs.nox-session }} -- ${{ matrix.tests-chunk }} -- \
|
||||
-k "mac or darwin" --suppress-no-test-exit-code --no-fast-tests --slow-tests \
|
||||
--from-filenames=testrun-changed-files.txt
|
||||
|
||||
- name: Run Core/Changed Tests
|
||||
id: run-core-changed-tests
|
||||
if: ${{ fromJSON(inputs.testrun)['type'] != 'full' && fromJSON(inputs.testrun)['selected_tests']['core'] == false }}
|
||||
env:
|
||||
SKIP_REQUIREMENTS_INSTALL: "1"
|
||||
PRINT_TEST_SELECTION: "0"
|
||||
PRINT_TEST_PLAN_ONLY: "0"
|
||||
PRINT_SYSTEM_INFO: "0"
|
||||
RERUN_FAILURES: "1"
|
||||
GITHUB_ACTIONS_PIPELINE: "1"
|
||||
SKIP_INITIAL_GH_ACTIONS_FAILURES: "1"
|
||||
SKIP_CODE_COVERAGE: "${{ inputs.skip-code-coverage && '1' || '0' }}"
|
||||
COVERAGE_CONTEXT: ${{ inputs.distro-slug }}
|
||||
run: |
|
||||
sudo -E nox --force-color -e ${{ inputs.nox-session }} -- ${{ matrix.tests-chunk }} -- \
|
||||
-k "mac or darwin" --suppress-no-test-exit-code --no-fast-tests --core-tests \
|
||||
-k "mac or darwin" --core-tests --slow-tests --suppress-no-test-exit-code \
|
||||
--from-filenames=testrun-changed-files.txt
|
||||
|
||||
- name: Run Fast Tests
|
||||
|
|
22
.github/workflows/test-action-windows.yml
vendored
22
.github/workflows/test-action-windows.yml
vendored
|
@ -203,31 +203,13 @@ jobs:
|
|||
--nox-session=${{ inputs.nox-session }} ${{ inputs.distro-slug }} \
|
||||
${{ matrix.tests-chunk }}
|
||||
|
||||
- name: Run Fast/Changed Tests
|
||||
- name: Run Changed Tests
|
||||
id: run-fast-changed-tests
|
||||
if: ${{ fromJSON(inputs.testrun)['type'] != 'full' && fromJSON(inputs.testrun)['selected_tests']['fast'] == false }}
|
||||
run: |
|
||||
tools --timestamps --no-output-timeout-secs=1800 --timeout-secs=14400 vm test --skip-requirements-install \
|
||||
--nox-session=${{ inputs.nox-session }} --rerun-failures -E SALT_TRANSPORT ${{ matrix.fips && '--fips ' || '' }}${{ inputs.distro-slug }} \
|
||||
${{ matrix.tests-chunk }} -- --suppress-no-test-exit-code \
|
||||
--from-filenames=testrun-changed-files.txt
|
||||
|
||||
- name: Run Slow/Changed Tests
|
||||
id: run-slow-changed-tests
|
||||
if: ${{ fromJSON(inputs.testrun)['type'] != 'full' && fromJSON(inputs.testrun)['selected_tests']['slow'] == false }}
|
||||
run: |
|
||||
tools --timestamps --no-output-timeout-secs=1800 --timeout-secs=14400 vm test --skip-requirements-install \
|
||||
--nox-session=${{ inputs.nox-session }} --rerun-failures -E SALT_TRANSPORT ${{ matrix.fips && '--fips ' || '' }}${{ inputs.distro-slug }} \
|
||||
${{ matrix.tests-chunk }} -- --no-fast-tests --slow-tests --suppress-no-test-exit-code \
|
||||
--from-filenames=testrun-changed-files.txt
|
||||
|
||||
- name: Run Core/Changed Tests
|
||||
id: run-core-changed-tests
|
||||
if: ${{ fromJSON(inputs.testrun)['type'] != 'full' && fromJSON(inputs.testrun)['selected_tests']['core'] == false }}
|
||||
run: |
|
||||
tools --timestamps --no-output-timeout-secs=1800 --timeout-secs=14400 vm test --skip-requirements-install \
|
||||
--nox-session=${{ inputs.nox-session }} --rerun-failures -E SALT_TRANSPORT ${{ matrix.fips && '--fips ' || '' }}${{ inputs.distro-slug }} \
|
||||
${{ matrix.tests-chunk }} -- --no-fast-tests --core-tests --suppress-no-test-exit-code \
|
||||
${{ matrix.tests-chunk }} -- --core-tests --slow-tests --suppress-no-test-exit-code \
|
||||
--from-filenames=testrun-changed-files.txt
|
||||
|
||||
- name: Run Fast Tests
|
||||
|
|
|
@ -125,3 +125,84 @@ def test_issue_11003_immutable_lazy_proxy_sum(modules, tmp_path, state_tree):
|
|||
for item in ("", "bar", "baz"):
|
||||
block_contents.remove(item)
|
||||
assert block_contents == []
|
||||
|
||||
|
||||
def test_issue_60426(modules, tmp_path, state_tree):
|
||||
target_path = tmp_path.joinpath("etc/foo/bar")
|
||||
jinja_name = "foo_bar"
|
||||
jinja_contents = (
|
||||
"{% for item in accumulator['accumulated configstuff'] %}{{ item }}{% endfor %}"
|
||||
)
|
||||
|
||||
sls_name = "issue-60426"
|
||||
sls_contents = f"""
|
||||
configuration file:
|
||||
file.managed:
|
||||
- name: {target_path}
|
||||
- source: salt://foo_bar.jinja
|
||||
- template: jinja
|
||||
- makedirs: True
|
||||
|
||||
accumulated configstuff:
|
||||
file.accumulated:
|
||||
- filename: {target_path}
|
||||
- text:
|
||||
- some
|
||||
- good
|
||||
- stuff
|
||||
- watch_in:
|
||||
- configuration file
|
||||
"""
|
||||
|
||||
sls_tempfile = pytest.helpers.temp_file(
|
||||
f"{sls_name}.sls", directory=state_tree, contents=sls_contents
|
||||
)
|
||||
|
||||
jinja_tempfile = pytest.helpers.temp_file(
|
||||
f"{jinja_name}.jinja", directory=state_tree, contents=jinja_contents
|
||||
)
|
||||
|
||||
with sls_tempfile, jinja_tempfile:
|
||||
ret = modules.state.apply(sls_name)
|
||||
for state_run in ret:
|
||||
assert state_run.result is True
|
||||
# Check to make sure the file was created
|
||||
assert target_path.is_file()
|
||||
# The type of new line, ie, `\n` vs `\r\n` is not important
|
||||
assert target_path.read_text() == "somegoodstuff"
|
||||
|
||||
sls_contents = f"""
|
||||
configuration file:
|
||||
file.managed:
|
||||
- name: {target_path}
|
||||
- source: salt://foo_bar.jinja
|
||||
- template: jinja
|
||||
- makedirs: True
|
||||
|
||||
accumulated configstuff:
|
||||
file.accumulated:
|
||||
- filename: {target_path}
|
||||
- text:
|
||||
- some
|
||||
- more
|
||||
- good
|
||||
- stuff
|
||||
- watch_in:
|
||||
- file: configuration file
|
||||
"""
|
||||
|
||||
sls_tempfile = pytest.helpers.temp_file(
|
||||
f"{sls_name}.sls", directory=state_tree, contents=sls_contents
|
||||
)
|
||||
jinja_tempfile = pytest.helpers.temp_file(
|
||||
f"{jinja_name}.jinja", directory=state_tree, contents=jinja_contents
|
||||
)
|
||||
|
||||
with sls_tempfile, jinja_tempfile:
|
||||
ret = modules.state.apply(sls_name)
|
||||
for state_run in ret:
|
||||
assert state_run.result is True
|
||||
# Check to make sure the file was created
|
||||
assert target_path.is_file()
|
||||
# The type of new line, ie, `\n` vs `\r\n` is not important
|
||||
assert target_path.read_text() == "somemoregoodstuff"
|
||||
|
|
|
@ -384,103 +384,6 @@ def test_issue_50221(
|
|||
assert target_path.read_text().replace("\r\n", "\n") == expected_content
|
||||
|
||||
|
||||
@pytest.mark.skip_if_not_root
|
||||
@pytest.mark.usefixtures("pillar_tree")
|
||||
def test_issue_60426(
|
||||
salt_master,
|
||||
salt_call_cli,
|
||||
tmp_path,
|
||||
salt_minion,
|
||||
):
|
||||
target_path = tmp_path / "/etc/foo/bar"
|
||||
jinja_name = "foo_bar"
|
||||
jinja_contents = (
|
||||
"{% for item in accumulator['accumulated configstuff'] %}{{ item }}{% endfor %}"
|
||||
)
|
||||
|
||||
sls_name = "issue-60426"
|
||||
sls_contents = """
|
||||
configuration file:
|
||||
file.managed:
|
||||
- name: {target_path}
|
||||
- source: salt://foo_bar.jinja
|
||||
- template: jinja
|
||||
- makedirs: True
|
||||
|
||||
accumulated configstuff:
|
||||
file.accumulated:
|
||||
- filename: {target_path}
|
||||
- text:
|
||||
- some
|
||||
- good
|
||||
- stuff
|
||||
- watch_in:
|
||||
- configuration file
|
||||
""".format(
|
||||
target_path=target_path
|
||||
)
|
||||
|
||||
sls_tempfile = salt_master.state_tree.base.temp_file(
|
||||
f"{sls_name}.sls", sls_contents
|
||||
)
|
||||
|
||||
jinja_tempfile = salt_master.state_tree.base.temp_file(
|
||||
f"{jinja_name}.jinja", jinja_contents
|
||||
)
|
||||
|
||||
with sls_tempfile, jinja_tempfile:
|
||||
ret = salt_call_cli.run("state.apply", sls_name)
|
||||
assert ret.returncode == 0
|
||||
assert ret.data
|
||||
state_run = next(iter(ret.data.values()))
|
||||
assert state_run["result"] is True
|
||||
# Check to make sure the file was created
|
||||
assert target_path.is_file()
|
||||
# The type of new line, ie, `\n` vs `\r\n` is not important
|
||||
assert target_path.read_text() == "somegoodstuff"
|
||||
|
||||
sls_name = "issue-60426"
|
||||
sls_contents = """
|
||||
configuration file:
|
||||
file.managed:
|
||||
- name: {target_path}
|
||||
- source: salt://foo_bar.jinja
|
||||
- template: jinja
|
||||
- makedirs: True
|
||||
|
||||
accumulated configstuff:
|
||||
file.accumulated:
|
||||
- filename: {target_path}
|
||||
- text:
|
||||
- some
|
||||
- good
|
||||
- stuff
|
||||
- watch_in:
|
||||
- file: configuration file
|
||||
""".format(
|
||||
target_path=target_path
|
||||
)
|
||||
|
||||
sls_tempfile = salt_master.state_tree.base.temp_file(
|
||||
f"{sls_name}.sls", sls_contents
|
||||
)
|
||||
|
||||
jinja_tempfile = salt_master.state_tree.base.temp_file(
|
||||
f"{jinja_name}.jinja", jinja_contents
|
||||
)
|
||||
|
||||
with sls_tempfile, jinja_tempfile:
|
||||
ret = salt_call_cli.run("state.apply", sls_name)
|
||||
assert ret.returncode == 0
|
||||
assert ret.data
|
||||
state_run = next(iter(ret.data.values()))
|
||||
assert state_run["result"] is True
|
||||
# Check to make sure the file was created
|
||||
assert target_path.is_file()
|
||||
# The type of new line, ie, `\n` vs `\r\n` is not important
|
||||
assert target_path.read_text() == "somegoodstuff"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def _check_min_patch_version(shell):
|
||||
min_patch_ver = "2.6"
|
||||
|
|
|
@ -657,7 +657,7 @@ def matrix(
|
|||
"functional": 3,
|
||||
"integration": 5,
|
||||
"scenarios": 1,
|
||||
"unit": 2,
|
||||
"unit": 4,
|
||||
}
|
||||
# On nightly and scheduled builds we don't want splits at all
|
||||
if workflow.lower() in ("nightly", "scheduled"):
|
||||
|
|
Loading…
Add table
Reference in a new issue