]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Use map (and KeyError) to avoid warning about mixed explicit/implicit returns
authorJosh Soref <2119212+jsoref@users.noreply.github.com>
Sun, 9 Nov 2025 16:54:35 +0000 (11:54 -0500)
committerJosh Soref <2119212+jsoref@users.noreply.github.com>
Sun, 9 Nov 2025 16:54:35 +0000 (11:54 -0500)
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
regression-tests.dnsdist/test_DOH.py

index a7429bf00515788f8031749ff1ba64507ede3070..2ef99f7de2ff75a9b72848a1c72b5d24ce5af339 100644 (file)
@@ -384,17 +384,18 @@ class DOHTests(object):
         except:
             pass
 
+    metricMap = {
+        'connects': 2,
+        'http/1.1': 3,
+        'http/2': 4,
+    }
+
     def getHTTPCounter(self, name):
         lines = self.sendConsoleCommand("showDOHFrontends()").splitlines()
         self.assertEqual(len(lines), 2)
         metrics = lines[1].split()
         self.assertEqual(len(metrics), 15)
-        if name == 'connects':
-            return int(metrics[2])
-        if name == 'http/1.1':
-            return int(metrics[3])
-        if name == 'http/2':
-            return int(metrics[4])
+        return int(metrics[metricMap[name]])
 
     def testDOHHTTP1(self):
         """