diff --git a/interface_tester/plugin.py b/interface_tester/plugin.py index 0c475a8..175d314 100644 --- a/interface_tester/plugin.py +++ b/interface_tester/plugin.py @@ -69,7 +69,6 @@ def configure( meta: Optional[Dict[str, Any]] = None, actions: Optional[Dict[str, Any]] = None, config: Optional[Dict[str, Any]] = None, - endpoint: Optional[str] = None, ): """ @@ -84,8 +83,6 @@ def configure( :param meta: charm metadata.yaml contents. :param actions: charm actions.yaml contents. :param config: charm config.yaml contents. - :param endpoint: endpoint to test. In case there are multiple - endpoints with the same interface. :param juju_version: juju version that Scenario will simulate (also sets JUJU_VERSION envvar at charm runtime.) """ @@ -99,8 +96,6 @@ def configure( self._config = config if repo: self._repo = repo - if endpoint: - self._endpoint = endpoint if interface_name: self._interface_name = interface_name if interface_version is not None: @@ -284,13 +279,14 @@ def _yield_tests( raise RuntimeError(f"this charm does not declare any endpoint using {interface_name}.") role: RoleLiteral - for role in supported_endpoints: + for role, endpoints in supported_endpoints.items(): logger.debug(f"collecting scenes for {role}") spec = tests[role] schema = spec["schema"] for test in spec["tests"]: - yield test, role, schema + for endpoint in endpoints: + yield test, role, schema, endpoint def __repr__(self): return f""" bool: errors = [] ran_some = False - for test_fn, role, schema in self._yield_tests(): + for test_fn, role, schema, endpoint in self._yield_tests(): ctx = _InterfaceTestContext( role=role, schema=schema, @@ -331,7 +326,7 @@ def run(self) -> bool: supported_endpoints=self._gather_supported_endpoints(), test_fn=test_fn, juju_version=self._juju_version, - endpoint=self._endpoint, + endpoint=endpoint, ) try: with tester_context(ctx):