From c85f4aa842a4ed5f2cc73fa72b9e897276c3498d Mon Sep 17 00:00:00 2001 From: amstee Date: Wed, 31 Jul 2024 16:44:10 +0100 Subject: [PATCH] chore: lint --- .../schema_registry/test_jsonschema.py | 13 ++++++++++++- tests/integration/test_schema_protobuf.py | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/tests/integration/schema_registry/test_jsonschema.py b/tests/integration/schema_registry/test_jsonschema.py index 4c80e20fd..4b6440bb3 100644 --- a/tests/integration/schema_registry/test_jsonschema.py +++ b/tests/integration/schema_registry/test_jsonschema.py @@ -97,6 +97,7 @@ TYPES_STRING_SCHEMA, ) from tests.utils import new_random_name +from typing import Any, Dict import json import pytest @@ -234,8 +235,14 @@ async def not_schemas_are_backward_compatible( @pytest.mark.parametrize("trail", ["", "/"]) @pytest.mark.parametrize("compatibility", [CompatibilityModes.FORWARD, CompatibilityModes.BACKWARD, CompatibilityModes.FULL]) +@pytest.mark.parametrize("metadata", [None, {}]) +@pytest.mark.parametrize("rule_set", [None, {}]) async def test_same_jsonschema_must_have_same_id( - registry_async_client: Client, compatibility: CompatibilityModes, trail: str + registry_async_client: Client, + compatibility: CompatibilityModes, + trail: str, + metadata: Dict[str, Any], + rule_set: Dict[str, Any], ) -> None: for schema in ALL_SCHEMAS: subject = new_random_name("subject") @@ -248,6 +255,8 @@ async def test_same_jsonschema_must_have_same_id( json={ "schema": json.dumps(schema.schema), "schemaType": SchemaType.JSONSCHEMA.value, + "metadata": metadata, + "ruleSet": rule_set, }, ) assert first_res.status_code == 200 @@ -259,6 +268,8 @@ async def test_same_jsonschema_must_have_same_id( json={ "schema": json.dumps(schema.schema), "schemaType": SchemaType.JSONSCHEMA.value, + "metadata": metadata, + "ruleSet": rule_set, }, ) assert second_res.status_code == 200 diff --git a/tests/integration/test_schema_protobuf.py b/tests/integration/test_schema_protobuf.py index 10df70637..c14650a2d 100644 --- a/tests/integration/test_schema_protobuf.py +++ b/tests/integration/test_schema_protobuf.py @@ -12,7 +12,7 @@ from karapace.typing import JsonData from tests.base_testcase import BaseTestCase from tests.utils import create_subject_name_factory -from typing import List, Optional, Union +from typing import Any, Dict, List, Optional, Union import logging import pytest @@ -963,11 +963,20 @@ class ReferenceTestCase(BaseTestCase): ], ids=str, ) -async def test_references(testcase: ReferenceTestCase, registry_async_client: Client): +@pytest.mark.parametrize("metadata", [None, {}]) +@pytest.mark.parametrize("rule_set", [None, {}]) +async def test_references( + testcase: ReferenceTestCase, registry_async_client: Client, metadata: Dict[str, Any], rule_set: Dict[str, Any] +): for testdata in testcase.schemas: if isinstance(testdata, TestCaseSchema): print(f"Adding new schema, subject: '{testdata.subject}'\n{testdata.schema_str}") - body = {"schemaType": testdata.schema_type, "schema": testdata.schema_str} + body = { + "schemaType": testdata.schema_type, + "schema": testdata.schema_str, + "metadata": metadata, + "ruleSet": rule_set, + } if testdata.references: body["references"] = testdata.references res = await registry_async_client.post(f"subjects/{testdata.subject}/versions", json=body)