Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/65266.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Put default `optimization_order` to LazyLoader to prevent possible fails on testing
2 changes: 2 additions & 0 deletions salt/loader/lazy.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ def __init__(
opts[i], salt.loader.context.NamedLoaderContext
):
opts[i] = opts[i].value()
if "optimization_order" not in opts:
opts["optimization_order"] = [0, 1, 2]
threadsafety = not opts.get("multiprocessing")
self.opts = self.__prep_mod_opts(opts)
self.pack_self = pack_self
Expand Down
2 changes: 0 additions & 2 deletions tests/pytests/unit/grains/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ def test_network_grains_secondary_ip(tmp_path):
opts = {
"cachedir": str(cache_dir),
"extension_modules": str(extmods),
"optimization_order": [0],
}
with patch("salt.utils.network.interfaces", side_effect=[data]):
grains = salt.loader.grain_funcs(opts)
Expand Down Expand Up @@ -254,7 +253,6 @@ def test_network_grains_cache(tmp_path):
opts = {
"cachedir": str(cache_dir),
"extension_modules": str(extmods),
"optimization_order": [0],
}
with patch(
"salt.utils.network.interfaces", side_effect=[call_1, call_2]
Expand Down
5 changes: 1 addition & 4 deletions tests/pytests/unit/loader/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,14 @@ def test_raw_mod_functions():
"Ensure functions loaded by raw_mod are LoaderFunc instances"
opts = {
"extension_modules": "",
"optimization_order": [0],
}
ret = salt.loader.raw_mod(opts, "grains", "get")
for k, v in ret.items():
assert isinstance(v, salt.loader.lazy.LoadedFunc)


def test_named_loader_context_name_not_packed(tmp_path):
opts = {
"optimization_order": [0],
}
opts = {}
contents = """
from salt.loader.dunder import loader_context
__not_packed__ = loader_context.named_context("__not_packed__")
Expand Down
1 change: 0 additions & 1 deletion tests/pytests/unit/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def test_call_id_function(tmp_path):
"cachedir": str(cache_dir),
"extension_modules": str(extmods),
"grains": {"osfinger": "meh"},
"optimization_order": [0],
}
ret = salt.config.call_id_function(opts)
assert ret == "meh"
Expand Down
Loading