Skip to content

Commit 2df812c

Browse files
Enabled flexible local testing and ensure consistency among services (Azure#18907)
* Enabled flexible local testing and ensured consistency among services * fixed imports
1 parent d48d11e commit 2df812c

File tree

10 files changed

+181
-112
lines changed

10 files changed

+181
-112
lines changed

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,17 @@ venv/
9292
code_reports
9393

9494
# Azure Storage test credentials
95+
sdk/storage/azure-storage-blob/tests/_shared/settings_real.py
96+
sdk/storage/azure-storage-queue/tests/_shared/settings_real.py
97+
sdk/storage/azure-storage-file-share/tests/_shared/settings_real.py
98+
sdk/storage/azure-storage-file-datalake/tests/settings_real.py
99+
100+
# The locations below are deprecated - keep to prevent any accidental secrets leakage ==========
95101
sdk/storage/azure-storage-blob/tests/settings_real.py
96102
sdk/storage/azure-storage-queue/tests/settings_real.py
97103
sdk/storage/azure-storage-file-share/tests/settings_real.py
98-
sdk/storage/azure-storage-file-datalake/tests/settings_real.py
104+
# ==============================================================================================
105+
99106
*.code-workspace
100107
sdk/cosmos/azure-cosmos/test/test_config.py
101108

sdk/storage/azure-storage-blob/tests/_shared/testcase.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
# license information.
66
# --------------------------------------------------------------------------
77
from __future__ import division
8-
from contextlib import contextmanager
9-
import copy
10-
import inspect
11-
import os
128
import os.path
139
import time
1410
from datetime import datetime, timedelta
@@ -43,8 +39,10 @@
4339
from azure.storage.blob import generate_account_sas, AccountSasPermissions, ResourceTypes
4440
from azure.mgmt.storage.models import StorageAccount, Endpoints
4541
try:
42+
# Running locally - use configuration in settings_real.py
4643
from .settings_real import *
4744
except ImportError:
45+
# Running on the pipeline - use fake values in order to create rg, etc.
4846
from .settings_fake import *
4947

5048
try:

sdk/storage/azure-storage-blob/tests/blob_performance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
ContainerClient,
1313
BlobClient,
1414
)
15-
import tests.settings_real as settings
15+
import _shared.settings_real as settings
1616

1717
# Warning:
1818
# This script will take a while to run with everything enabled.

sdk/storage/azure-storage-blob/tests/recordings/test_blob_access_conditions.test_set_blob_properties_with_if_none_match_fail.yaml

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ interactions:
33
body: null
44
headers:
55
Accept:
6-
- '*/*'
6+
- application/xml
77
Accept-Encoding:
88
- gzip, deflate
99
Connection:
1010
- keep-alive
1111
Content-Length:
1212
- '0'
1313
User-Agent:
14-
- azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
14+
- azsdk-python-storage-blob/12.9.0b1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
1515
x-ms-date:
16-
- Fri, 25 Oct 2019 17:22:42 GMT
16+
- Tue, 25 May 2021 05:09:40 GMT
1717
x-ms-version:
18-
- '2019-02-02'
18+
- '2020-08-04'
1919
method: PUT
2020
uri: https://storagename.blob.core.windows.net/utcontainerb1921f2b?restype=container
2121
response:
@@ -25,23 +25,23 @@ interactions:
2525
content-length:
2626
- '0'
2727
date:
28-
- Fri, 25 Oct 2019 17:22:41 GMT
28+
- Tue, 25 May 2021 05:09:41 GMT
2929
etag:
30-
- '"0x8D7596FF19BD234"'
30+
- '"0x8D91F3B4D9376CA"'
3131
last-modified:
32-
- Fri, 25 Oct 2019 17:22:42 GMT
32+
- Tue, 25 May 2021 05:09:41 GMT
3333
server:
3434
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
3535
x-ms-version:
36-
- '2019-02-02'
36+
- '2020-08-04'
3737
status:
3838
code: 201
3939
message: Created
4040
- request:
4141
body: hello world
4242
headers:
4343
Accept:
44-
- '*/*'
44+
- application/xml
4545
Accept-Encoding:
4646
- gzip, deflate
4747
Connection:
@@ -53,13 +53,13 @@ interactions:
5353
If-None-Match:
5454
- '*'
5555
User-Agent:
56-
- azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
56+
- azsdk-python-storage-blob/12.9.0b1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
5757
x-ms-blob-type:
5858
- BlockBlob
5959
x-ms-date:
60-
- Fri, 25 Oct 2019 17:22:42 GMT
60+
- Tue, 25 May 2021 05:09:40 GMT
6161
x-ms-version:
62-
- '2019-02-02'
62+
- '2020-08-04'
6363
method: PUT
6464
uri: https://storagename.blob.core.windows.net/utcontainerb1921f2b/blob1
6565
response:
@@ -71,37 +71,39 @@ interactions:
7171
content-md5:
7272
- XrY7u+Ae7tCTyyK7j1rNww==
7373
date:
74-
- Fri, 25 Oct 2019 17:22:41 GMT
74+
- Tue, 25 May 2021 05:09:41 GMT
7575
etag:
76-
- '"0x8D7596FF1A4D6EC"'
76+
- '"0x8D91F3B4DB76284"'
7777
last-modified:
78-
- Fri, 25 Oct 2019 17:22:42 GMT
78+
- Tue, 25 May 2021 05:09:41 GMT
7979
server:
8080
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
8181
x-ms-content-crc64:
8282
- vo7q9sPVKY0=
8383
x-ms-request-server-encrypted:
8484
- 'true'
8585
x-ms-version:
86-
- '2019-02-02'
86+
- '2020-08-04'
87+
x-ms-version-id:
88+
- '2021-05-25T05:09:41.7031300Z'
8789
status:
8890
code: 201
8991
message: Created
9092
- request:
9193
body: null
9294
headers:
9395
Accept:
94-
- '*/*'
96+
- application/xml
9597
Accept-Encoding:
9698
- gzip, deflate
9799
Connection:
98100
- keep-alive
99101
User-Agent:
100-
- azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
102+
- azsdk-python-storage-blob/12.9.0b1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
101103
x-ms-date:
102-
- Fri, 25 Oct 2019 17:22:42 GMT
104+
- Tue, 25 May 2021 05:09:41 GMT
103105
x-ms-version:
104-
- '2019-02-02'
106+
- '2020-08-04'
105107
method: HEAD
106108
uri: https://storagename.blob.core.windows.net/utcontainerb1921f2b/blob1
107109
response:
@@ -117,11 +119,11 @@ interactions:
117119
content-type:
118120
- application/octet-stream
119121
date:
120-
- Fri, 25 Oct 2019 17:22:41 GMT
122+
- Tue, 25 May 2021 05:09:41 GMT
121123
etag:
122-
- '"0x8D7596FF1A4D6EC"'
124+
- '"0x8D91F3B4DB76284"'
123125
last-modified:
124-
- Fri, 25 Oct 2019 17:22:42 GMT
126+
- Tue, 25 May 2021 05:09:41 GMT
125127
server:
126128
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
127129
x-ms-access-tier:
@@ -131,60 +133,64 @@ interactions:
131133
x-ms-blob-type:
132134
- BlockBlob
133135
x-ms-creation-time:
134-
- Fri, 25 Oct 2019 17:22:42 GMT
136+
- Tue, 25 May 2021 05:09:41 GMT
137+
x-ms-is-current-version:
138+
- 'true'
135139
x-ms-lease-state:
136140
- available
137141
x-ms-lease-status:
138142
- unlocked
139143
x-ms-server-encrypted:
140144
- 'true'
141145
x-ms-version:
142-
- '2019-02-02'
146+
- '2020-08-04'
147+
x-ms-version-id:
148+
- '2021-05-25T05:09:41.7031300Z'
143149
status:
144150
code: 200
145151
message: OK
146152
- request:
147153
body: null
148154
headers:
149155
Accept:
150-
- '*/*'
156+
- application/xml
151157
Accept-Encoding:
152158
- gzip, deflate
153159
Connection:
154160
- keep-alive
155161
Content-Length:
156162
- '0'
157163
If-None-Match:
158-
- '"0x8D7596FF1A4D6EC"'
164+
- '"0x8D91F3B4DB76284"'
159165
User-Agent:
160-
- azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
166+
- azsdk-python-storage-blob/12.9.0b1 Python/3.8.5 (Windows-10-10.0.19041-SP0)
161167
x-ms-blob-content-disposition:
162168
- inline
163169
x-ms-blob-content-language:
164170
- spanish
165171
x-ms-date:
166-
- Fri, 25 Oct 2019 17:22:42 GMT
172+
- Tue, 25 May 2021 05:09:41 GMT
167173
x-ms-version:
168-
- '2019-02-02'
174+
- '2020-08-04'
169175
method: PUT
170176
uri: https://storagename.blob.core.windows.net/utcontainerb1921f2b/blob1?comp=properties
171177
response:
172178
body:
173179
string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>ConditionNotMet</Code><Message>The
174-
condition specified using HTTP conditional header(s) is not met.\nRequestId:363a2d2e-901e-00d9-6c58-8b2793000000\nTime:2019-10-25T17:22:42.7538498Z</Message></Error>"
180+
condition specified using HTTP conditional header(s) is not met.\nRequestId:553c318a-a01e-0052-0f24-513148000000\nTime:2021-05-25T05:09:42.0713805Z</Message></Error>"
175181
headers:
176182
content-length:
177183
- '252'
178184
content-type:
179185
- application/xml
180186
date:
181-
- Fri, 25 Oct 2019 17:22:41 GMT
187+
- Tue, 25 May 2021 05:09:41 GMT
182188
server:
183189
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
184190
x-ms-error-code:
185191
- ConditionNotMet
186192
x-ms-version:
187-
- '2019-02-02'
193+
- '2020-08-04'
188194
status:
189195
code: 412
190196
message: The condition specified using HTTP conditional header(s) is not met.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for
4+
# license information.
5+
# --------------------------------------------------------------------------
6+
7+
STORAGE_ACCOUNT_NAME = ""
8+
STORAGE_ACCOUNT_KEY = ""
9+
10+
ACCOUNT_URL_SUFFIX = 'core.windows.net'
11+
RUN_IN_LIVE = "False"
12+
SKIP_LIVE_RECORDING = "True"
13+
14+
PROTOCOL = "https"
15+
16+
ENABLE_LOGGING = True
17+

0 commit comments

Comments
 (0)