Skip to content

Commit

Permalink
suite/util: list_lock() once for get_arch()
Browse files Browse the repository at this point in the history
We only want to try to list_locks() for getting arch by
machine_type when scheduling a suite. Otherwise we've
got into an infinite loop and console log flooded
with useless error messages.

Signed-off-by: Kyr Shatskyy <[email protected]>
  • Loading branch information
Kyr Shatskyy committed Aug 6, 2024
1 parent 7f1968c commit 5836ffe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions teuthology/suite/test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ def test_get_branch_info(self, m_get):
def test_get_arch_fail(self, m_query):
m_query.list_locks.return_value = False
util.get_arch('magna')
m_query.list_locks.assert_called_with(machine_type="magna", count=1)
m_query.list_locks.assert_called_with(machine_type="magna", count=1, tries=1)

@patch('teuthology.lock.query')
def test_get_arch_success(self, m_query):
m_query.list_locks.return_value = [{"arch": "arch"}]
result = util.get_arch('magna')
m_query.list_locks.assert_called_with(
machine_type="magna",
count=1
count=1, tries=1
)
assert result == "arch"

Expand Down
2 changes: 1 addition & 1 deletion teuthology/suite/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def get_arch(machine_type):
:returns: A string or None
"""
result = teuthology.lock.query.list_locks(machine_type=machine_type, count=1)
result = teuthology.lock.query.list_locks(machine_type=machine_type, count=1, tries=1)
if not result:
log.warning("No machines found with machine_type %s!", machine_type)
else:
Expand Down

0 comments on commit 5836ffe

Please sign in to comment.