Skip to content

Commit

Permalink
Make cluster tests more stable
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Dec 16, 2023
1 parent f597c14 commit 35144da
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion salt/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -2476,8 +2476,8 @@ async def publish(self, clear_load):
# An alternative to copy may be to pop it
# payload.pop("_stamp")
self._send_ssh_pub(payload, ssh_minions=ssh_minions)
await self._send_pub(payload)

await self._send_pub(payload)
return {
"enc": "clear",
"load": {"jid": clear_load["jid"], "minions": minions, "missing": missing},
Expand Down
3 changes: 1 addition & 2 deletions salt/utils/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,7 @@ def iter_events(self, tag="", full=False, match_type=None, auto_reconnect=False)
continue
yield data

@tornado.gen.coroutine
def fire_event_async(self, data, tag, cb=None, timeout=1000):
async def fire_event_async(self, data, tag, cb=None, timeout=1000):
"""
Send a single event into the publisher with payload dict "data" and
event identifier "tag"
Expand Down
24 changes: 24 additions & 0 deletions tests/pytests/integration/cluster/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ def cluster_master_1(request, salt_factories, cluster_pki_path, cluster_cache_pa
],
"cluster_pki_dir": str(cluster_pki_path),
"cache_dir": str(cluster_cache_path),
"log_granular_levels": {
"salt": "info",
"salt.transport": "debug",
"salt.channel": "debug",
"salt.utils.event": "debug",
},
}
factory = salt_factories.salt_master_daemon(
"127.0.0.1",
Expand Down Expand Up @@ -74,6 +80,12 @@ def cluster_master_2(salt_factories, cluster_master_1):
],
"cluster_pki_dir": cluster_master_1.config["cluster_pki_dir"],
"cache_dir": cluster_master_1.config["cache_dir"],
"log_granular_levels": {
"salt": "info",
"salt.transport": "debug",
"salt.channel": "debug",
"salt.utils.event": "debug",
},
}

# Use the same ports for both masters, they are binding to different interfaces
Expand Down Expand Up @@ -110,6 +122,12 @@ def cluster_master_3(salt_factories, cluster_master_1):
],
"cluster_pki_dir": cluster_master_1.config["cluster_pki_dir"],
"cache_dir": cluster_master_1.config["cache_dir"],
"log_granular_levels": {
"salt": "info",
"salt.transport": "debug",
"salt.channel": "debug",
"salt.utils.event": "debug",
},
}

# Use the same ports for both masters, they are binding to different interfaces
Expand Down Expand Up @@ -139,6 +157,12 @@ def cluster_minion_1(cluster_master_1):
config_overrides = {
"master": f"{addr}:{port}",
"test.foo": "baz",
"log_granular_levels": {
"salt": "info",
"salt.transport": "debug",
"salt.channel": "debug",
"salt.utils.event": "debug",
},
}
factory = cluster_master_1.salt_minion_daemon(
"cluster-minion-1",
Expand Down
3 changes: 3 additions & 0 deletions tests/pytests/integration/cluster/test_basic_cluster.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""
Cluster integration tests.
"""
import salt.utils.event


Expand Down
5 changes: 5 additions & 0 deletions tests/pytests/scenarios/cluster/test_cluster.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"""
Cluster scinarios.
"""
import os
import pathlib
import time
Expand Down Expand Up @@ -52,6 +55,8 @@ def test_cluster_key_rotation(
if time.monotonic() - start > timeout:
assert False, f"Drop file never removed {dfpath}"

time.sleep(30)

keys = set()

# Validate the aes session key for all masters match
Expand Down

0 comments on commit 35144da

Please sign in to comment.