Skip to content

Commit

Permalink
Merge pull request #1926 from locustio/suppress-warnings-for-patch-ve…
Browse files Browse the repository at this point in the history
…rsion-mismatch-between-master-and-worker

Suppress warnings for patch version mismatch between master and worker (and make them debug level instead)
  • Loading branch information
cyberw authored Nov 3, 2021
2 parents 4bb2d97 + 74190c7 commit 17ea93e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 8 additions & 3 deletions locust/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,9 +881,14 @@ def client_listener(self):
logger.error(f"An old (pre 2.0) worker tried to connect ({client_id}). That's not going to work.")
continue
elif msg.data != __version__ and msg.data != -1:
logger.warning(
f"A worker ({client_id}) running a different version ({msg.data}) connected, master version is {__version__}"
)
if msg.data[0:4] == __version__[0:4]:
logger.debug(
f"A worker ({client_id}) running a different patch version ({msg.data}) connected, master version is {__version__}"
)
else:
logger.warning(
f"A worker ({client_id}) running a different version ({msg.data}) connected, master version is {__version__}"
)
worker_node_id = msg.node_id
self.clients[worker_node_id] = WorkerNode(worker_node_id, heartbeat_liveness=HEARTBEAT_LIVENESS)
if self._users_dispatcher is not None:
Expand Down
5 changes: 5 additions & 0 deletions locust/test/test_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -1684,6 +1684,11 @@ def test_worker_connect_with_special_versions(self):
server.mocked_send(Message("client_ready", -1, "version_check_bypass_should_not_warn"))
self.assertEqual(1, len(self.mocked_log.warning))
self.assertEqual(2, len(master.clients))
server.mocked_send(
Message("client_ready", __version__ + "1", "difference_in_patch_version_should_not_warn")
)
self.assertEqual(3, len(master.clients))
self.assertEqual(1, len(self.mocked_log.warning))

def test_worker_stats_report_median(self):
with mock.patch("locust.rpc.rpc.Server", mocked_rpc()) as server:
Expand Down

0 comments on commit 17ea93e

Please sign in to comment.