10
10
11
11
Test the simplest proxy use scenario for smoke.
12
12
"""
13
+ import sys
13
14
import time
14
15
import pytest
15
16
import tempfile
@@ -89,7 +90,9 @@ def proxy_py_subprocess(request: Any) -> Generator[int, None, None]:
89
90
90
91
After the testing is over, tear it down.
91
92
"""
92
- port_file = Path (tempfile .gettempdir ()) / 'proxy.port'
93
+ temp_dir = Path (tempfile .gettempdir ())
94
+ port_file = temp_dir / 'proxy.port'
95
+ ca_cert_dir = temp_dir / ('certificates-%s' % int (time .time ()))
93
96
proxy_cmd = (
94
97
'python' , '-m' , 'proxy' ,
95
98
'--hostname' , '127.0.0.1' ,
@@ -98,6 +101,8 @@ def proxy_py_subprocess(request: Any) -> Generator[int, None, None]:
98
101
'--enable-web-server' ,
99
102
'--num-acceptors' , '3' ,
100
103
'--num-workers' , '3' ,
104
+ '--ca-cert-dir' , str (ca_cert_dir ),
105
+ '--log-level' , 'd' ,
101
106
) + tuple (request .param .split ())
102
107
proxy_proc = Popen (proxy_cmd )
103
108
# Needed because port file might not be available immediately
@@ -148,21 +153,25 @@ def test_integration_with_interception_flags(proxy_py_subprocess: int) -> None:
148
153
check_output ([str (shell_script_test ), str (proxy_py_subprocess )])
149
154
150
155
151
- # @pytest.mark.smoke # type: ignore[misc]
152
- # @pytest.mark.parametrize(
153
- # 'proxy_py_subprocess',
154
- # PROXY_PY_FLAGS_MODIFY_CHUNK_RESPONSE_PLUGIN,
155
- # indirect=True,
156
- # ) # type: ignore[misc]
157
- # @pytest.mark.skipif(
158
- # IS_WINDOWS,
159
- # reason='OSError: [WinError 193] %1 is not a valid Win32 application',
160
- # ) # type: ignore[misc]
161
- # def test_modify_chunk_response_integration(proxy_py_subprocess: int) -> None:
162
- # """An acceptance test for :py:class:`~proxy.plugin.ModifyChunkResponsePlugin`
163
- # interception using ``curl`` through proxy.py."""
164
- # shell_script_test = Path(__file__).parent / 'test_modify_chunk_response.sh'
165
- # check_output([str(shell_script_test), str(proxy_py_subprocess)])
156
+ @pytest .mark .smoke # type: ignore[misc]
157
+ @pytest .mark .parametrize (
158
+ 'proxy_py_subprocess' ,
159
+ PROXY_PY_FLAGS_MODIFY_CHUNK_RESPONSE_PLUGIN ,
160
+ indirect = True ,
161
+ ) # type: ignore[misc]
162
+ @pytest .mark .skipif (
163
+ IS_WINDOWS ,
164
+ reason = 'OSError: [WinError 193] %1 is not a valid Win32 application' ,
165
+ ) # type: ignore[misc]
166
+ @pytest .mark .skipif (
167
+ sys .version_info < (3 , 10 ),
168
+ reason = 'For version < 3.10, GHA integration run into OSError when flushing to clients' ,
169
+ ) # type: ignore[misc]
170
+ def test_modify_chunk_response_integration (proxy_py_subprocess : int ) -> None :
171
+ """An acceptance test for :py:class:`~proxy.plugin.ModifyChunkResponsePlugin`
172
+ interception using ``curl`` through proxy.py."""
173
+ shell_script_test = Path (__file__ ).parent / 'test_modify_chunk_response.sh'
174
+ check_output ([str (shell_script_test ), str (proxy_py_subprocess )])
166
175
167
176
168
177
@pytest .mark .smoke # type: ignore[misc]
0 commit comments