mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
fixes saltstack/salt#62654 saltcheck _get_top_states doesn't pass saltenv to state.show_top
This commit is contained in:
parent
451c57edfa
commit
1a546537b1
3 changed files with 17 additions and 1 deletions
1
changelog/62654.fixed
Normal file
1
changelog/62654.fixed
Normal file
|
@ -0,0 +1 @@
|
|||
Fix saltcheck _get_top_states doesn't pass saltenv to state.show_top
|
|
@ -651,7 +651,7 @@ def _get_top_states(saltenv="base"):
|
|||
Equivalent to a salt cli: salt web state.show_top
|
||||
"""
|
||||
top_states = []
|
||||
top_states = __salt__["state.show_top"]()[saltenv]
|
||||
top_states = __salt__["state.show_top"](saltenv=saltenv)[saltenv]
|
||||
log.debug("saltcheck for saltenv: %s found top states: %s", saltenv, top_states)
|
||||
return top_states
|
||||
|
||||
|
|
15
tests/pytests/unit/modules/test_saltcheck.py
Normal file
15
tests/pytests/unit/modules/test_saltcheck.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import pytest
|
||||
|
||||
import salt.modules.saltcheck as saltcheck
|
||||
from tests.support.mock import MagicMock
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def configure_loader_modules():
|
||||
return {saltcheck: {"__salt__": {"state.show_top": MagicMock()}}}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("saltenv", ["base", "dev", "howdy"])
|
||||
def test__get_top_states_call_args(saltenv):
|
||||
saltcheck._get_top_states(saltenv=saltenv)
|
||||
saltcheck.__salt__["state.show_top"].assert_called_with(saltenv=saltenv)
|
Loading…
Add table
Reference in a new issue