Skip to content

Commit 3e3fbe8

Browse files
author
Yalin Li
authored
[Tables] Migrate to new test proxy (Azure#21321)
1 parent a66fb7a commit 3e3fbe8

File tree

1,160 files changed

+131025
-137320
lines changed

Some content is hidden

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

1,160 files changed

+131025
-137320
lines changed

eng/scripts/Language-Settings.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,15 +561,15 @@ function Import-Dev-Cert-python
561561
}
562562

563563
function Validate-Python-DocMsPackages
564-
{
564+
{
565565
Param(
566566
[Parameter(Mandatory=$true)]
567567
[PSCustomObject]$PackageInfo,
568568
[Parameter(Mandatory=$false)]
569569
[string]$PackageSourceOverride,
570570
[Parameter(Mandatory=$false)]
571571
[string]$DocValidationImageId
572-
)
572+
)
573573
$packageName = $packageInfo.Name
574574
$packageVersion = $packageInfo.Version
575575
ValidatePackage -packageName $packageName -packageVersion $packageVersion `

scripts/devops_tasks/trust_proxy_cert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ def combine_cert_file():
3636

3737
if os.getenv('TF_BUILD', False):
3838
print("##vso[task.setvariable variable=SSL_CERT_DIR]{}".format(os.path.dirname(COMBINED_LOCATION)))
39-
print("##vso[task.setvariable variable=REQUESTS_CA_BUNDLE]{}".format(COMBINED_LOCATION))
39+
print("##vso[task.setvariable variable=REQUESTS_CA_BUNDLE]{}".format(COMBINED_LOCATION))

sdk/tables/azure-data-tables/azure/data/tables/_error.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _validate_table_name(table_name):
6767
)
6868

6969

70-
def _decode_error(response, error_message=None, error_type=None, **kwargs):
70+
def _decode_error(response, error_message=None, error_type=None, **kwargs): # pylint: disable=too-many-branches
7171
error_code = response.headers.get("x-ms-error-code")
7272
additional_data = {}
7373
try:
@@ -80,6 +80,14 @@ def _decode_error(response, error_message=None, error_type=None, **kwargs):
8080
error_message = error_body["odata.error"][info]["value"]
8181
else:
8282
additional_data[info.tag] = info.text
83+
84+
# Special case: there was a playback error during test execution (test proxy only)
85+
message = error_body.get("Message")
86+
if message and message.startswith("Unable to find a record for the request"):
87+
error = ResourceNotFoundError(message=error_message, response=response)
88+
error.error_code = 404
89+
error.additional_info = additional_data
90+
return error
8391
else:
8492
if error_body:
8593
for info in error_body.iter():

sdk/tables/azure-data-tables/tests/conftest.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,27 @@
2525
# --------------------------------------------------------------------------
2626
import sys
2727

28+
import pytest
29+
from devtools_testutils import add_general_regex_sanitizer, test_proxy
30+
2831
# fixture needs to be visible from conftest
2932

3033
# Ignore async tests for Python < 3.5
3134
collect_ignore_glob = []
3235
if sys.version_info < (3, 5):
3336
collect_ignore_glob.append("*_async.py")
37+
38+
@pytest.fixture(scope="session", autouse=True)
39+
def add_sanitizers(test_proxy):
40+
# sanitizes table/cosmos account names in URLs
41+
add_general_regex_sanitizer(
42+
value="fakeendpoint",
43+
regex="(?<=\\/\\/)[a-z]+(?=(?:|-secondary)\\.(?:table|blob|queue)\\.(?:cosmos|core)\\."
44+
"(?:azure|windows)\\.(?:com|net))",
45+
)
46+
# sanitizes random UUIDs that are sent in batch request headers and bodies
47+
add_general_regex_sanitizer(
48+
value="00000000-0000-0000-0000-000000000000",
49+
regex="batch[a-z]*_([0-9a-f]{8}\\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\\b[0-9a-f]{12}\\b)",
50+
group_for_replace="1",
51+
)

sdk/tables/azure-data-tables/tests/preparers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
CosmosPreparer = functools.partial(
1010
PowerShellPreparer,
1111
"tables",
12-
tables_cosmos_account_name="fake_cosmos_account",
12+
tables_cosmos_account_name="fakecosmosaccount",
1313
tables_primary_cosmos_account_key="fakecosmosaccountkey",
1414
)
1515

1616
TablesPreparer = functools.partial(
1717
PowerShellPreparer,
1818
"tables",
19-
tables_storage_account_name="fake_table_account",
19+
tables_storage_account_name="faketableaccount",
2020
tables_primary_storage_account_key="faketablesaccountkey",
2121
)
2222

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{
2+
"Entries": [
3+
{
4+
"RequestUri": "https://fakeendpoint.table.core.windows.net/Tables",
5+
"RequestMethod": "POST",
6+
"RequestHeaders": {
7+
"Accept": "application/json;odata=minimalmetadata",
8+
"Accept-Encoding": "gzip, deflate",
9+
"Authorization": "Sanitized",
10+
"Connection": "keep-alive",
11+
"Content-Length": "32",
12+
"Content-Type": "application/json;odata=nometadata",
13+
"DataServiceVersion": "3.0",
14+
"Date": "Mon, 18 Oct 2021 21:58:35 GMT",
15+
"User-Agent": "azsdk-python-data-tables/12.1.1 Python/3.9.2 (Windows-10-10.0.19041-SP0)",
16+
"x-ms-client-request-id": "8b0bb1e3-305e-11ec-ad70-5cf37093a909",
17+
"x-ms-date": "Mon, 18 Oct 2021 21:58:35 GMT",
18+
"x-ms-version": "2019-02-02"
19+
},
20+
"RequestBody": "{\u0022TableName\u0022: \u0022uttablee5cc21c0\u0022}",
21+
"StatusCode": 201,
22+
"ResponseHeaders": {
23+
"Cache-Control": "no-cache",
24+
"Content-Type": "application/json; odata=minimalmetadata; streaming=true; charset=utf-8",
25+
"Date": "Mon, 18 Oct 2021 21:58:29 GMT",
26+
"Location": "https://fakeendpoint.table.core.windows.net/Tables(\u0027uttablee5cc21c0\u0027)",
27+
"Server": [
28+
"Windows-Azure-Table/1.0",
29+
"Microsoft-HTTPAPI/2.0"
30+
],
31+
"Transfer-Encoding": "chunked",
32+
"X-Content-Type-Options": "nosniff",
33+
"x-ms-client-request-id": "8b0bb1e3-305e-11ec-ad70-5cf37093a909",
34+
"x-ms-request-id": "5762714b-2002-0015-386b-c4666e000000",
35+
"x-ms-version": "2019-02-02"
36+
},
37+
"ResponseBody": {
38+
"odata.metadata": "https://fakeendpoint.table.core.windows.net/$metadata#Tables/@Element",
39+
"TableName": "uttablee5cc21c0"
40+
}
41+
},
42+
{
43+
"RequestUri": "https://fakeendpoint.table.core.windows.net/Tables(\u0027uttablee5cc21c0\u0027)",
44+
"RequestMethod": "DELETE",
45+
"RequestHeaders": {
46+
"Accept": "application/json",
47+
"Accept-Encoding": "gzip, deflate",
48+
"Authorization": "Sanitized",
49+
"Connection": "keep-alive",
50+
"Content-Length": "0",
51+
"Date": "Mon, 18 Oct 2021 21:58:36 GMT",
52+
"User-Agent": "azsdk-python-data-tables/12.1.1 Python/3.9.2 (Windows-10-10.0.19041-SP0)",
53+
"x-ms-client-request-id": "8b14d3a1-305e-11ec-b866-5cf37093a909",
54+
"x-ms-date": "Mon, 18 Oct 2021 21:58:36 GMT",
55+
"x-ms-version": "2019-02-02"
56+
},
57+
"RequestBody": null,
58+
"StatusCode": 204,
59+
"ResponseHeaders": {
60+
"Cache-Control": "no-cache",
61+
"Content-Length": "0",
62+
"Date": "Mon, 18 Oct 2021 21:58:29 GMT",
63+
"Server": [
64+
"Windows-Azure-Table/1.0",
65+
"Microsoft-HTTPAPI/2.0"
66+
],
67+
"X-Content-Type-Options": "nosniff",
68+
"x-ms-client-request-id": "8b14d3a1-305e-11ec-b866-5cf37093a909",
69+
"x-ms-request-id": "57627152-2002-0015-3e6b-c4666e000000",
70+
"x-ms-version": "2019-02-02"
71+
},
72+
"ResponseBody": null
73+
},
74+
{
75+
"RequestUri": "https://fakeendpoint.table.core.windows.net/Tables(\u0027uttablee5cc21c0\u0027)",
76+
"RequestMethod": "DELETE",
77+
"RequestHeaders": {
78+
"Accept": "application/json",
79+
"Accept-Encoding": "gzip, deflate",
80+
"Authorization": "Sanitized",
81+
"Connection": "keep-alive",
82+
"Content-Length": "0",
83+
"Date": "Mon, 18 Oct 2021 21:58:36 GMT",
84+
"User-Agent": "azsdk-python-data-tables/12.1.1 Python/3.9.2 (Windows-10-10.0.19041-SP0)",
85+
"x-ms-client-request-id": "8b189c34-305e-11ec-b634-5cf37093a909",
86+
"x-ms-date": "Mon, 18 Oct 2021 21:58:36 GMT",
87+
"x-ms-version": "2019-02-02"
88+
},
89+
"RequestBody": null,
90+
"StatusCode": 404,
91+
"ResponseHeaders": {
92+
"Cache-Control": "no-cache",
93+
"Content-Type": "application/json; odata=minimalmetadata; streaming=true; charset=utf-8",
94+
"Date": "Mon, 18 Oct 2021 21:58:29 GMT",
95+
"Server": [
96+
"Windows-Azure-Table/1.0",
97+
"Microsoft-HTTPAPI/2.0"
98+
],
99+
"Transfer-Encoding": "chunked",
100+
"X-Content-Type-Options": "nosniff",
101+
"x-ms-client-request-id": "8b189c34-305e-11ec-b634-5cf37093a909",
102+
"x-ms-request-id": "57627156-2002-0015-426b-c4666e000000",
103+
"x-ms-version": "2019-02-02"
104+
},
105+
"ResponseBody": {
106+
"odata.error": {
107+
"code": "ResourceNotFound",
108+
"message": {
109+
"lang": "en-US",
110+
"value": "The specified resource does not exist.\nRequestId:57627156-2002-0015-426b-c4666e000000\nTime:2021-10-18T21:58:30.2926335Z"
111+
}
112+
}
113+
}
114+
}
115+
],
116+
"Variables": {}
117+
}
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
{
2+
"Entries": [
3+
{
4+
"RequestUri": "https://fakeendpoint.table.core.windows.net/Tables",
5+
"RequestMethod": "POST",
6+
"RequestHeaders": {
7+
"Accept": "application/json;odata=minimalmetadata",
8+
"Accept-Encoding": "gzip, deflate",
9+
"Authorization": "Sanitized",
10+
"Connection": "keep-alive",
11+
"Content-Length": "32",
12+
"Content-Type": "application/json;odata=nometadata",
13+
"DataServiceVersion": "3.0",
14+
"Date": "Mon, 18 Oct 2021 21:58:32 GMT",
15+
"User-Agent": "azsdk-python-data-tables/12.1.1 Python/3.9.2 (Windows-10-10.0.19041-SP0)",
16+
"x-ms-client-request-id": "8907585b-305e-11ec-9b7a-5cf37093a909",
17+
"x-ms-date": "Mon, 18 Oct 2021 21:58:32 GMT",
18+
"x-ms-version": "2019-02-02"
19+
},
20+
"RequestBody": "{\u0022TableName\u0022: \u0022uttablecee1273f\u0022}",
21+
"StatusCode": 201,
22+
"ResponseHeaders": {
23+
"Cache-Control": "no-cache",
24+
"Content-Type": "application/json; odata=minimalmetadata; streaming=true; charset=utf-8",
25+
"Date": "Mon, 18 Oct 2021 21:58:26 GMT",
26+
"Location": "https://fakeendpoint.table.core.windows.net/Tables(\u0027uttablecee1273f\u0027)",
27+
"Server": [
28+
"Windows-Azure-Table/1.0",
29+
"Microsoft-HTTPAPI/2.0"
30+
],
31+
"Transfer-Encoding": "chunked",
32+
"X-Content-Type-Options": "nosniff",
33+
"x-ms-client-request-id": "8907585b-305e-11ec-9b7a-5cf37093a909",
34+
"x-ms-request-id": "57626ea4-2002-0015-6e6b-c4666e000000",
35+
"x-ms-version": "2019-02-02"
36+
},
37+
"ResponseBody": {
38+
"odata.metadata": "https://fakeendpoint.table.core.windows.net/$metadata#Tables/@Element",
39+
"TableName": "uttablecee1273f"
40+
}
41+
},
42+
{
43+
"RequestUri": "https://fakeendpoint.table.core.windows.net/Tables",
44+
"RequestMethod": "POST",
45+
"RequestHeaders": {
46+
"Accept": "application/json;odata=minimalmetadata",
47+
"Accept-Encoding": "gzip, deflate",
48+
"Authorization": "Sanitized",
49+
"Connection": "keep-alive",
50+
"Content-Length": "32",
51+
"Content-Type": "application/json;odata=nometadata",
52+
"DataServiceVersion": "3.0",
53+
"Date": "Mon, 18 Oct 2021 21:58:32 GMT",
54+
"User-Agent": "azsdk-python-data-tables/12.1.1 Python/3.9.2 (Windows-10-10.0.19041-SP0)",
55+
"x-ms-client-request-id": "8907585b-305e-11ec-9b7a-5cf37093a909",
56+
"x-ms-date": "Mon, 18 Oct 2021 21:58:32 GMT",
57+
"x-ms-version": "2019-02-02"
58+
},
59+
"RequestBody": "{\u0022TableName\u0022: \u0022uttablecee1273f\u0022}",
60+
"StatusCode": 409,
61+
"ResponseHeaders": {
62+
"Cache-Control": "no-cache",
63+
"Content-Type": "application/json; odata=minimalmetadata; streaming=true; charset=utf-8",
64+
"Date": "Mon, 18 Oct 2021 21:58:26 GMT",
65+
"Server": [
66+
"Windows-Azure-Table/1.0",
67+
"Microsoft-HTTPAPI/2.0"
68+
],
69+
"Transfer-Encoding": "chunked",
70+
"X-Content-Type-Options": "nosniff",
71+
"x-ms-client-request-id": "8907585b-305e-11ec-9b7a-5cf37093a909",
72+
"x-ms-request-id": "57626eaf-2002-0015-776b-c4666e000000",
73+
"x-ms-version": "2019-02-02"
74+
},
75+
"ResponseBody": {
76+
"odata.error": {
77+
"code": "TableAlreadyExists",
78+
"message": {
79+
"lang": "en-US",
80+
"value": "The table specified already exists.\nRequestId:57626eaf-2002-0015-776b-c4666e000000\nTime:2021-10-18T21:58:27.3295071Z"
81+
}
82+
}
83+
}
84+
},
85+
{
86+
"RequestUri": "https://fakeendpoint.table.core.windows.net/Tables(\u0027uttablecee1273f\u0027)",
87+
"RequestMethod": "DELETE",
88+
"RequestHeaders": {
89+
"Accept": "application/json",
90+
"Accept-Encoding": "gzip, deflate",
91+
"Authorization": "Sanitized",
92+
"Connection": "keep-alive",
93+
"Content-Length": "0",
94+
"Date": "Mon, 18 Oct 2021 21:58:33 GMT",
95+
"User-Agent": "azsdk-python-data-tables/12.1.1 Python/3.9.2 (Windows-10-10.0.19041-SP0)",
96+
"x-ms-client-request-id": "8957e637-305e-11ec-9a4f-5cf37093a909",
97+
"x-ms-date": "Mon, 18 Oct 2021 21:58:33 GMT",
98+
"x-ms-version": "2019-02-02"
99+
},
100+
"RequestBody": null,
101+
"StatusCode": 204,
102+
"ResponseHeaders": {
103+
"Cache-Control": "no-cache",
104+
"Content-Length": "0",
105+
"Date": "Mon, 18 Oct 2021 21:58:26 GMT",
106+
"Server": [
107+
"Windows-Azure-Table/1.0",
108+
"Microsoft-HTTPAPI/2.0"
109+
],
110+
"X-Content-Type-Options": "nosniff",
111+
"x-ms-client-request-id": "8957e637-305e-11ec-9a4f-5cf37093a909",
112+
"x-ms-request-id": "57626eb2-2002-0015-7a6b-c4666e000000",
113+
"x-ms-version": "2019-02-02"
114+
},
115+
"ResponseBody": null
116+
},
117+
{
118+
"RequestUri": "https://fakeendpoint.table.core.windows.net/Tables(\u0027uttablecee1273f\u0027)",
119+
"RequestMethod": "DELETE",
120+
"RequestHeaders": {
121+
"Accept": "application/json",
122+
"Accept-Encoding": "gzip, deflate",
123+
"Authorization": "Sanitized",
124+
"Connection": "keep-alive",
125+
"Content-Length": "0",
126+
"Date": "Mon, 18 Oct 2021 21:58:33 GMT",
127+
"User-Agent": "azsdk-python-data-tables/12.1.1 Python/3.9.2 (Windows-10-10.0.19041-SP0)",
128+
"x-ms-client-request-id": "895b8dc4-305e-11ec-9ce7-5cf37093a909",
129+
"x-ms-date": "Mon, 18 Oct 2021 21:58:33 GMT",
130+
"x-ms-version": "2019-02-02"
131+
},
132+
"RequestBody": null,
133+
"StatusCode": 404,
134+
"ResponseHeaders": {
135+
"Cache-Control": "no-cache",
136+
"Content-Type": "application/json; odata=minimalmetadata; streaming=true; charset=utf-8",
137+
"Date": "Mon, 18 Oct 2021 21:58:26 GMT",
138+
"Server": [
139+
"Windows-Azure-Table/1.0",
140+
"Microsoft-HTTPAPI/2.0"
141+
],
142+
"Transfer-Encoding": "chunked",
143+
"X-Content-Type-Options": "nosniff",
144+
"x-ms-client-request-id": "895b8dc4-305e-11ec-9ce7-5cf37093a909",
145+
"x-ms-request-id": "57626eb7-2002-0015-7e6b-c4666e000000",
146+
"x-ms-version": "2019-02-02"
147+
},
148+
"ResponseBody": {
149+
"odata.error": {
150+
"code": "ResourceNotFound",
151+
"message": {
152+
"lang": "en-US",
153+
"value": "The specified resource does not exist.\nRequestId:57626eb7-2002-0015-7e6b-c4666e000000\nTime:2021-10-18T21:58:27.3745385Z"
154+
}
155+
}
156+
}
157+
}
158+
],
159+
"Variables": {}
160+
}

0 commit comments

Comments
 (0)