Add test for issue 63208

This commit is contained in:
jeanluc 2022-12-05 22:41:19 +01:00 committed by Megan Wilhite
parent c6eb9749a5
commit 938ac7db6e
2 changed files with 19 additions and 2 deletions

View file

@ -18,6 +18,9 @@ def pillar_salt_master(salt_factories, pillar_state_tree):
"pillar_roots": {"base": [str(pillar_state_tree)]},
"open_mode": True,
"pillar_cache": True,
"ext_pillar": [
{"extra_minion_data_in_pillar": "*"},
],
}
factory = salt_factories.salt_master_daemon(
"pillar-cache-functional-master", defaults=config_defaults
@ -30,7 +33,8 @@ def pillar_salt_master(salt_factories, pillar_state_tree):
def pillar_salt_minion(pillar_salt_master):
assert pillar_salt_master.is_running()
factory = pillar_salt_master.salt_minion_daemon(
"pillar-cache-functional-minion-1", defaults={"open_mode": True}
"pillar-cache-functional-minion-1",
defaults={"open_mode": True, "hi": "there", "pass_to_ext_pillars": ["hi"]},
)
with factory.started():
# Sync All

View file

@ -88,7 +88,7 @@ def test_pillar_cache_items(pillar_cache_tree_no_refresh, pillar_salt_call_cli):
Test pillar cache does not refresh pillar when using pillar.items
"""
# pillar.items should be empty
assert not pillar_salt_call_cli.run("pillar.items").data
pillar_before = pillar_salt_call_cli.run("pillar.items").data
pillar_salt_call_cli.run("saltutil.refresh_pillar", wait=True)
# pillar.items should contain the new pillar data
ret = pillar_salt_call_cli.run("pillar.items")
@ -96,3 +96,16 @@ def test_pillar_cache_items(pillar_cache_tree_no_refresh, pillar_salt_call_cli):
assert ret.data
assert "test" in ret.data
assert "test2" in ret.data
assert ret.data != pillar_before
def test_pillar_cache_passes_extra_minion_data(pillar_salt_call_cli):
"""
Test that pillar cache does not disable passing of
extra_minion_data to external pillars
"""
ret = pillar_salt_call_cli.run("pillar.items")
assert ret.returncode == 0
assert ret.data
assert "hi" in ret.data
assert ret.data["hi"] == "there"