Skip to content

Commit 8060bd0

Browse files
author
Matt Howlett
authored
Fix SR integration tests (confluentinc#1060)
* Fix SR integration tests * fix flake8 problem
1 parent 1365d13 commit 8060bd0

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

tests/integration/schema_registry/test_api_client.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,21 @@ def test_api_register_schema_incompatible(kafka_cluster, load_file):
5959
6060
"""
6161
sr = kafka_cluster.schema_registry()
62-
schema1 = Schema(load_file('adv_schema.avsc'), schema_type='AVRO')
63-
schema2 = Schema(load_file('basic_schema.avsc'), schema_type='AVRO')
62+
schema1 = Schema(load_file('basic_schema.avsc'), schema_type='AVRO')
63+
schema2 = Schema(load_file('adv_schema.avsc'), schema_type='AVRO')
6464
subject = _subject_name('test_register_incompatible')
6565

6666
sr.register_schema(subject, schema1)
6767

6868
with pytest.raises(SchemaRegistryError, match="Schema being registered is"
6969
" incompatible with an"
7070
" earlier schema") as e:
71+
# The default Schema Registry compatibility type is BACKWARD.
72+
# this allows 1) fields to be deleted, 2) optional fields to
73+
# be added. schema2 adds non-optional fields to schema1, so
74+
# registering schema2 after schema1 should fail.
7175
sr.register_schema(subject, schema2)
72-
assert e.value.http_status_code == 409
76+
assert e.value.http_status_code == 409 # conflict
7377
assert e.value.error_code == 409
7478

7579

@@ -237,6 +241,9 @@ def test_api_get_subject_versions(kafka_cluster, load_file):
237241
assert registered_schema.subject == subject
238242
assert registered_schema.version in versions
239243

244+
# revert global compatibility level back to the default.
245+
sr.set_compatibility(level="BACKWARD")
246+
240247

241248
def test_api_delete_subject(kafka_cluster, load_file):
242249
"""
@@ -416,6 +423,9 @@ def test_api_config_update(kafka_cluster):
416423
sr.set_compatibility(level=level)
417424
assert sr.get_compatibility() == level
418425

426+
# revert global compatibility level back to the default.
427+
sr.set_compatibility(level="BACKWARD")
428+
419429

420430
def test_api_register_logical_schema(kafka_cluster, load_file):
421431
sr = kafka_cluster.schema_registry()

tests/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pytest==4.6.9;python_version<="3.0"
33
pytest>=6.0.0;python_version>="3.0"
44
pytest-timeout
55
requests-mock
6-
trivup>=0.8.2
6+
trivup>=0.8.3
77
fastavro
88
avro
99
jsonschema

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy