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:
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.
_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?
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
charmlibsmonorepo, you can verify the setup by running:The documentation implies that this command will discover the interface's schema and tests and display them (showing
schema OKand 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 oldcharm-relation-interfacesrepo layout:interfaces/<name>/v<N>/interface_tests/. Thecharmlibsmonorepo uses a different layout:interfaces/<name>/interface/v<N>/tests/.The collector (
interface_tester/collector.py) does:for version_dir in interface_dir.glob("v*"):— globs for version dirs directly underinterfaces/<name>/, but charmlibs nests them underinterfaces/<name>/interface/v<N>/, so it finds nothing._DEFAULT_TESTS_DIR = "interface_tests"— but charmlibs usestests/.The
discoverCLI exposes no flags to override either. Runninginterface_tester discover --include ingressfrom a clone ofcanonical/charmlibsreturnsingress: <no tests>even thoughinterfaces/ingress/interface/v1/tests/test_provider.pyandinterfaces/ingress/interface/v2/tests/test_provider.pyexist with real tests.What to check
Can a charm developer follow the documented steps (clone charmlibs, run
just init --interface, editschema.pyandinterface.yaml, then runinterface_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?