]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Declare variable outside loop to clarify that its use extends beyond loop
authorJosh Soref <2119212+jsoref@users.noreply.github.com>
Thu, 13 Nov 2025 15:04:54 +0000 (10:04 -0500)
committerJosh Soref <2119212+jsoref@users.noreply.github.com>
Thu, 13 Nov 2025 15:04:54 +0000 (10:04 -0500)
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
regression-tests.dnsdist/test_HealthChecks.py

index 4e74281bb8bf30177ef0a8455b3f9e6887fc34c0..5a4e958e5400a201754cc1101409c5328897bad0 100644 (file)
@@ -471,9 +471,11 @@ class TestUpdateHCParamsCombo1(HealthCheckUpdateParams):
         self.setDrop()
 
         # wait for 1st failure
-        for i in [1,2,3]:
+        i = 1
+        while i <= 3:
             rc = self.wait1()
             if rc is False: break
+            i += 1
         self.assertGreater(3, i)
         time.sleep(1.1)
         # should have failures but still up
@@ -490,9 +492,11 @@ class TestUpdateHCParamsCombo1(HealthCheckUpdateParams):
         self.setDrop(False)
 
         # wait for 1st success
-        for i in [1,2,3]:
+        i = 1
+        while i <= 3:
             rc = self.wait1()
             if rc is True: break
+            i += 1
         self.assertGreater(3, i)
         time.sleep(0.1)
         # still down
@@ -540,9 +544,11 @@ class TestUpdateHCParamsCombo2(HealthCheckUpdateParams):
         self.setDrop()
 
         # wait for 1st failure
-        for i in [1,2,3]:
+        i = 1
+        while i <= 3:
             rc = self.wait1()
             if rc is False: break
+            i += 1
         self.assertGreater(3, i)
 
         beforeFailure = self.getBackendMetric(0, 'healthCheckFailures')