Skip to content

interface_tester discover --include <name> works from the charmlibs repo root to verify interface schema and tests #66

Description

@dwilding

Documentation claim to test

Page: How to manage interfaces (steps 4 and 6 of "Register an interface", and the "Write tests for an interface" section)

PR: canonical/operator#2710

Claim

The documentation says that after creating a new interface specification in the charmlibs monorepo, you can verify the setup by running:

pip install pytest-interface-tester
interface_tester discover --include my_fancy_database

"To verify that things work as they should, you can pip install pytest-interface-tester and then run interface_tester discover --include my_fancy_database from the charmlibs root."

The documentation implies that this command will discover the interface's schema and tests and display them (showing schema OK and listing test cases, or <no tests> if tests haven't been written yet).

Why this may be wrong

pytest-interface-tester (v3.4.1, the latest) was designed for the old charm-relation-interfaces repo layout: interfaces/<name>/v<N>/interface_tests/. The charmlibs monorepo uses a different layout: interfaces/<name>/interface/v<N>/tests/.

The collector (interface_tester/collector.py) does:

  1. for version_dir in interface_dir.glob("v*"): — globs for version dirs directly under interfaces/<name>/, but charmlibs nests them under interfaces/<name>/interface/v<N>/, so it finds nothing.
  2. _DEFAULT_TESTS_DIR = "interface_tests" — but charmlibs uses tests/.

The discover CLI exposes no flags to override either. Running interface_tester discover --include ingress from a clone of canonical/charmlibs returns ingress: <no tests> even though interfaces/ingress/interface/v1/tests/test_provider.py and interfaces/ingress/interface/v2/tests/test_provider.py exist with real tests.

What to check

Can a charm developer follow the documented steps (clone charmlibs, run just init --interface, edit schema.py and interface.yaml, then run interface_tester discover --include <name>) and get meaningful verification output? Or does the command silently return <no tests> regardless of whether the schema and tests are correct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions