diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2023-11-03 08:26:20 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-11-09 17:33:02 +0000 |
commit | 2484bd893189bc24ac210edf2de3b7e1115eebd3 (patch) | |
tree | be9433e53a5bb645816f5b78730830a73bc6ee10 /bitbake/lib/hashserv/tests.py | |
parent | 8f8501ed403dec27acbe780b936bc087fc5006d0 (diff) | |
download | poky-2484bd893189bc24ac210edf2de3b7e1115eebd3.tar.gz |
bitbake: hashserv: Add websocket connection implementation
Adds support to the hash equivalence client and server to communicate
over websockets. Since websockets are message orientated instead of
stream orientated, and new connection class is needed to handle them.
Note that websocket support does require the 3rd party websockets python
module be installed on the host, but it should not be required unless
websockets are actually being used.
(Bitbake rev: 56dd2fdbfb6350a9eef43a12aa529c8637887a7e)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/hashserv/tests.py')
-rw-r--r-- | bitbake/lib/hashserv/tests.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bitbake/lib/hashserv/tests.py b/bitbake/lib/hashserv/tests.py index f343c586b5..01ffd52c1d 100644 --- a/bitbake/lib/hashserv/tests.py +++ b/bitbake/lib/hashserv/tests.py | |||
@@ -483,3 +483,20 @@ class TestHashEquivalenceTCPServer(HashEquivalenceTestSetup, HashEquivalenceComm | |||
483 | # If IPv6 is enabled, it should be safe to use localhost directly, in general | 483 | # If IPv6 is enabled, it should be safe to use localhost directly, in general |
484 | # case it is more reliable to resolve the IP address explicitly. | 484 | # case it is more reliable to resolve the IP address explicitly. |
485 | return socket.gethostbyname("localhost") + ":0" | 485 | return socket.gethostbyname("localhost") + ":0" |
486 | |||
487 | |||
488 | class TestHashEquivalenceWebsocketServer(HashEquivalenceTestSetup, HashEquivalenceCommonTests, unittest.TestCase): | ||
489 | def setUp(self): | ||
490 | try: | ||
491 | import websockets | ||
492 | except ImportError as e: | ||
493 | self.skipTest(str(e)) | ||
494 | |||
495 | super().setUp() | ||
496 | |||
497 | def get_server_addr(self, server_idx): | ||
498 | # Some hosts cause asyncio module to misbehave, when IPv6 is not enabled. | ||
499 | # If IPv6 is enabled, it should be safe to use localhost directly, in general | ||
500 | # case it is more reliable to resolve the IP address explicitly. | ||
501 | host = socket.gethostbyname("localhost") | ||
502 | return "ws://%s:0" % host | ||