diff mbox series

[bitbake-devel,2.0] hashserv: tests: Omit client in slow server start test

Message ID 20241010145955.1220836-1-JPEWhacker@gmail.com
State New
Headers show
Series [bitbake-devel,2.0] hashserv: tests: Omit client in slow server start test | expand

Commit Message

Joshua Watt Oct. 10, 2024, 2:59 p.m. UTC
On Fedora 39 and Fedora 40 hosts, this version of the hash server
exhibits different behavior on exit when using Unix Domain sockets.
Instead of closing the client connections and exiting immediately, the
server will wait until all clients have disconnected before exiting. It
is unknown why this changed, or why it only affects Unix Domain sockets
and not TCP sockets.

Because of this behavior change, the Slow Server Start test is failing
on these hosts. This test is primarily concerned with ensuring that the
server will actually exit, even if it gets a termination signal before
it enters its main loop, and doesn't really care about clients. As such,
modify the test so that a client is not pre-connected to the server.
This allows the server to actually exit so that the test can verify the
signal behavior.

The latest version of the hash equivalence server (on master) does not
exhibit this behavior. Speculation is that the more standardized usage
of asyncio allows the server to properly exit, even if clients are still
connected. Regardless, this patch is only intended for the older
versions, and should not be applied to master

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 bitbake/lib/hashserv/tests.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/bitbake/lib/hashserv/tests.py b/bitbake/lib/hashserv/tests.py
index f6b85aed85a..07e1c30a338 100644
--- a/bitbake/lib/hashserv/tests.py
+++ b/bitbake/lib/hashserv/tests.py
@@ -30,7 +30,7 @@  class HashEquivalenceTestSetup(object):
 
     server_index = 0
 
-    def start_server(self, dbpath=None, upstream=None, read_only=False, prefunc=server_prefunc):
+    def start_server(self, dbpath=None, upstream=None, read_only=False, prefunc=server_prefunc, need_client=True):
         self.server_index += 1
         if dbpath is None:
             dbpath = os.path.join(self.temp_dir.name, "db%d.sqlite" % self.server_index)
@@ -54,8 +54,11 @@  class HashEquivalenceTestSetup(object):
         def cleanup_client(client):
             client.close()
 
-        client = create_client(server.address)
-        self.addCleanup(cleanup_client, client)
+        if need_client:
+            client = create_client(server.address)
+            self.addCleanup(cleanup_client, client)
+        else:
+            client = None
 
         return (client, server)
 
@@ -341,7 +344,7 @@  class HashEquivalenceCommonTests(object):
         old_signal = signal.signal(signal.SIGTERM, do_nothing)
         self.addCleanup(signal.signal, signal.SIGTERM, old_signal)
 
-        _, server = self.start_server(prefunc=prefunc)
+        _, server = self.start_server(prefunc=prefunc, need_client=False)
         server.process.terminate()
         time.sleep(30)
         event.set()