Skip more network-based tests

Some tests failed while building under RHEL 9 with the stricter network
configuration in mock.

Resolves: RHEL-12339

Signed-off-by: Major Hayden <major@redhat.com>
This commit is contained in:
Major Hayden 2024-02-02 09:57:30 -06:00
parent ed080ae621
commit c73197d6c1
No known key found for this signature in database
4 changed files with 93 additions and 50 deletions

View File

@ -0,0 +1,90 @@
From 21a2d3423786a0d2b0c426417e4450378b607f8c Mon Sep 17 00:00:00 2001
From: Major Hayden <major@redhat.com>
Date: Fri, 2 Feb 2024 10:11:44 -0600
Subject: [PATCH] Skip tests which require networking
Signed-off-by: Major Hayden <major@redhat.com>
---
test/test_eventstream_rpc.py | 4 ++--
test/test_http_client.py | 2 ++
test/test_io.py | 1 +
test/test_websocket.py | 2 ++
4 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/test/test_eventstream_rpc.py b/test/test_eventstream_rpc.py
index 35ddac1..700bac5 100644
--- a/test/test_eventstream_rpc.py
+++ b/test/test_eventstream_rpc.py
@@ -12,7 +12,7 @@ from queue import Queue
from test import NativeResourceTest, TIMEOUT
from threading import Event
import time
-from unittest import skipUnless
+from unittest import skip, skipUnless
from uuid import UUID, uuid4
import weakref
@@ -91,7 +91,7 @@ class ContinuationHandler(ClientContinuationHandler):
self.fail_test("shutdown can only fire once")
self.record.close_call.set()
-
+@skip("Requires network")
class FailureClientTests(NativeResourceTest):
def _fail_test_from_callback(self, msg):
print("ERROR FROM CALLBACK", msg)
diff --git a/test/test_http_client.py b/test/test_http_client.py
index 5af87b6..4744dec 100644
--- a/test/test_http_client.py
+++ b/test/test_http_client.py
@@ -114,6 +114,7 @@ class TestClient(NativeResourceTest):
def test_connect_http(self):
self._test_connect(secure=False)
+ @unittest.skip("Requires network")
def test_connect_https(self):
self._test_connect(secure=True)
@@ -347,6 +348,7 @@ class TestClient(NativeResourceTest):
tls_connection_options=tls_conn_opt)
return connection_future.result(self.timeout)
+ @unittest.skip("Requires network")
def test_h2_client(self):
url = urlparse("https://d1cz66xoahf9cl.cloudfront.net/http_test_doc.txt")
connection = self._new_h2_client_connection(url)
diff --git a/test/test_io.py b/test/test_io.py
index d841c04..8b0f228 100644
--- a/test/test_io.py
+++ b/test/test_io.py
@@ -9,6 +9,7 @@ import sys
import unittest
+@unittest.skip("Requires network")
class EventLoopGroupTest(NativeResourceTest):
def test_init_defaults(self):
event_loop_group = EventLoopGroup()
diff --git a/test/test_websocket.py b/test/test_websocket.py
index 17de0a9..860d434 100644
--- a/test/test_websocket.py
+++ b/test/test_websocket.py
@@ -17,6 +17,7 @@ from test import NativeResourceTest
import threading
from time import sleep, time
from typing import Optional
+import unittest
# using a 3rdparty websocket library for the server
import websockets.server as websockets_server_3rdparty
@@ -491,6 +492,7 @@ class TestClient(NativeResourceTest):
self.assertIsNone(handler.exception)
+ @unittest.skip("Requires network")
def test_exception_from_incoming_frame_callback_closes_websocket(self):
# loop 3 times, once for each type of on_incoming_frame_X callback
for i in ('begin', 'payload', 'complete'):
--
2.43.0

View File

@ -16,11 +16,8 @@ URL: https://github.com/awslabs/aws-crt-python
Source0: %{pypi_source awscrt}
# one test requires internet connection, skip it
Patch1: skip-test-requiring-network.patch
# Websocket test requires network connectivity.
Patch2: skip-websocket-test.patch
# Some tests require networking and/or open sockets.
Patch0: 0001-Skip-tests-which-require-networking.patch
BuildRequires: python%{python3_pkgversion}-devel
@ -71,7 +68,7 @@ export AWS_CRT_BUILD_USE_SYSTEM_LIBCRYPTO=1
%check
PYTHONPATH="%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}" %{python3} -m unittest
PYTHONPATH="%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}" %{python3} -m unittest discover --failfast --verbose
%files -n python%{python3_pkgversion}-awscrt -f %{pyproject_files}

View File

@ -1,12 +0,0 @@
diff --git a/test/test_http_client.py b/test/test_http_client.py
index 5af87b6..dd2631a 100644
--- a/test/test_http_client.py
+++ b/test/test_http_client.py
@@ -347,6 +347,7 @@ class TestClient(NativeResourceTest):
tls_connection_options=tls_conn_opt)
return connection_future.result(self.timeout)
+ @unittest.skip("Requires network")
def test_h2_client(self):
url = urlparse("https://d1cz66xoahf9cl.cloudfront.net/http_test_doc.txt")
connection = self._new_h2_client_connection(url)

View File

@ -1,32 +0,0 @@
From fc55d90042f7389d81bd4592a20f1e93cf20e795 Mon Sep 17 00:00:00 2001
From: Major Hayden <major@redhat.com>
Date: Wed, 31 Jan 2024 16:24:32 -0600
Subject: [PATCH] Skip websocket test
---
test/test_websocket.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/test/test_websocket.py b/test/test_websocket.py
index 17de0a9..860d434 100644
--- a/test/test_websocket.py
+++ b/test/test_websocket.py
@@ -17,6 +17,7 @@ from test import NativeResourceTest
import threading
from time import sleep, time
from typing import Optional
+import unittest
# using a 3rdparty websocket library for the server
import websockets.server as websockets_server_3rdparty
@@ -491,6 +492,7 @@ class TestClient(NativeResourceTest):
self.assertIsNone(handler.exception)
+ @unittest.skip("Requires network")
def test_exception_from_incoming_frame_callback_closes_websocket(self):
# loop 3 times, once for each type of on_incoming_frame_X callback
for i in ('begin', 'payload', 'complete'):
--
2.43.0