Skip to content

Commit 0270426

Browse files
azure-sdkscbedd
andauthored
Sync eng/common directory with azure-sdk-tools for PR 2758 (Azure#23068)
* tooling updates. allow install but no run of test proxy, prepending the path properly, etc * test updates for parallel invocation of test-proxy Co-authored-by: scbedd <[email protected]>
1 parent a6044db commit 0270426

File tree

11 files changed

+177
-63
lines changed

11 files changed

+177
-63
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pylint-*.out.txt
4444
coverage-*.xml
4545
stderr.txt
4646
stdout.txt
47+
_proxy_log_*.log
4748

4849
# tox environment folders
4950
.tox/

.vscode/cspell.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@
110110
"eng/*.txt",
111111
"eng/tox/tox.ini",
112112
"eng/common/docgeneration/Generate-DocIndex.ps1",
113-
"eng/tox/*.py"
113+
"eng/**/*.py",
114+
".gitignore",
115+
114116
],
115117
"words": [
116118
"aad",
@@ -264,7 +266,9 @@
264266
"wfile",
265267
"westus",
266268
"docfx",
267-
"Docfx"
269+
"Docfx",
270+
"azurecr",
271+
"envname"
268272
],
269273
"overrides": [
270274
{

doc/dev/test_proxy_troubleshooting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ the wrong repo.
6161

6262
Try updating your machine's version of Docker. Older versions of Docker may not return a status to indicate whether or
6363
not the proxy container is running, which the
64-
[proxy_docker_startup.py](https://github.com/Azure/azure-sdk-for-python/blob/main/tools/azure-sdk-tools/devtools_testutils/proxy_docker_startup.py)
64+
[proxy_startup.py](https://github.com/Azure/azure-sdk-for-python/blob/main/tools/azure-sdk-tools/devtools_testutils/proxy_startup.py)
6565
script needs to determine.
6666

6767
## ConnectionError during test startup

eng/common/testproxy/docker-start-proxy.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ catch {
3131
Write-Error "Please check your docker invocation and try running the script again."
3232
}
3333

34-
$SELECTED_IMAGE_TAG = "1314089"
34+
$SELECTED_IMAGE_TAG = "1369319"
3535
$CONTAINER_NAME = "ambitious_azsdk_test_proxy"
3636
$LINUX_IMAGE_SOURCE = "azsdkengsys.azurecr.io/engsys/testproxy-lin:${SELECTED_IMAGE_TAG}"
3737
$WINDOWS_IMAGE_SOURCE = "azsdkengsys.azurecr.io/engsys/testproxy-win:${SELECTED_IMAGE_TAG}"
Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,40 @@
11
parameters:
22
rootFolder: '$(Build.SourcesDirectory)'
3+
runProxy: true
34

45
steps:
56
- pwsh: |
67
$(Build.SourcesDirectory)/eng/common/scripts/trust-proxy-certificate.ps1
78
displayName: 'Language Specific Certificate Trust'
89
9-
- pwsh: |
10-
Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Path]$(Build.SourcesDirectory)/eng/common/testproxy/dotnet-devcert.pfx"
11-
Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Password]password"
12-
Write-Host "##vso[task.setvariable variable=PROXY_MANUAL_START]true"
13-
displayName: 'Configure Kestrel and PROXY_MANUAL_START Variables'
14-
1510
- pwsh: |
1611
dotnet tool install azure.sdk.tools.testproxy `
1712
--tool-path $(Build.BinariesDirectory)/test-proxy `
1813
--add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json `
19-
--version 1.0.0-dev.20220119.2
14+
--version 1.0.0-dev.20220210.1
2015
displayName: "Install test-proxy"
2116
2217
- pwsh: |
23-
Start-Process $(Build.BinariesDirectory)/test-proxy/test-proxy.exe `
24-
-ArgumentList "--storage-location ${{ parameters.rootFolder }}" `
25-
-NoNewWindow -PassThru -RedirectStandardOutput $(Build.SourcesDirectory)/test-proxy.log
26-
displayName: 'Run the testproxy - windows'
27-
condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT'))
18+
Write-Host "##vso[task.prependpath]$(Build.BinariesDirectory)/test-proxy"
19+
displayName: "Prepend path with test-proxy tool install location"
20+
21+
- ${{ if eq(parameters.runProxy, 'true') }}:
22+
- pwsh: |
23+
Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Path]$(Build.SourcesDirectory)/eng/common/testproxy/dotnet-devcert.pfx"
24+
Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Password]password"
25+
Write-Host "##vso[task.setvariable variable=PROXY_MANUAL_START]true"
26+
displayName: 'Configure Kestrel and PROXY_MANUAL_START Variables'
27+
28+
- pwsh: |
29+
Start-Process $(Build.BinariesDirectory)/test-proxy/test-proxy.exe `
30+
-ArgumentList "--storage-location ${{ parameters.rootFolder }}" `
31+
-NoNewWindow -PassThru -RedirectStandardOutput $(Build.SourcesDirectory)/test-proxy.log
32+
displayName: 'Run the testproxy - windows'
33+
condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT'))
2834
29-
# nohup does NOT continue beyond the current session if you use it within powershell
30-
- bash: |
31-
nohup $(Build.BinariesDirectory)/test-proxy/test-proxy > $(Build.SourcesDirectory)/test-proxy.log &
32-
displayName: "Run the testproxy - linux/mac"
33-
condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT'))
34-
workingDirectory: "${{ parameters.rootFolder }}"
35+
# nohup does NOT continue beyond the current session if you use it within powershell
36+
- bash: |
37+
nohup $(Build.BinariesDirectory)/test-proxy/test-proxy > $(Build.SourcesDirectory)/test-proxy.log &
38+
displayName: "Run the testproxy - linux/mac"
39+
condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT'))
40+
workingDirectory: "${{ parameters.rootFolder }}"

eng/pipelines/templates/jobs/ci.conda.tests.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,5 +201,10 @@ jobs:
201201
202202
- ${{if eq(parameters.TestProxy, true) }}:
203203
- pwsh: |
204-
cat $(Build.SourcesDirectory)/test-proxy.log
204+
$files = Get-ChildItem -Path $(Build.SourcesDirectory) -Filter _proxy_log_*.log
205+
foreach($file in $files){
206+
Write-Host "##[group]$file"
207+
cat $file
208+
Write-Host "##[endgroup]"
209+
}
205210
displayName: Dump Test-Proxy Logs

eng/pipelines/templates/steps/build-test.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ steps:
4040
4141
- ${{if eq(parameters.TestProxy, true) }}:
4242
- template: /eng/common/testproxy/test-proxy-tool.yml
43+
parameters:
44+
runProxy: false
4345

4446
- ${{if eq(variables['System.TeamProject'], 'internal') }}:
4547
- template: ../steps/auth-dev-feed.yml
@@ -65,7 +67,12 @@ steps:
6567

6668
- ${{if eq(parameters.TestProxy, true) }}:
6769
- pwsh: |
68-
cat $(Build.SourcesDirectory)/test-proxy.log
70+
$files = Get-ChildItem -Path $(Build.SourcesDirectory) -Filter _proxy_log_*.log
71+
foreach($file in $files){
72+
Write-Host "##[group]$file"
73+
cat $file
74+
Write-Host "##[endgroup]"
75+
}
6976
displayName: Dump Test-Proxy Logs
7077
condition: succeededOrFailed()
7178

eng/tox/tox.ini

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ requires=
5757
setenv =
5858
SPHINX_APIDOC_OPTIONS=members,undoc-members,inherited-members
5959
PIP_EXTRA_INDEX_URL=https://pypi.python.org/simple
60+
PROXY_URL=http://localhost:5001
6061
VIRTUALENV_WHEEL=0.37.0
6162
VIRTUALENV_PIP=20.3.3
6263
VIRTUALENV_SETUPTOOLS=59.6.0
@@ -78,6 +79,9 @@ skipsdist = false
7879
skip_install = false
7980
usedevelop = true
8081
changedir = {toxinidir}
82+
setenv =
83+
{[testenv]setenv}
84+
PROXY_URL=http://localhost:5002
8185
deps =
8286
{[base]deps}
8387
-e {toxinidir}/../../scripts/pylint_custom_plugin
@@ -90,6 +94,9 @@ skipsdist = false
9094
skip_install = false
9195
usedevelop = true
9296
changedir = {toxinidir}
97+
setenv =
98+
{[testenv]setenv}
99+
PROXY_URL=http://localhost:5003
93100
deps =
94101
{[base]deps}
95102
mypy==0.782; python_version >= '3.5'
@@ -103,6 +110,9 @@ skip_install = true
103110
changedir = {toxinidir}
104111
deps =
105112
{[base]deps}
113+
setenv =
114+
{[testenv]setenv}
115+
PROXY_URL=http://localhost:5004
106116
commands =
107117
- {envbindir}/python -m pip uninstall aiohttp --yes
108118
{envbindir}/python {toxinidir}/../../../eng/tox/create_package_and_install.py -d {envtmpdir} -p {toxinidir} -w {envtmpdir}
@@ -119,6 +129,9 @@ commands =
119129
skipsdist = true
120130
skip_install = true
121131
changedir = {toxinidir}
132+
setenv =
133+
{[testenv]setenv}
134+
PROXY_URL=http://localhost:5005
122135
deps =
123136
{[base]deps}
124137
commands =
@@ -142,6 +155,9 @@ usedevelop = true
142155
changedir = {toxinidir}
143156
deps =
144157
{[base]deps}
158+
setenv =
159+
{[testenv]setenv}
160+
PROXY_URL=http://localhost:5006
145161
commands =
146162
pytest \
147163
{posargs} \
@@ -154,6 +170,9 @@ skipsdist = false
154170
skip_install = false
155171
changedir = {toxinidir}
156172
passenv = *
173+
setenv =
174+
{[testenv]setenv}
175+
PROXY_URL=http://localhost:5007
157176
deps =
158177
{[base]deps}
159178
sphinx==3.5.4
@@ -178,6 +197,9 @@ platform = linux: linux
178197
macos: darwin
179198
windows: win32
180199
changedir = {toxinidir}
200+
setenv =
201+
{[testenv]setenv}
202+
PROXY_URL=http://localhost:5008
181203
deps =
182204
{[packaging]pkgs}
183205
requests
@@ -197,6 +219,9 @@ commands =
197219
skipsdist = true
198220
skip_install = true
199221
changedir = {toxinidir}
222+
setenv =
223+
{[testenv]setenv}
224+
PROXY_URL=http://localhost:5009
200225
deps =
201226
{[packaging]pkgs}
202227
commands =
@@ -208,6 +233,9 @@ commands =
208233
skipsdist = true
209234
skip_install = true
210235
changedir = {toxinidir}
236+
setenv =
237+
{[testenv]setenv}
238+
PROXY_URL=http://localhost:5010
211239
deps =
212240
{[packaging]pkgs}
213241
commands =
@@ -218,6 +246,9 @@ commands =
218246
[testenv:devtest]
219247
deps = {[base]deps}
220248
changedir = {toxinidir}
249+
setenv =
250+
{[testenv]setenv}
251+
PROXY_URL=http://localhost:5011
221252
commands =
222253
{envbindir}/python {toxinidir}/../../../eng/tox/create_package_and_install.py -d {envtmpdir} -p {toxinidir}
223254
{envbindir}/python {toxinidir}/../../../eng/tox/install_dev_build_dependency.py -t {toxinidir}
@@ -247,6 +278,7 @@ passenv = *
247278
setenv =
248279
{[testenv]setenv}
249280
DEPENDENCY_TYPE=Latest
281+
PROXY_URL=http://localhost:5012
250282
commands =
251283
{[deptestcommands]commands}
252284

@@ -263,6 +295,7 @@ passenv = *
263295
setenv =
264296
{[testenv]setenv}
265297
DEPENDENCY_TYPE=Minimum
298+
PROXY_URL=http://localhost:5013
266299
commands =
267300
{[deptestcommands]commands}
268301

@@ -272,6 +305,9 @@ skipsdist = true
272305
skip_install = true
273306
usedevelop = false
274307
changedir = {envtmpdir}
308+
setenv =
309+
{[testenv]setenv}
310+
PROXY_URL=http://localhost:5014
275311
deps =
276312
{[base]deps}
277313
commands =
@@ -286,6 +322,9 @@ skipsdist = false
286322
skip_install = false
287323
usedevelop = false
288324
changedir = {envtmpdir}
325+
setenv =
326+
{[testenv]setenv}
327+
PROXY_URL=http://localhost:5015
289328
deps =
290329
{[base]deps}
291330
commands =
@@ -298,6 +337,9 @@ skipsdist = false
298337
skip_install = false
299338
usedevelop = false
300339
changedir = {envtmpdir}
340+
setenv =
341+
{[testenv]setenv}
342+
PROXY_URL=http://localhost:5016
301343
deps =
302344
{[base]deps}
303345
subprocess32; python_version < '3.5'
@@ -311,6 +353,9 @@ skipsdist = false
311353
skip_install = false
312354
usedevelop = true
313355
changedir = {toxinidir}
356+
setenv =
357+
{[testenv]setenv}
358+
PROXY_URL=http://localhost:5017
314359
deps =
315360
{[base]deps}
316361
jsondiff==1.2.0

tools/azure-sdk-tools/devtools_testutils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# cSpell:disable
1919
from .envvariable_loader import EnvironmentVariableLoader
2020
PowerShellPreparer = EnvironmentVariableLoader # Backward compat
21-
from .proxy_docker_startup import start_test_proxy, stop_test_proxy, test_proxy
21+
from .proxy_startup import start_test_proxy, stop_test_proxy, test_proxy
2222
from .proxy_testcase import recorded_by_proxy
2323
from .sanitizers import (
2424
add_body_key_sanitizer,

tools/azure-sdk-tools/devtools_testutils/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Licensed under the MIT License. See License.txt in the project root for
44
# license information.
55
# --------------------------------------------------------------------------
6+
import os
67

7-
8-
PROXY_URL = "https://localhost:5001"
8+
PROXY_URL = os.getenv("PROXY_URL", "https://localhost:5001")
99
TEST_SETTING_FILENAME = "testsettings_local.cfg"

0 commit comments

Comments
 (0)