]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - regression-tests.dnsdist/test_Carbon.py
Merge pull request #14001 from rgacogne/ddist-ffi-policy-no-server
[thirdparty/pdns.git] / regression-tests.dnsdist / test_Carbon.py
index 4d26c54a3c0d85447379b57b64884ebbff2a262b..d697fc8a1279c88d50878725a0a494bdd55e4d1b 100644 (file)
@@ -3,13 +3,13 @@ import threading
 import socket
 import sys
 import time
-from dnsdisttests import DNSDistTest, Queue
+from dnsdisttests import DNSDistTest, Queue, pickAvailablePort
 
 class TestCarbon(DNSDistTest):
 
-    _carbonServer1Port = 8000
+    _carbonServer1Port = pickAvailablePort()
     _carbonServer1Name = "carbonname1"
-    _carbonServer2Port = 8001
+    _carbonServer2Port = pickAvailablePort()
     _carbonServer2Name = "carbonname2"
     _carbonQueue1 = Queue()
     _carbonQueue2 = Queue()
@@ -53,10 +53,10 @@ class TestCarbon(DNSDistTest):
                 cls._carbonQueue1.put(lines, True, timeout=2.0)
             else:
                 cls._carbonQueue2.put(lines, True, timeout=2.0)
-            if threading.currentThread().name in cls._carbonCounters:
-                cls._carbonCounters[threading.currentThread().name] += 1
+            if threading.current_thread().name in cls._carbonCounters:
+                cls._carbonCounters[threading.current_thread().name] += 1
             else:
-                cls._carbonCounters[threading.currentThread().name] = 1
+                cls._carbonCounters[threading.current_thread().name] = 1
 
             conn.close()
         sock.close()
@@ -64,11 +64,11 @@ class TestCarbon(DNSDistTest):
     @classmethod
     def startResponders(cls):
         cls._CarbonResponder1 = threading.Thread(name='Carbon Responder 1', target=cls.CarbonResponder, args=[cls._carbonServer1Port])
-        cls._CarbonResponder1.setDaemon(True)
+        cls._CarbonResponder1.daemon = True
         cls._CarbonResponder1.start()
 
         cls._CarbonResponder2 = threading.Thread(name='Carbon Responder 2', target=cls.CarbonResponder, args=[cls._carbonServer2Port])
-        cls._CarbonResponder2.setDaemon(True)
+        cls._CarbonResponder2.daemon = True
         cls._CarbonResponder2.start()
 
     def isfloat(self, num):