removed clutter

This commit is contained in:
Tyler Levy Conde 2024-06-04 15:15:34 -06:00 committed by Daniel Wozniak
parent bd98f0db68
commit 9ea88c5bef

View file

@ -855,6 +855,128 @@ def test_call_chunk_sub_state_run(minion_opts):
assert sub_state["__sls__"] == "external"
def test_aggregate_requisites(minion_opts):
"""
Test to ensure that the requisites are included in the aggregated low state.
"""
# The low that is returned from _mod_aggregrate
low = {
"state": "pkg",
"name": "other_pkgs",
"__sls__": "47628",
"__env__": "base",
"__id__": "other_pkgs",
"pkgs": ["byobu", "vim", "tmux", "google-cloud-sdk"],
"aggregate": True,
"order": 10002,
"fun": "installed",
"__agg__": True,
}
# Chunks that have been processed through the pkg mod_aggregate function
chunks = [
{
"state": "file",
"name": "/tmp/install-vim",
"__sls__": "47628",
"__env__": "base",
"__id__": "/tmp/install-vim",
"order": 10000,
"fun": "managed",
},
{
"state": "file",
"name": "/tmp/install-tmux",
"__sls__": "47628",
"__env__": "base",
"__id__": "/tmp/install-tmux",
"order": 10001,
"fun": "managed",
},
{
"state": "pkg",
"name": "other_pkgs",
"__sls__": "47628",
"__env __": "base",
"__id__": "other_pkgs",
"pkgs": ["byobu"],
"aggregate": True,
"order": 10002,
"fun": "installed",
},
{
"state": "pkg",
"name": "bc",
"__sls__": "47628",
"__env__": "base",
"__id__": "bc",
"hold": True,
"__agg__": True,
"order": 10003,
"fun": "installed",
},
{
"state": "pkg",
"name": "vim",
"__sls__": "47628",
"__env__": "base",
"__agg__": True,
"__id__": "vim",
"require": ["/tmp/install-vim"],
"order": 10004,
"fun": "installed",
},
{
"state": "pkg",
"name": "tmux",
"__sls__": "47628",
"__env__": "base",
"__agg__": True,
"__id__": "tmux",
"require": ["/tmp/install-tmux"],
"order": 10005,
"fun": "installed",
},
{
"state": "pkgrepo",
"name": "deb https://packages.cloud.google.com/apt cloud-sdk main",
"__sls__": "47628",
"__env__": "base",
"__id__": "google-cloud-repo",
"humanname": "Google Cloud SDK",
"file": "/etc/apt/sources.list.d/google-cloud-sdk.list",
"key_url": "https://packages.cloud.google.com/apt/doc/apt-key.gpg",
"order": 10006,
"fun": "managed",
},
{
"state": "pkg",
"name": "google-cloud-sdk",
"__sls__": "47628",
"__env__": "base",
"__agg__": True,
"__id__": "google-cloud-sdk",
"require": ["google-cloud-repo"],
"order": 10007,
"fun": "installed",
},
]
with patch("salt.state.State._gather_pillar"):
state_obj = salt.state.State(minion_opts)
low_ret = state_obj._aggregate_requisites(low, chunks)
# Ensure the low returned contains require
assert "require" in low_ret
# Ensure all the requires from pkg states are in low
assert low_ret["require"] == [
"/tmp/install-vim",
"/tmp/install-tmux",
"google-cloud-repo",
]
def test_mod_aggregate(minion_opts):
"""
Test to ensure that the requisites are included in the aggregated low state.