]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
suite/util: list_lock() once for get_arch()
authorKyr Shatskyy <kyrylo.shatskyy@clyso.com>
Tue, 6 Aug 2024 22:54:00 +0000 (00:54 +0200)
committerKyr Shatskyy <kyrylo.shatskyy@clyso.com>
Tue, 6 Aug 2024 23:50:21 +0000 (01:50 +0200)
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 <kyrylo.shatskyy@clyso.com>
teuthology/suite/test/test_util.py
teuthology/suite/util.py

index 20a7dcc885c1dde094df1ab79190bb676e2188a7..daa583023bcd8ed9a897d640c25be6626f05fcd1 100644 (file)
@@ -103,7 +103,7 @@ Branch 'no-branch' not found in repo: https://github.com/ceph/ceph-ci.git!"
     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):
@@ -111,7 +111,7 @@ Branch 'no-branch' not found in repo: https://github.com/ceph/ceph-ci.git!"
         result = util.get_arch('magna')
         m_query.list_locks.assert_called_with(
             machine_type="magna",
-            count=1
+            count=1, tries=1
         )
         assert result == "arch"
 
index 8999f9eafc7eab27af499525cfc4fee1803f3ac7..db0cf11cb2af343ca55b44a470b416bce5ecaa2c 100644 (file)
@@ -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: