Skip to content

Commit faab016

Browse files
authored
[Release sdk status] adaptation for testproxy (Azure#22460)
* add parameter * trigger swagger pipeline and sheduled trigger * avoid duplicated trigger * debug * debug * debug * debug * debug * optmization * special case * special case * optimize track2 ga version rule * delete upload code * testproxy adaptation * new timeoutlimit
1 parent 2d2efc8 commit faab016

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed

scripts/release_sdk_status/main.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from packaging.version import parse
1515
from pathlib import Path
1616

17+
from util import add_certificate
18+
1719
SERVICE_TEST_PATH = {}
1820
MAIN_REPO_SWAGGER = 'https://github.com/Azure/azure-rest-api-specs/tree/main'
1921
PR_URL = 'https://github.com/Azure/azure-rest-api-specs/pull/'
@@ -184,6 +186,7 @@ def bot_analysis(self):
184186

185187
def sdk_info_from_pypi(sdk_info, cli_dependency):
186188
all_sdk_status = []
189+
add_certificate(str(Path('../venv-sdk/lib/python3.8/site-packages/certifi/cacert.pem')))
187190
for package in sdk_info:
188191
if ',' in package:
189192
package = package.split(',')
@@ -233,11 +236,13 @@ def get_test_result(txt_path):
233236

234237

235238
def run_playback_test(service_name):
239+
if os.getenv('SKIP_COVERAGE') in ('true', 'yes'):
240+
return '-, -, -, -\n'
241+
236242
# eg: coverage_path='$(pwd)/sdk-repo/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/'
237243
coverage_path = ''.join([os.getenv('SDK_REPO'), '/sdk/', SERVICE_TEST_PATH[service_name]])
238244
service_path = coverage_path.split('/azure/mgmt')[0]
239245
test_path = service_path + '/tests'
240-
print(f'****{service_name}*****')
241246
if os.path.exists(test_path):
242247
print_check('pip install -r dev_requirements.txt', path=service_path)
243248
print_check('pip install -e .', path=service_path)
@@ -246,16 +251,17 @@ def run_playback_test(service_name):
246251
operations_path = coverage_path+'/operations'
247252
models_path = coverage_path+'/models'
248253
try:
254+
start_time = int(time.time())
249255
print_check(f'pytest -s tests --cov={operations_path} --cov={models_path} >result.txt', path=service_path)
256+
cost_time = int(time.time()) - start_time
257+
my_print(f'{service_name} play_back cost {cost_time} seconds({cost_time // 60} minutes)')
250258
except Exception as e:
251259
print(f'{service_name} test ERROR')
252260
return '-, 0, 0, 0\n'
253261
else:
254262
try:
255-
print(f'hhh {service_name} no coverage')
256263
print_check(f'pytest -s tests >result.txt', path=service_path)
257264
except Exception as e:
258-
print(f'{service_name} test ERROR')
259265
return '-, 0, 0, 0\n'
260266
if os.path.exists(service_path+'/result.txt'):
261267
return get_test_result(service_path+'/result.txt')

scripts/release_sdk_status/release_sdk_status.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ schedules:
1818
jobs:
1919
- job: ReleaseSdkStatus
2020
displayName: ReleaseSdkStatus Python 3.8
21-
timeoutInMinutes: 30
21+
timeoutInMinutes: 300
2222
strategy:
2323
maxParallel: 1
2424
pool:
@@ -48,6 +48,7 @@ jobs:
4848
export SWAGGER_REPO=$(pwd)/azure-rest-api-specs
4949
export SDK_REPO=$(pwd)/sdk-repo
5050
export AZP_RUN=$(AZP_RUN)
51+
export SKIP_COVERAGE=$(SKIP_COVERAGE)
5152
5253
# create virtual env
5354
python -m venv venv-sdk

scripts/release_sdk_status/util.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
CERTIFICATION = '''
2+
-----BEGIN CERTIFICATE-----
3+
MIIDSDCCAjCgAwIBAgIUPMKpJ/j10eQrcQBNnkImIaOYHakwDQYJKoZIhvcNAQEL
4+
BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTIxMDgwNTAwMzU1NloXDTIyMDgw
5+
NTAwMzU1NlowFDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEF
6+
AAOCAQ8AMIIBCgKCAQEAxe/ZseXgOTVoF7uTjX5Leknk95jIoyGc+VlxA8BhzGOr
7+
r4u6VNQZRCMq+svHY36tW4+u/xHNe2kvbwy2mnS8cFFLfst+94qBZVJDBxSGZ9I/
8+
wekErNsjFsik4UrMvcC+ZlGPh7hb3f7tSx29tn1DIkAUXVnbZ6TT5s+mYRQpZ6fW
9+
6kR3RNfc0A1IUM7Zs9yfNEr0O2H41P2HcLKoOPtvd7GvTQm9Ofh3srKvII+sZn/J
10+
WH7r76oRQMX904mOMdryQwZLObsqX4dXIEbafKVSecB3PBVIhv8gVtJhcZbQP1pI
11+
mMiWd6PHv46ZhGf7+cKnYUSa8Ia2t/wetK1wd00dFwIDAQABo4GRMIGOMA8GA1Ud
12+
EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGmMBYGA1UdJQEB/wQMMAoGCCsGAQUF
13+
BwMBMBcGA1UdEQEB/wQNMAuCCWxvY2FsaG9zdDA6BgorBgEEAYI3VAEBBCwMKkFT
14+
UC5ORVQgQ29yZSBIVFRQUyBkZXZlbG9wbWVudCBjZXJ0aWZpY2F0ZTANBgkqhkiG
15+
9w0BAQsFAAOCAQEAIj2VlBVcXGSly6KCBg6lgwFi+henWfSox77iuGAaAxDjN3jd
16+
9lZahW4MPNLHKSrPRb4YNSLZ2jh7zdcttQrqd4qH65o1q56q5JrCmli99iIzY9Y8
17+
RdYyxK4Zzr31wjpsyFiWQfqJTuSFUUg9uDDj0negwEZLIGlt7nr12wflt2+QOJtD
18+
byMeSZLbB5dPzn341DK0qfJEJMMgL0XsPEVZ3TQ6Alc9zq5wI608C/mXnz3xJE05
19+
UTYD8pRJJ/DyG0empvOVE8Sg93msHPquAbgqO9aqCpykgg/a8CFvI4wRdfvGEFlv
20+
8XJKL8Y/PFsmFeO3axq3zUYKFVdc9Un4dFIaag==
21+
-----END CERTIFICATE-----
22+
'''
23+
24+
25+
def add_certificate(file: str):
26+
with open(file, 'a+') as f:
27+
f.seek(0, 0)
28+
f.write(CERTIFICATION)

0 commit comments

Comments
 (0)