def client():
    url = os.getenv("SCHEMA_REGISTRY_URL",
                    "http://schema-registry-server:8081")
    client = SchemaRegistryClient(url)
    yield client

    subjects = {
        "test-basic-schema",
        "test-deployment",
        "test-country",
        "test-basic-schema-backup",
        "test-advance-schema",
        "test-user-schema",
        "subject-does-not-exist",
        "test-logical-types-schema",
        "test-schema-version",
        "test-nested-schema",
    }

    # Executing the clean up. Delete all the subjects between tests.
    for subject in subjects:
        try:
            client.delete_subject(subject)
        except errors.ClientError as exc:
            logger.info(exc.message)
Пример #2
0
def delete_subject(client: SchemaRegistryClient, topic: str):
    subjects = client.get_subjects()
    key_subject = f"{topic}-key"
    value_subject = f"{topic}-value"
    if key_subject in subjects:
        client.delete_subject(key_subject)
    if value_subject in subjects:
        client.delete_subject(value_subject)