]> www.average.org Git - loctrkd.git/blobdiff - test/test_fuzz.py
opencellid: use temp table rather than memory db
[loctrkd.git] / test / test_fuzz.py
index 6be5348394c2ff666973d2dfcc3356cc146a75f6..ecedb2ae6dc34c4c4320ac95488c5170cdbcbdb0 100644 (file)
@@ -1,8 +1,9 @@
 """ Send junk to the collector """
 
 from random import Random
-from socket import getaddrinfo, socket, AF_INET6, SOCK_STREAM
+from socket import getaddrinfo, socket, AF_INET, SOCK_STREAM
 from time import sleep
+from typing import Any
 import unittest
 from .common import send_and_drain, TestWithServers
 
@@ -10,24 +11,24 @@ REPEAT: int = 1000000
 
 
 class Fuzz(TestWithServers):
-    def setUp(self, *args: str) -> None:
+    def setUp(self, *args: str, **kwargs: Any) -> None:
         super().setUp("collector")
         self.rnd = Random()
         for fam, typ, pro, cnm, skadr in getaddrinfo(
-            "::1",
+            "127.0.0.1",
             self.conf.getint("collector", "port"),
-            family=AF_INET6,
+            family=AF_INET,
             type=SOCK_STREAM,
         ):
             break  # Just take the first element
-        self.sock = socket(AF_INET6, SOCK_STREAM)
+        self.sock = socket(AF_INET, SOCK_STREAM)
         self.sock.connect(skadr)
 
     def tearDown(self) -> None:
         sleep(1)  # give collector some time
         send_and_drain(self.sock, None)
         self.sock.close()
-        print("finished fuzzing")
+        sleep(1)  # Let the server close their side
         super().tearDown()
 
     def test_stream(self) -> None: