Skip to content

Commit d046cea

Browse files
sowmya-jaxlsowmyasudhasinghabhinavsingh
authored
[Windows] --threaded mode integration tests works locally but fails on GHA (#1009)
* Enable remote threadless and threaded integration test for windows * Run only threaded on windows * Use powershell for execution of integration script on Windows * Update test_integration.py * Update test_integration.py Co-authored-by: sowmyasudhasingh <[email protected]> Co-authored-by: Abhinav Singh <[email protected]>
1 parent f7b9458 commit d046cea

File tree

1 file changed

+66
-37
lines changed

1 file changed

+66
-37
lines changed

tests/integration/test_integration.py

Lines changed: 66 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@
1616
import subprocess
1717

1818
from pathlib import Path
19-
from typing import Any, Generator
20-
from subprocess import Popen, check_output
19+
from typing import Any, Generator, List
20+
from subprocess import Popen, check_output as _check_output
2121

2222
from proxy.common.constants import IS_WINDOWS
2323

2424

25+
def check_output(args: List[Any]) -> bytes:
26+
args = args if not IS_WINDOWS else ['powershell'] + args
27+
return _check_output(args)
28+
29+
2530
def _https_server_flags() -> str:
2631
return ' '.join((
2732
'--key-file', 'https-key.pem',
@@ -37,56 +42,80 @@ def _tls_interception_flags(ca_cert_suffix: str = '') -> str:
3742
))
3843

3944

40-
PROXY_PY_FLAGS_INTEGRATION = (
41-
('--threadless'),
42-
('--threadless --local-executor 0'),
45+
_PROXY_PY_FLAGS_INTEGRATION = [
4346
('--threaded'),
44-
)
45-
46-
PROXY_PY_HTTPS = (
47-
('--threadless ' + _https_server_flags()),
48-
('--threadless --local-executor 0 ' + _https_server_flags()),
47+
]
48+
if not IS_WINDOWS:
49+
_PROXY_PY_FLAGS_INTEGRATION += [
50+
('--threadless --local-executor 0'),
51+
('--threadless'),
52+
]
53+
PROXY_PY_FLAGS_INTEGRATION = tuple(_PROXY_PY_FLAGS_INTEGRATION)
54+
55+
_PROXY_PY_HTTPS = [
4956
('--threaded ' + _https_server_flags()),
50-
)
51-
52-
PROXY_PY_FLAGS_TLS_INTERCEPTION = (
53-
('--threadless ' + _tls_interception_flags()),
54-
('--threadless --local-executor 0 ' + _tls_interception_flags()),
57+
]
58+
if not IS_WINDOWS:
59+
_PROXY_PY_HTTPS += [
60+
('--threadless --local-executor 0 ' + _https_server_flags()),
61+
('--threadless ' + _https_server_flags()),
62+
]
63+
PROXY_PY_HTTPS = tuple(_PROXY_PY_HTTPS)
64+
65+
_PROXY_PY_FLAGS_TLS_INTERCEPTION = [
5566
('--threaded ' + _tls_interception_flags()),
56-
)
57-
58-
PROXY_PY_FLAGS_MODIFY_CHUNK_RESPONSE_PLUGIN = (
59-
(
60-
'--threadless --plugin proxy.plugin.ModifyChunkResponsePlugin ' +
61-
_tls_interception_flags('-chunk')
62-
),
63-
(
64-
'--threadless --local-executor 0 --plugin proxy.plugin.ModifyChunkResponsePlugin ' +
65-
_tls_interception_flags('-chunk')
66-
),
67+
]
68+
if not IS_WINDOWS:
69+
_PROXY_PY_FLAGS_TLS_INTERCEPTION += [
70+
('--threadless --local-executor 0 ' + _tls_interception_flags()),
71+
('--threadless ' + _tls_interception_flags()),
72+
]
73+
PROXY_PY_FLAGS_TLS_INTERCEPTION = tuple(_PROXY_PY_FLAGS_TLS_INTERCEPTION)
74+
75+
_PROXY_PY_FLAGS_MODIFY_CHUNK_RESPONSE_PLUGIN = [
6776
(
6877
'--threaded --plugin proxy.plugin.ModifyChunkResponsePlugin ' +
6978
_tls_interception_flags('-chunk')
7079
),
80+
]
81+
if not IS_WINDOWS:
82+
_PROXY_PY_FLAGS_MODIFY_CHUNK_RESPONSE_PLUGIN += [
83+
(
84+
'--threadless --local-executor 0 --plugin proxy.plugin.ModifyChunkResponsePlugin ' +
85+
_tls_interception_flags('-chunk')
86+
),
87+
(
88+
'--threadless --plugin proxy.plugin.ModifyChunkResponsePlugin ' +
89+
_tls_interception_flags('-chunk')
90+
),
91+
]
92+
PROXY_PY_FLAGS_MODIFY_CHUNK_RESPONSE_PLUGIN = tuple(
93+
_PROXY_PY_FLAGS_MODIFY_CHUNK_RESPONSE_PLUGIN,
7194
)
7295

73-
PROXY_PY_FLAGS_MODIFY_POST_DATA_PLUGIN = (
74-
(
75-
'--threadless --plugin proxy.plugin.ModifyPostDataPlugin ' +
76-
_tls_interception_flags('-post')
77-
),
78-
(
79-
'--threadless --local-executor 0 --plugin proxy.plugin.ModifyPostDataPlugin ' +
80-
_tls_interception_flags('-post')
81-
),
96+
_PROXY_PY_FLAGS_MODIFY_POST_DATA_PLUGIN = [
8297
(
8398
'--threaded --plugin proxy.plugin.ModifyPostDataPlugin ' +
8499
_tls_interception_flags('-post')
85100
),
101+
]
102+
if not IS_WINDOWS:
103+
_PROXY_PY_FLAGS_MODIFY_POST_DATA_PLUGIN += [
104+
(
105+
'--threadless --local-executor 0 --plugin proxy.plugin.ModifyPostDataPlugin ' +
106+
_tls_interception_flags('-post')
107+
),
108+
(
109+
'--threadless --plugin proxy.plugin.ModifyPostDataPlugin ' +
110+
_tls_interception_flags('-post')
111+
),
112+
]
113+
PROXY_PY_FLAGS_MODIFY_POST_DATA_PLUGIN = tuple(
114+
_PROXY_PY_FLAGS_MODIFY_POST_DATA_PLUGIN,
86115
)
87116

88117

89-
@pytest.fixture(scope='session', autouse=True) # type: ignore[misc]
118+
@pytest.fixture(scope='session', autouse=not IS_WINDOWS) # type: ignore[misc]
90119
def _gen_https_certificates(request: Any) -> None:
91120
check_output([
92121
'make', 'https-certificates',
@@ -96,7 +125,7 @@ def _gen_https_certificates(request: Any) -> None:
96125
])
97126

98127

99-
@pytest.fixture(scope='session', autouse=True) # type: ignore[misc]
128+
@pytest.fixture(scope='session', autouse=not IS_WINDOWS) # type: ignore[misc]
100129
def _gen_ca_certificates(request: Any) -> None:
101130
check_output([
102131
'make', 'ca-certificates',

0 commit comments

Comments
 (0)