Skip to content

Commit

Permalink
tests(gateway): disabled RacksDB version ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
rezib committed Jan 10, 2025
1 parent f16f028 commit 4aa1692
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions slurmweb/tests/apps/test_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later

import sys
import unittest
from unittest import mock

Expand Down Expand Up @@ -81,6 +82,22 @@ def test_agents_unsupported_racksdb_version(self, mock_requests_get):
],
)

@mock.patch("slurmweb.apps.gateway.requests.get")
def test_agents_ignore_unsupported_racksdb_version(self, mock_requests_get):
agent_info, mock_requests_get.return_value = mock_agent_response("info")
agent_info["racksdb"]["enabled"] = False
agent_info["racksdb"]["version"] = "0.3.0"
# Version of RacksDB is not supported and it is also disabled. No error log
# must be emitted in this case. Note that assertNoLogs is available starting
# from Python 3.10. For versions below, absence of logs is not checked.
if sys.version_info < (3, 10):
agents = self.app.agents
else:
with self.assertNoLogs("slurmweb", level="ERROR"):
agents = self.app.agents
# Check presence of cluster name returned by agent in agents dict property.
self.assertIn(agent_info["cluster"], agents)

@mock.patch("slurmweb.apps.gateway.requests.get")
def test_agents_json_error(self, mock_requests_get):
_, mock_requests_get.return_value = fake_text_response()
Expand Down

0 comments on commit 4aa1692

Please sign in to comment.