From 2b648d8e8d546c2b04fad2e4521cb671755fa8d7 Mon Sep 17 00:00:00 2001 From: James Garner Date: Mon, 31 Aug 2026 21:03:31 +1200 Subject: [PATCH] chore(interfaces): move the analytics interface schemas to the new format Interface schemas no longer wrap their models in the `ProviderSchema` and `RequirerSchema` classes from `pytest-interface-tester`. Instead a schema names all four databags directly, as `ProviderAppData`, `ProviderUnitData`, `RequirerAppData` and `RequirerUnitData`, setting a databag that is always empty to `None`. Naming all four makes an empty databag a deliberate choice a reviewer can see, and makes a misspelled name an error rather than a silently empty databag. The models are unchanged; only the wrapper classes around them are gone. Dropping the `pytest-interface-tester` import leaves Pydantic as the only dependency needed to read a schema. This also removes the interface test definitions for these interfaces. The interface tests are being retired; the tooling that ran them is removed separately. A follow-up PR documents the format and adds a CI check for it, once every interface has been migrated. Co-Authored-By: Claude Opus 5 --- interfaces/k8s_backup_target/ruff.toml | 7 ------ .../interfaces/k8s_backup_target/_schema.py | 5 ++++ .../interface/v0/interface.yaml | 12 ---------- .../interface/v0/schema.py | 15 +++--------- .../interface/v0/tests/.disable | 0 .../interface/v0/tests/test_provider.py | 23 ------------------- interfaces/velero_backup_config/ruff.toml | 7 ------ 7 files changed, 8 insertions(+), 61 deletions(-) delete mode 100644 interfaces/velero_backup_config/interface/v0/tests/.disable delete mode 100644 interfaces/velero_backup_config/interface/v0/tests/test_provider.py diff --git a/interfaces/k8s_backup_target/ruff.toml b/interfaces/k8s_backup_target/ruff.toml index efbd8c5cc..79b043b3f 100644 --- a/interfaces/k8s_backup_target/ruff.toml +++ b/interfaces/k8s_backup_target/ruff.toml @@ -9,10 +9,3 @@ quote-style = "preserve" "D", # docs "E501", # line too long ] -"./interface/v*/tests/*.py" = [ - "CPY", # copyright - "D", # docs - "S", # security - "E501", # line too long - "F841", # assignment to unused variable -] diff --git a/interfaces/k8s_backup_target/src/charmlibs/interfaces/k8s_backup_target/_schema.py b/interfaces/k8s_backup_target/src/charmlibs/interfaces/k8s_backup_target/_schema.py index ab4161c2b..a537992ed 100644 --- a/interfaces/k8s_backup_target/src/charmlibs/interfaces/k8s_backup_target/_schema.py +++ b/interfaces/k8s_backup_target/src/charmlibs/interfaces/k8s_backup_target/_schema.py @@ -128,3 +128,8 @@ class ProviderAppData(BaseModel): description="List of backup target entries.", title="Backup Targets", ) + + +ProviderUnitData = None +RequirerAppData = None +RequirerUnitData = None diff --git a/interfaces/velero_backup_config/interface/v0/interface.yaml b/interfaces/velero_backup_config/interface/v0/interface.yaml index ae7d5f3d7..0166b9399 100644 --- a/interfaces/velero_backup_config/interface/v0/interface.yaml +++ b/interfaces/velero_backup_config/interface/v0/interface.yaml @@ -14,23 +14,11 @@ providers: - name: mlmd-operator url: https://github.com/canonical/mlmd-operator branch: main - test_setup: - pre_run: "poetry export --without-hashes --with unit --with charm --format=requirements.txt > requirements.txt" - location: tests/interface_tests/conftest.py - identifier: interface_tester - name: minio-operator url: https://github.com/canonical/minio-operator branch: main - test_setup: - pre_run: "poetry export --without-hashes --with unit --with charm --format=requirements.txt > requirements.txt" - location: tests/interface_tests/conftest.py - identifier: interface_tester - name: kubeflow-profiles-operator url: https://github.com/canonical/kubeflow-profiles-operator branch: main - test_setup: - pre_run: "poetry export --without-hashes --with unit --with charm --format=requirements.txt > requirements.txt" - location: tests/interface_tests/conftest.py - identifier: interface_tester maintainer: analytics diff --git a/interfaces/velero_backup_config/interface/v0/schema.py b/interfaces/velero_backup_config/interface/v0/schema.py index 1e0ec270a..b0759940a 100644 --- a/interfaces/velero_backup_config/interface/v0/schema.py +++ b/interfaces/velero_backup_config/interface/v0/schema.py @@ -2,7 +2,6 @@ # See LICENSE file for licensing details. -from interface_tester.schema_base import DataBagSchema from pydantic import BaseModel, Field @@ -87,14 +86,6 @@ class RequirerAppData(BaseModel): ) -class RequirerSchema(DataBagSchema): - """Schema for the requirer (client) side of velero-backup-config.""" - - app: RequirerAppData - - -class ProviderSchema(DataBagSchema): - """Schema for the provider (Velero Operator) side of velero-backup-config.""" - - # The provider sends no data, so no app or unit fields are defined. - pass +ProviderAppData = None +ProviderUnitData = None +RequirerUnitData = None diff --git a/interfaces/velero_backup_config/interface/v0/tests/.disable b/interfaces/velero_backup_config/interface/v0/tests/.disable deleted file mode 100644 index e69de29bb..000000000 diff --git a/interfaces/velero_backup_config/interface/v0/tests/test_provider.py b/interfaces/velero_backup_config/interface/v0/tests/test_provider.py deleted file mode 100644 index de2f14a7a..000000000 --- a/interfaces/velero_backup_config/interface/v0/tests/test_provider.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2025 Canonical -# See LICENSE file for licensing details. - -from interface_tester import Tester -from scenario import State - - -def test_data_on_created(): - t = Tester(State(leader=True)) - state_out = t.run("velero-backup-config-relation-created") - t.assert_schema_valid() - - -def test_data_on_joined(): - t = Tester(State(leader=True)) - state_out = t.run("velero-backup-config-relation-joined") - t.assert_schema_valid() - - -def test_data_on_changed(): - t = Tester(State(leader=True)) - state_out = t.run("velero-backup-config-relation-changed") - t.assert_schema_valid() diff --git a/interfaces/velero_backup_config/ruff.toml b/interfaces/velero_backup_config/ruff.toml index efbd8c5cc..79b043b3f 100644 --- a/interfaces/velero_backup_config/ruff.toml +++ b/interfaces/velero_backup_config/ruff.toml @@ -9,10 +9,3 @@ quote-style = "preserve" "D", # docs "E501", # line too long ] -"./interface/v*/tests/*.py" = [ - "CPY", # copyright - "D", # docs - "S", # security - "E501", # line too long - "F841", # assignment to unused variable -]