Skip to content

Commit 971161e

Browse files
authored
Localhost test mac (#398)
- for some reason the mac local host test was flaky on Mac. - Looked into the log, seems like the server rejected the connection. I guess it could be too many concurrent connections were opened? - Try to lower the number of connections open concurrently
1 parent 2c5a2a7 commit 971161e

File tree

2 files changed

+23
-32
lines changed

2 files changed

+23
-32
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,21 @@ jobs:
155155
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
156156
python3 builder.pyz build -p aws-c-http --cmake-extra=-DENABLE_LOCALHOST_INTEGRATION_TESTS=ON
157157
158-
# localhost tests are flaky on mac. disable for now, put fixing it in backlog
159-
# localhost-test-mac:
160-
# runs-on: macos-11 # latest
161-
# steps:
162-
# - name: Checkout
163-
# uses: actions/checkout@v3
164-
# - name: Configure local host
165-
# run: |
166-
# python3 -m pip install h2
167-
# cd ./tests/py_localhost/
168-
# python3 server.py &
169-
# python3 non_tls_server.py &
170-
# - name: Build and test
171-
# run: |
172-
# python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
173-
# python3 builder.pyz build -p aws-c-http --cmake-extra=-DENABLE_LOCALHOST_INTEGRATION_TESTS=ON
158+
localhost-test-mac:
159+
runs-on: macos-11 # latest
160+
steps:
161+
- name: Checkout
162+
uses: actions/checkout@v3
163+
- name: Configure local host
164+
run: |
165+
python3 -m pip install h2
166+
cd ./tests/py_localhost/
167+
python3 server.py &
168+
python3 non_tls_server.py &
169+
- name: Build and test
170+
run: |
171+
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
172+
python3 builder.pyz build -p aws-c-http --cmake-extra=-DENABLE_LOCALHOST_INTEGRATION_TESTS=ON
174173
175174
localhost-test-win:
176175
runs-on: windows-2022 # latest

tests/test_stream_manager.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,12 +1311,12 @@ TEST_CASE(localhost_integ_h2_sm_acquire_stream_stress) {
13111311
(void)ctx;
13121312
struct aws_byte_cursor uri_cursor = aws_byte_cursor_from_c_str("https://localhost:8443/echo");
13131313
struct aws_http_connection_monitoring_options monitor_opt = {
1314-
.allowable_throughput_failure_interval_seconds = 1,
1314+
.allowable_throughput_failure_interval_seconds = 2,
13151315
.minimum_throughput_bytes_per_second = 1000,
13161316
};
13171317
enum aws_log_level log_level = AWS_LOG_LEVEL_DEBUG;
13181318
struct sm_tester_options options = {
1319-
.max_connections = 100,
1319+
.max_connections = 50,
13201320
.max_concurrent_streams_per_connection = 100,
13211321
.connection_ping_period_ms = 100 * AWS_TIMESTAMP_MILLIS,
13221322
.alloc = allocator,
@@ -1325,11 +1325,11 @@ TEST_CASE(localhost_integ_h2_sm_acquire_stream_stress) {
13251325
.log_level = &log_level,
13261326
};
13271327
ASSERT_SUCCESS(s_tester_init(&options));
1328-
int num_to_acquire = 500 * 100;
1329-
ASSERT_SUCCESS(s_sm_stream_acquiring(num_to_acquire));
1328+
size_t num_to_acquire = 500 * 100;
1329+
ASSERT_SUCCESS(s_sm_stream_acquiring((int)num_to_acquire));
13301330
ASSERT_SUCCESS(s_wait_on_streams_completed_count(num_to_acquire));
1331-
ASSERT_TRUE((int)s_tester.acquiring_stream_errors == 0);
1332-
ASSERT_TRUE((int)s_tester.stream_200_count == num_to_acquire);
1331+
ASSERT_UINT_EQUALS(s_tester.acquiring_stream_errors, 0);
1332+
ASSERT_UINT_EQUALS(s_tester.stream_200_count, num_to_acquire);
13331333

13341334
return s_tester_clean_up();
13351335
}
@@ -1410,18 +1410,10 @@ TEST_CASE(localhost_integ_h2_sm_acquire_stream_stress_with_body) {
14101410
s_tester.length_sent = 2000;
14111411
int num_to_acquire = 500 * 100;
14121412

1413-
#ifdef AWS_OS_LINUX
1414-
/* Using Python hyper h2 server frame work, met a weird upload performance issue on Linux. Our client against nginx
1415-
* platform has not met the same issue. We assume it's because the server framework implementation. Use lower
1416-
* number of linux
1417-
*/
1418-
num_to_acquire = 500;
1419-
#endif
1420-
14211413
ASSERT_SUCCESS(s_sm_stream_acquiring_with_body(num_to_acquire));
14221414
ASSERT_SUCCESS(s_wait_on_streams_completed_count(num_to_acquire));
1423-
ASSERT_TRUE((int)s_tester.acquiring_stream_errors == 0);
1424-
ASSERT_TRUE((int)s_tester.stream_200_count == num_to_acquire);
1415+
ASSERT_UINT_EQUALS(s_tester.acquiring_stream_errors, 0);
1416+
ASSERT_UINT_EQUALS(s_tester.stream_200_count, num_to_acquire);
14251417

14261418
return s_tester_clean_up();
14271419
}

0 commit comments

Comments
 (0)