Skip to content

Commit 15af9d6

Browse files
authored
[SchemaRegistry] add tests for error codes (#23140)
* add tests for error codes * increment avro version * async + remove extra imports * changelog version * westus recordings * add error codes
1 parent 3450455 commit 15af9d6

19 files changed

Lines changed: 954 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Accept:
6+
- application/json; serialization=Avro
7+
User-Agent:
8+
- azsdk-python-azureschemaregistry/1.0.0 Python/3.9.0 (Windows-10-10.0.22000-SP0)
9+
method: GET
10+
uri: https://fake_resource.servicebus.windows.net/$schemaGroups/$schemas/fakeschemaid?api-version=2021-10
11+
response:
12+
body:
13+
string: '{"error":{"code":"InvalidRequest","message":"SubCode=40000, UnknownType:The
14+
request is invalid. [MGResponseHttpError=BadRequest]. TrackingId:3c517544-9aca-4f8b-8089-f3a655aae13f_G45,
15+
SystemTracker:swathip-test-eh-westus.servicebus.windows.net:$schemaGroups\/$schemas\/fakeschemaid,
16+
Timestamp:2022-02-25T20:19:05"}}'
17+
headers:
18+
content-type: application/json
19+
date: Fri, 25 Feb 2022 20:19:04 GMT
20+
server: Microsoft-HTTPAPI/2.0
21+
strict-transport-security: max-age=31536000
22+
transfer-encoding: chunked
23+
x-ms-error-code: InvalidRequest
24+
status:
25+
code: 400
26+
message: Bad Request
27+
url: https://swathip-test-eh-westus.servicebus.windows.net/$schemaGroups/$schemas/fakeschemaid?api-version=2021-10
28+
version: 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Accept:
6+
- application/json
7+
Content-Type:
8+
- application/json; serialization=Avro
9+
User-Agent:
10+
- azsdk-python-azureschemaregistry/1.0.0 Python/3.9.0 (Windows-10-10.0.22000-SP0)
11+
method: POST
12+
uri: https://fake_resource.servicebus.windows.net/$schemaGroups/fakegroup/schemas/test-schema:get-id?api-version=2021-10
13+
response:
14+
body:
15+
string: '{"error":{"code":"InvalidRequest","message":"Error when consuming request
16+
body: The body of the message cannot be read because it is empty. TrackingId:233b1ccd-0d52-492b-b95e-03498dd0ff0a_G24,
17+
SystemTracker:swathip-test-eh-westus.servicebus.windows.net:$schemaGroups\/fakegroup\/schemas\/test-schema:get-id,
18+
Timestamp:2022-02-25T20:19:06"}}'
19+
headers:
20+
content-type: application/json
21+
date: Fri, 25 Feb 2022 20:19:06 GMT
22+
server: Microsoft-HTTPAPI/2.0
23+
strict-transport-security: max-age=31536000
24+
transfer-encoding: chunked
25+
x-ms-error-code: InvalidRequest
26+
status:
27+
code: 400
28+
message: Bad Request
29+
url: https://swathip-test-eh-westus.servicebus.windows.net/$schemaGroups/swathip-test-schema/schemas/test-schema:get-id?api-version=2021-10
30+
- request:
31+
body: '{"namespace":"example.avro","type":"record","name":"User","fields":[{"name":"name","type":"string"},{"name":"age","type":["int","null"]},{"name":"city","type":["string","null"]}]}'
32+
headers:
33+
Accept:
34+
- application/json
35+
Content-Length:
36+
- '179'
37+
Content-Type:
38+
- application/json; serialization=Invalid-format
39+
User-Agent:
40+
- azsdk-python-azureschemaregistry/1.0.0 Python/3.9.0 (Windows-10-10.0.22000-SP0)
41+
method: POST
42+
uri: https://fake_resource.servicebus.windows.net/$schemaGroups/fakegroup/schemas/test-schema:get-id?api-version=2021-10
43+
response:
44+
body:
45+
string: '{"error":{"code":"InvalidSchemaType","message":"Invalid schema type
46+
for POST request. ''invalid-format'' is not supported. TrackingId:922d1edf-b383-4647-90df-a4a7bcc1e24a_G24,
47+
SystemTracker:swathip-test-eh-westus.servicebus.windows.net:$schemaGroups\/fakegroup\/schemas\/test-schema:get-id,
48+
Timestamp:2022-02-25T20:19:07"}}'
49+
headers:
50+
content-type: application/json
51+
date: Fri, 25 Feb 2022 20:19:07 GMT
52+
server: Microsoft-HTTPAPI/2.0
53+
strict-transport-security: max-age=31536000
54+
transfer-encoding: chunked
55+
x-ms-error-code: InvalidSchemaType
56+
status:
57+
code: 415
58+
message: Unsupported Media Type
59+
url: https://swathip-test-eh-westus.servicebus.windows.net/$schemaGroups/swathip-test-schema/schemas/test-schema:get-id?api-version=2021-10
60+
- request:
61+
body: '{"namespace":"example.avro","type":"record","name":"User","fields":[{"name":"name","type":"string"},{"name":"age","type":["int","null"]},{"name":"city","type":["string","null"]}]}'
62+
headers:
63+
Accept:
64+
- application/json
65+
Content-Length:
66+
- '179'
67+
Content-Type:
68+
- application/json; serialization=Avro
69+
User-Agent:
70+
- azsdk-python-azureschemaregistry/1.0.0 Python/3.9.0 (Windows-10-10.0.22000-SP0)
71+
method: POST
72+
uri: https://fake_resource.servicebus.windows.net/$schemaGroups/fakegroup/schemas/never-registered:get-id?api-version=2021-10
73+
response:
74+
body:
75+
string: '{"error":{"code":"ItemNotFound","message":"Schema fakegroup\/never-registered
76+
does not exist. TrackingId:99848e4c-bd75-40c7-b262-0e308dd925c6_G24, SystemTracker:swathip-test-eh-westus.servicebus.windows.net:$schemaGroups\/fakegroup\/schemas\/never-registered:get-id,
77+
Timestamp:2022-02-25T20:19:08"}}'
78+
headers:
79+
content-type: application/json
80+
date: Fri, 25 Feb 2022 20:19:07 GMT
81+
server: Microsoft-HTTPAPI/2.0
82+
strict-transport-security: max-age=31536000
83+
transfer-encoding: chunked
84+
x-ms-error-code: ItemNotFound
85+
status:
86+
code: 404
87+
message: Not Found
88+
url: https://swathip-test-eh-westus.servicebus.windows.net/$schemaGroups/swathip-test-schema/schemas/never-registered:get-id?api-version=2021-10
89+
version: 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Accept:
6+
- application/json
7+
Content-Type:
8+
- application/json; serialization=Avro
9+
User-Agent:
10+
- azsdk-python-azureschemaregistry/1.0.0 Python/3.9.0 (Windows-10-10.0.22000-SP0)
11+
method: PUT
12+
uri: https://fake_resource.servicebus.windows.net/$schemaGroups/fakegroup/schemas/test-schema?api-version=2021-10
13+
response:
14+
body:
15+
string: '{"error":{"code":"InvalidRequest","message":"Error when consuming request
16+
body: The body of the message cannot be read because it is empty. TrackingId:41662499-f7ee-430f-b12c-be3e7adf1cc3_G25,
17+
SystemTracker:swathip-test-eh-westus.servicebus.windows.net:$schemaGroups\/fakegroup\/schemas\/test-schema,
18+
Timestamp:2022-02-25T20:19:09"}}'
19+
headers:
20+
content-type: application/json
21+
date: Fri, 25 Feb 2022 20:19:09 GMT
22+
server: Microsoft-HTTPAPI/2.0
23+
strict-transport-security: max-age=31536000
24+
transfer-encoding: chunked
25+
x-ms-error-code: InvalidRequest
26+
status:
27+
code: 400
28+
message: Bad Request
29+
url: https://swathip-test-eh-westus.servicebus.windows.net/$schemaGroups/swathip-test-schema/schemas/test-schema?api-version=2021-10
30+
- request:
31+
body: '{"namespace":"example.avro","type":"record","name":"User","fields":[{"name":"name","type":"string"},{"name":"age","type":["int","null"]},{"name":"city","type":["string","null"]}]}'
32+
headers:
33+
Accept:
34+
- application/json
35+
Content-Length:
36+
- '179'
37+
Content-Type:
38+
- application/json; serialization=Invalid-format
39+
User-Agent:
40+
- azsdk-python-azureschemaregistry/1.0.0 Python/3.9.0 (Windows-10-10.0.22000-SP0)
41+
method: PUT
42+
uri: https://fake_resource.servicebus.windows.net/$schemaGroups/fakegroup/schemas/test-schema?api-version=2021-10
43+
response:
44+
body:
45+
string: '{"error":{"code":"InvalidSchemaType","message":"Invalid schema type
46+
for PUT request. ''invalid-format'' is not supported. TrackingId:83aaf72b-8931-469b-8e48-bed0cd782de2_G25,
47+
SystemTracker:swathip-test-eh-westus.servicebus.windows.net:$schemaGroups\/fakegroup\/schemas\/test-schema,
48+
Timestamp:2022-02-25T20:19:10"}}'
49+
headers:
50+
content-type: application/json
51+
date: Fri, 25 Feb 2022 20:19:10 GMT
52+
server: Microsoft-HTTPAPI/2.0
53+
strict-transport-security: max-age=31536000
54+
transfer-encoding: chunked
55+
x-ms-error-code: InvalidSchemaType
56+
status:
57+
code: 415
58+
message: Unsupported Media Type
59+
url: https://swathip-test-eh-westus.servicebus.windows.net/$schemaGroups/swathip-test-schema/schemas/test-schema?api-version=2021-10
60+
version: 1

sdk/schemaregistry/azure-schemaregistry/tests/async_tests/recordings/test_schema_registry_async.test_schema_basic_async.yaml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ interactions:
1717
string: ''
1818
headers:
1919
content-length: '0'
20-
date: Mon, 08 Nov 2021 19:21:34 GMT
21-
location: https://fake_resource.servicebus.windows.net/:443/$schemagroups/fakegroup/schemas/test-schema-basic-asynce5e1482/versions/1?api-version=2021-10
20+
date: Fri, 25 Feb 2022 20:19:11 GMT
21+
location: https://swathip-test-eh-westus.servicebus.windows.net:443/$schemagroups/fakegroup/schemas/test-schema-basic-asynce5e1482/versions/1?api-version=2021-10
2222
schema-group-name: swathip-test-schema
23-
schema-id: 1051144b7fa7490ba07184606fd25d21
24-
schema-id-location: https://swathip-test-eventhubs.servicebus.windows.net:443/$schemagroups/$schemas/1051144b7fa7490ba07184606fd25d21?api-version=2021-10
23+
schema-id: c230786543c74ba0b3c249aa81a52129
24+
schema-id-location: https://swathip-test-eh-westus.servicebus.windows.net:443/$schemagroups/$schemas/c230786543c74ba0b3c249aa81a52129?api-version=2021-10
2525
schema-name: test-schema-basic-asynce5e1482
2626
schema-version: '1'
27-
schema-versions-location: https://swathip-test-eventhubs.servicebus.windows.net:443/$schemagroups/swathip-test-schema/schemas/test-schema-basic-asynce5e1482/versions?api-version=2021-10
27+
schema-versions-location: https://swathip-test-eh-westus.servicebus.windows.net:443/$schemagroups/swathip-test-schema/schemas/test-schema-basic-asynce5e1482/versions?api-version=2021-10
2828
server: Microsoft-HTTPAPI/2.0
2929
strict-transport-security: max-age=31536000
3030
status:
3131
code: 204
3232
message: No Content
33-
url: https://swathip-test-eventhubs.servicebus.windows.net/$schemaGroups/swathip-test-schema/schemas/test-schema-basic-asynce5e1482?api-version=2021-10
33+
url: https://swathip-test-eh-westus.servicebus.windows.net/$schemaGroups/swathip-test-schema/schemas/test-schema-basic-asynce5e1482?api-version=2021-10
3434
- request:
3535
body: null
3636
headers:
@@ -39,27 +39,27 @@ interactions:
3939
User-Agent:
4040
- azsdk-python-azureschemaregistry/1.0.0 Python/3.9.0 (Windows-10-10.0.22000-SP0)
4141
method: GET
42-
uri: https://fake_resource.servicebus.windows.net/$schemaGroups/$schemas/1051144b7fa7490ba07184606fd25d21?api-version=2021-10
42+
uri: https://fake_resource.servicebus.windows.net/$schemaGroups/$schemas/c230786543c74ba0b3c249aa81a52129?api-version=2021-10
4343
response:
4444
body:
4545
string: '{"namespace":"example.avro","type":"record","name":"User","fields":[{"name":"name","type":"string"},{"name":"favorite_number","type":["int","null"]},{"name":"favorite_color","type":["string","null"]}]}'
4646
headers:
4747
content-type: application/json;serialization=Avro
48-
date: Mon, 08 Nov 2021 19:21:34 GMT
49-
location: https://fake_resource.servicebus.windows.net/:443/$schemagroups/fakegroup/schemas/test-schema-basic-asynce5e1482/versions/1?api-version=2021-10
48+
date: Fri, 25 Feb 2022 20:19:12 GMT
49+
location: https://swathip-test-eh-westus.servicebus.windows.net:443/$schemagroups/fakegroup/schemas/test-schema-basic-asynce5e1482/versions/1?api-version=2021-10
5050
schema-group-name: swathip-test-schema
51-
schema-id: 1051144b7fa7490ba07184606fd25d21
52-
schema-id-location: https://swathip-test-eventhubs.servicebus.windows.net:443/$schemagroups/$schemas/1051144b7fa7490ba07184606fd25d21?api-version=2021-10
51+
schema-id: c230786543c74ba0b3c249aa81a52129
52+
schema-id-location: https://swathip-test-eh-westus.servicebus.windows.net:443/$schemagroups/$schemas/c230786543c74ba0b3c249aa81a52129?api-version=2021-10
5353
schema-name: test-schema-basic-asynce5e1482
5454
schema-version: '1'
55-
schema-versions-location: https://swathip-test-eventhubs.servicebus.windows.net:443/$schemagroups/swathip-test-schema/schemas/test-schema-basic-asynce5e1482/versions?api-version=2021-10
55+
schema-versions-location: https://swathip-test-eh-westus.servicebus.windows.net:443/$schemagroups/swathip-test-schema/schemas/test-schema-basic-asynce5e1482/versions?api-version=2021-10
5656
server: Microsoft-HTTPAPI/2.0
5757
strict-transport-security: max-age=31536000
5858
transfer-encoding: chunked
5959
status:
6060
code: 200
6161
message: OK
62-
url: https://swathip-test-eventhubs.servicebus.windows.net/$schemaGroups/$schemas/1051144b7fa7490ba07184606fd25d21?api-version=2021-10
62+
url: https://swathip-test-eh-westus.servicebus.windows.net/$schemaGroups/$schemas/c230786543c74ba0b3c249aa81a52129?api-version=2021-10
6363
- request:
6464
body: '{"namespace":"example.avro","type":"record","name":"User","fields":[{"name":"name","type":"string"},{"name":"favorite_number","type":["int","null"]},{"name":"favorite_color","type":["string","null"]}]}'
6565
headers:
@@ -78,18 +78,18 @@ interactions:
7878
string: ''
7979
headers:
8080
content-length: '0'
81-
date: Mon, 08 Nov 2021 19:21:35 GMT
82-
location: https://fake_resource.servicebus.windows.net/:443/$schemagroups/fakegroup/schemas/test-schema-basic-asynce5e1482/versions/1?api-version=2021-10
81+
date: Fri, 25 Feb 2022 20:19:12 GMT
82+
location: https://swathip-test-eh-westus.servicebus.windows.net:443/$schemagroups/fakegroup/schemas/test-schema-basic-asynce5e1482/versions/1?api-version=2021-10
8383
schema-group-name: swathip-test-schema
84-
schema-id: 1051144b7fa7490ba07184606fd25d21
85-
schema-id-location: https://swathip-test-eventhubs.servicebus.windows.net:443/$schemagroups/$schemas/1051144b7fa7490ba07184606fd25d21?api-version=2021-10
84+
schema-id: c230786543c74ba0b3c249aa81a52129
85+
schema-id-location: https://swathip-test-eh-westus.servicebus.windows.net:443/$schemagroups/$schemas/c230786543c74ba0b3c249aa81a52129?api-version=2021-10
8686
schema-name: test-schema-basic-asynce5e1482
8787
schema-version: '1'
88-
schema-versions-location: https://swathip-test-eventhubs.servicebus.windows.net:443/$schemagroups/swathip-test-schema/schemas/test-schema-basic-asynce5e1482/versions?api-version=2021-10
88+
schema-versions-location: https://swathip-test-eh-westus.servicebus.windows.net:443/$schemagroups/swathip-test-schema/schemas/test-schema-basic-asynce5e1482/versions?api-version=2021-10
8989
server: Microsoft-HTTPAPI/2.0
9090
strict-transport-security: max-age=31536000
9191
status:
9292
code: 204
9393
message: No Content
94-
url: https://swathip-test-eventhubs.servicebus.windows.net/$schemaGroups/swathip-test-schema/schemas/test-schema-basic-asynce5e1482:get-id?api-version=2021-10
94+
url: https://swathip-test-eh-westus.servicebus.windows.net/$schemaGroups/swathip-test-schema/schemas/test-schema-basic-asynce5e1482:get-id?api-version=2021-10
9595
version: 1

sdk/schemaregistry/azure-schemaregistry/tests/async_tests/recordings/test_schema_registry_async.test_schema_negative_no_schema_async.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@ interactions:
1010
uri: https://fake_resource.servicebus.windows.net/$schemaGroups/$schemas/a?api-version=2021-10
1111
response:
1212
body:
13-
string: '{"Code":400,"Detail":"SubCode=40000, UnknownType:The request is invalid.
14-
[MGResponseHttpError=BadRequest]. TrackingId:22b913ba-a4d9-4799-8f94-a6c248869d77_G28,
15-
SystemTracker:fake_resource.servicebus.windows.net/:$schemaGroups\/$schemas\/a,
16-
Timestamp:2021-11-08T19:21:36"}'
13+
string: '{"error":{"code":"InvalidRequest","message":"SubCode=40000, UnknownType:The
14+
request is invalid. [MGResponseHttpError=BadRequest]. TrackingId:3cf9d0ba-3904-457b-867a-c113f1e4aac7_G40,
15+
SystemTracker:swathip-test-eh-westus.servicebus.windows.net:$schemaGroups\/$schemas\/a,
16+
Timestamp:2022-02-25T20:19:14"}}'
1717
headers:
1818
content-type: application/json
19-
date: Mon, 08 Nov 2021 19:21:35 GMT
19+
date: Fri, 25 Feb 2022 20:19:14 GMT
2020
server: Microsoft-HTTPAPI/2.0
2121
strict-transport-security: max-age=31536000
2222
transfer-encoding: chunked
23+
x-ms-error-code: InvalidRequest
2324
status:
2425
code: 400
2526
message: Bad Request
26-
url: https://swathip-test-eventhubs.servicebus.windows.net/$schemaGroups/$schemas/a?api-version=2021-10
27+
url: https://swathip-test-eh-westus.servicebus.windows.net/$schemaGroups/$schemas/a?api-version=2021-10
2728
- request:
2829
body: null
2930
headers:
@@ -35,17 +36,18 @@ interactions:
3536
uri: https://fake_resource.servicebus.windows.net/$schemaGroups/$schemas/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa?api-version=2021-10
3637
response:
3738
body:
38-
string: '{"Code":404,"Detail":"Schema id aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa does
39-
not exist. TrackingId:fae7aad8-cc69-417b-b713-86c4760011ed_G28, SystemTracker:fake_resource.servicebus.windows.net/:$schemaGroups\/$schemas\/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
40-
Timestamp:2021-11-08T19:21:36"}'
39+
string: '{"error":{"code":"ItemNotFound","message":"Schema id aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
40+
does not exist. TrackingId:4595411b-59ad-47d6-acf5-8cb4e439f738_G40, SystemTracker:swathip-test-eh-westus.servicebus.windows.net:$schemaGroups\/$schemas\/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
41+
Timestamp:2022-02-25T20:19:15"}}'
4142
headers:
4243
content-type: application/json
43-
date: Mon, 08 Nov 2021 19:21:36 GMT
44+
date: Fri, 25 Feb 2022 20:19:14 GMT
4445
server: Microsoft-HTTPAPI/2.0
4546
strict-transport-security: max-age=31536000
4647
transfer-encoding: chunked
48+
x-ms-error-code: ItemNotFound
4749
status:
4850
code: 404
4951
message: Not Found
50-
url: https://swathip-test-eventhubs.servicebus.windows.net/$schemaGroups/$schemas/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa?api-version=2021-10
52+
url: https://swathip-test-eh-westus.servicebus.windows.net/$schemaGroups/$schemas/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa?api-version=2021-10
5153
version: 1

0 commit comments

Comments
 (0)