Skip to content

Commit 01c8b28

Browse files
[Container Registry] fixing up the test-resources-post script (Azure#17883)
* fixing up the test-resources-post script * adding forced import of Az * flipping orders * changing from updatet to import force * update for mac * using default shell * dropping the .exe * removing shell=True * removing powershell altogether * linking powershell command to module * powershell.exe -> pwsh * simplifying cmdlet * chnging command structure * simpler pwsh call * moving to mgmt plane library * adding import image using mgmt plane * import_repo -> import_image * cleaning up test-resources-post * more changes to test files * more corrections * making hello-world a constant too * fixing up recordings * adding try catch for import-module * adding import for Az.Accounts * using a fixture instead of the powershell script * removing test-resources-post.ps1 entirely, using fixture
1 parent 1019494 commit 01c8b28

File tree

56 files changed

+3719
-3011
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3719
-3011
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
-e ../../../tools/azure-sdk-tools
22
-e ../../../tools/azure-devtools
33
../../core/azure-core
4+
../azure-mgmt-containerregistry
45
aiohttp>=3.0; python_version >= '3.5'
56
azure-identity

sdk/containerregistry/azure-containerregistry/tests/conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77

88
import sys
99

10+
# Fixture
11+
from testcase import load_registry
12+
1013
# Ignore async tests for Python < 3.5
1114
collect_ignore_glob = []
1215
if sys.version_info < (3, 5):
1316
collect_ignore_glob.append("*_async.py")
17+
18+
def pytest_configure(config):
19+
config.addinivalue_line(
20+
"usefixtures", "load_registry"
21+
)

sdk/containerregistry/azure-containerregistry/tests/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66

77
TO_BE_DELETED = "to_be_deleted"
88
DOES_NOT_EXIST = "does_not_exist"
9+
HELLO_WORLD = "library/hello-world"

sdk/containerregistry/azure-containerregistry/tests/recordings/test_container_registry_client.test_delete_repository.yaml

Lines changed: 112 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,93 @@
11
interactions:
2+
- request:
3+
body: '{"source": {"registryUri": "registry.hub.docker.com", "sourceImage": "library/hello-world"},
4+
"targetTags": ["to_be_deleted"], "mode": "Force"}'
5+
headers:
6+
Accept:
7+
- '*/*'
8+
Accept-Encoding:
9+
- gzip, deflate
10+
Connection:
11+
- keep-alive
12+
Content-Length:
13+
- '142'
14+
Content-Type:
15+
- application/json
16+
User-Agent:
17+
- azsdk-python-azure-mgmt-containerregistry/8.0.0b1 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0)
18+
method: POST
19+
uri: https://management.azure.com/subscriptions/2cd617ea-1866-46b1-90e3-fffb087ebf9b/resourceGroups/fake_rg/providers/Microsoft.ContainerRegistry/registries/seankane/importImage?api-version=2019-05-01
20+
response:
21+
body:
22+
string: 'null'
23+
headers:
24+
cache-control:
25+
- no-cache
26+
content-length:
27+
- '4'
28+
content-type:
29+
- application/json; charset=utf-8
30+
date:
31+
- Tue, 13 Apr 2021 15:57:07 GMT
32+
expires:
33+
- '-1'
34+
location:
35+
- https://management.azure.com/subscriptions/2cd617ea-1866-46b1-90e3-fffb087ebf9b/providers/Microsoft.ContainerRegistry/locations/WESTUS2/operationResults/registries-e542e949-9c70-11eb-9c3f-002b67128e4c?api-version=2019-05-01
36+
pragma:
37+
- no-cache
38+
server:
39+
- Microsoft-HTTPAPI/2.0
40+
strict-transport-security:
41+
- max-age=31536000; includeSubDomains
42+
x-content-type-options:
43+
- nosniff
44+
x-ms-ratelimit-remaining-subscription-writes:
45+
- '1199'
46+
status:
47+
code: 202
48+
message: Accepted
49+
- request:
50+
body: null
51+
headers:
52+
Accept:
53+
- '*/*'
54+
Accept-Encoding:
55+
- gzip, deflate
56+
Connection:
57+
- keep-alive
58+
User-Agent:
59+
- azsdk-python-azure-mgmt-containerregistry/8.0.0b1 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0)
60+
method: GET
61+
uri: https://management.azure.com/subscriptions/2cd617ea-1866-46b1-90e3-fffb087ebf9b/providers/Microsoft.ContainerRegistry/locations/WESTUS2/operationResults/registries-e542e949-9c70-11eb-9c3f-002b67128e4c?api-version=2019-05-01
62+
response:
63+
body:
64+
string: '{"status": "Succeeded"}'
65+
headers:
66+
cache-control:
67+
- no-cache
68+
content-length:
69+
- '22'
70+
content-type:
71+
- application/json; charset=utf-8
72+
date:
73+
- Tue, 13 Apr 2021 15:57:20 GMT
74+
expires:
75+
- '-1'
76+
pragma:
77+
- no-cache
78+
server:
79+
- Microsoft-HTTPAPI/2.0
80+
strict-transport-security:
81+
- max-age=31536000; includeSubDomains
82+
transfer-encoding:
83+
- chunked
84+
vary:
85+
- Accept-Encoding
86+
x-content-type-options:
87+
- nosniff
88+
status:
89+
code: 200
90+
message: OK
291
- request:
392
body: null
493
headers:
@@ -13,11 +102,11 @@ interactions:
13102
User-Agent:
14103
- azsdk-python-azure-containerregistry/1.0.0b1 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0)
15104
method: DELETE
16-
uri: https://fake_url.azurecr.io/acr/v1/repo530d1618
105+
uri: https://fake_url.azurecr.io/acr/v1/to_be_deleted
17106
response:
18107
body:
19108
string: '{"errors":[{"code":"UNAUTHORIZED","message":"authentication required,
20-
visit https://aka.ms/acr/authorization for more information.","detail":[{"Type":"repository","Name":"repo530d1618","Action":"delete"}]}]}
109+
visit https://aka.ms/acr/authorization for more information.","detail":[{"Type":"repository","Name":"to_be_deleted","Action":"delete"}]}]}
21110
22111
'
23112
headers:
@@ -29,11 +118,11 @@ interactions:
29118
connection:
30119
- keep-alive
31120
content-length:
32-
- '208'
121+
- '209'
33122
content-type:
34123
- application/json; charset=utf-8
35124
date:
36-
- Fri, 09 Apr 2021 14:56:09 GMT
125+
- Tue, 13 Apr 2021 15:57:21 GMT
37126
docker-distribution-api-version:
38127
- registry/2.0
39128
server:
@@ -42,7 +131,7 @@ interactions:
42131
- max-age=31536000; includeSubDomains
43132
- max-age=31536000; includeSubDomains
44133
www-authenticate:
45-
- Bearer realm="https://seankane.azurecr.io/oauth2/token",service="seankane.azurecr.io",scope="repository:repo530d1618:delete"
134+
- Bearer realm="https://seankane.azurecr.io/oauth2/token",service="seankane.azurecr.io",scope="repository:to_be_deleted:delete"
46135
x-content-type-options:
47136
- nosniff
48137
status:
@@ -74,20 +163,20 @@ interactions:
74163
content-type:
75164
- application/json; charset=utf-8
76165
date:
77-
- Fri, 09 Apr 2021 14:56:11 GMT
166+
- Tue, 13 Apr 2021 15:57:22 GMT
78167
server:
79168
- openresty
80169
strict-transport-security:
81170
- max-age=31536000; includeSubDomains
82171
transfer-encoding:
83172
- chunked
84173
x-ms-ratelimit-remaining-calls-per-second:
85-
- '333.183333'
174+
- '166.65'
86175
status:
87176
code: 200
88177
message: OK
89178
- request:
90-
body: grant_type=refresh_token&service=fake_url.azurecr.io&scope=repository%3Arepo530d1618%3Adelete&refresh_token=REDACTED
179+
body: grant_type=refresh_token&service=fake_url.azurecr.io&scope=repository%3Ato_be_deleted%3Adelete&refresh_token=REDACTED
91180
headers:
92181
Accept:
93182
- application/json
@@ -96,7 +185,7 @@ interactions:
96185
Connection:
97186
- keep-alive
98187
Content-Length:
99-
- '1073'
188+
- '1074'
100189
Content-Type:
101190
- application/x-www-form-urlencoded
102191
User-Agent:
@@ -112,15 +201,15 @@ interactions:
112201
content-type:
113202
- application/json; charset=utf-8
114203
date:
115-
- Fri, 09 Apr 2021 14:56:12 GMT
204+
- Tue, 13 Apr 2021 15:57:22 GMT
116205
server:
117206
- openresty
118207
strict-transport-security:
119208
- max-age=31536000; includeSubDomains
120209
transfer-encoding:
121210
- chunked
122211
x-ms-ratelimit-remaining-calls-per-second:
123-
- '332.933333'
212+
- '166.633333'
124213
status:
125214
code: 200
126215
message: OK
@@ -138,7 +227,7 @@ interactions:
138227
User-Agent:
139228
- azsdk-python-azure-containerregistry/1.0.0b1 Python/3.9.0rc1 (Windows-10-10.0.19041-SP0)
140229
method: DELETE
141-
uri: https://fake_url.azurecr.io/acr/v1/repo530d1618
230+
uri: https://fake_url.azurecr.io/acr/v1/to_be_deleted
142231
response:
143232
body:
144233
string: '{"manifestsDeleted": ["sha256:1b26826f602946860c279fce658f31050cff2c596583af237d971f4629b57792",
@@ -165,7 +254,7 @@ interactions:
165254
content-type:
166255
- application/json; charset=utf-8
167256
date:
168-
- Fri, 09 Apr 2021 14:56:14 GMT
257+
- Tue, 13 Apr 2021 15:57:26 GMT
169258
docker-distribution-api-version:
170259
- registry/2.0
171260
server:
@@ -176,7 +265,7 @@ interactions:
176265
x-content-type-options:
177266
- nosniff
178267
x-ms-ratelimit-remaining-calls-per-second:
179-
- '32.000000'
268+
- '8.000000'
180269
status:
181270
code: 202
182271
message: Accepted
@@ -212,7 +301,7 @@ interactions:
212301
content-type:
213302
- application/json; charset=utf-8
214303
date:
215-
- Fri, 09 Apr 2021 14:56:14 GMT
304+
- Tue, 13 Apr 2021 15:57:26 GMT
216305
docker-distribution-api-version:
217306
- registry/2.0
218307
server:
@@ -253,15 +342,15 @@ interactions:
253342
content-type:
254343
- application/json; charset=utf-8
255344
date:
256-
- Fri, 09 Apr 2021 14:56:14 GMT
345+
- Tue, 13 Apr 2021 15:57:26 GMT
257346
server:
258347
- openresty
259348
strict-transport-security:
260349
- max-age=31536000; includeSubDomains
261350
transfer-encoding:
262351
- chunked
263352
x-ms-ratelimit-remaining-calls-per-second:
264-
- '332.916667'
353+
- '166.6'
265354
status:
266355
code: 200
267356
message: OK
@@ -291,15 +380,15 @@ interactions:
291380
content-type:
292381
- application/json; charset=utf-8
293382
date:
294-
- Fri, 09 Apr 2021 14:56:15 GMT
383+
- Tue, 13 Apr 2021 15:57:26 GMT
295384
server:
296385
- openresty
297386
strict-transport-security:
298387
- max-age=31536000; includeSubDomains
299388
transfer-encoding:
300389
- chunked
301390
x-ms-ratelimit-remaining-calls-per-second:
302-
- '332.9'
391+
- '166.583333'
303392
status:
304393
code: 200
305394
message: OK
@@ -318,10 +407,8 @@ interactions:
318407
uri: https://fake_url.azurecr.io/acr/v1/_catalog
319408
response:
320409
body:
321-
string: '{"repositories": ["alpine/git", "debian", "hello-world", "library/hello-world",
322-
"repo160e197b", "repo2e8319c5", "repo308e19dd", "repo6ce51658", "repo9b321760",
323-
"repo_set160e197b", "repo_set_manib7cc1bf8", "repob7cc1bf8", "repod2be1c42",
324-
"repoeb7113db", "reposet160e197b", "reposetmanib7cc1bf8", "ubuntu"]}'
410+
string: '{"repositories": ["library/alpine", "library/busybox", "library/hello-world",
411+
"repo2e8319c5", "repo308e19dd", "repo9b321760", "repod2be1c42", "repoeb7113db"]}'
325412
headers:
326413
access-control-expose-headers:
327414
- Docker-Content-Digest
@@ -331,11 +418,11 @@ interactions:
331418
connection:
332419
- keep-alive
333420
content-length:
334-
- '289'
421+
- '151'
335422
content-type:
336423
- application/json; charset=utf-8
337424
date:
338-
- Fri, 09 Apr 2021 14:56:15 GMT
425+
- Tue, 13 Apr 2021 15:57:26 GMT
339426
docker-distribution-api-version:
340427
- registry/2.0
341428
server:

sdk/containerregistry/azure-containerregistry/tests/recordings/test_container_registry_client.test_delete_repository_does_not_exist.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ interactions:
3333
content-type:
3434
- application/json; charset=utf-8
3535
date:
36-
- Fri, 09 Apr 2021 14:56:15 GMT
36+
- Tue, 13 Apr 2021 15:57:27 GMT
3737
docker-distribution-api-version:
3838
- registry/2.0
3939
server:
@@ -74,15 +74,15 @@ interactions:
7474
content-type:
7575
- application/json; charset=utf-8
7676
date:
77-
- Fri, 09 Apr 2021 14:56:17 GMT
77+
- Tue, 13 Apr 2021 15:57:28 GMT
7878
server:
7979
- openresty
8080
strict-transport-security:
8181
- max-age=31536000; includeSubDomains
8282
transfer-encoding:
8383
- chunked
8484
x-ms-ratelimit-remaining-calls-per-second:
85-
- '333.033333'
85+
- '166.55'
8686
status:
8787
code: 200
8888
message: OK
@@ -112,15 +112,15 @@ interactions:
112112
content-type:
113113
- application/json; charset=utf-8
114114
date:
115-
- Fri, 09 Apr 2021 14:56:18 GMT
115+
- Tue, 13 Apr 2021 15:57:28 GMT
116116
server:
117117
- openresty
118118
strict-transport-security:
119119
- max-age=31536000; includeSubDomains
120120
transfer-encoding:
121121
- chunked
122122
x-ms-ratelimit-remaining-calls-per-second:
123-
- '332.966667'
123+
- '166.2'
124124
status:
125125
code: 200
126126
message: OK
@@ -156,7 +156,7 @@ interactions:
156156
content-type:
157157
- application/json; charset=utf-8
158158
date:
159-
- Fri, 09 Apr 2021 14:56:18 GMT
159+
- Tue, 13 Apr 2021 15:57:29 GMT
160160
docker-distribution-api-version:
161161
- registry/2.0
162162
server:
@@ -167,7 +167,7 @@ interactions:
167167
x-content-type-options:
168168
- nosniff
169169
x-ms-ratelimit-remaining-calls-per-second:
170-
- '32.000000'
170+
- '8.000000'
171171
status:
172172
code: 404
173173
message: Not Found

0 commit comments

Comments
 (0)