Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix node role mapping #352

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/feditest/testplan.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def get_test(self, context_msg : str = "" ) -> 'feditest.Test':
return ret


def needed_role_names(self, context_msg : str = "" ) -> set[str]:
def needed_constellation_role_names(self, context_msg : str = "" ) -> set[str]:
"""
Return the names of the constellation roles needed after translation from whatever the test itself
might call them locally.
Expand All @@ -318,8 +318,8 @@ def needed_role_names(self, context_msg : str = "" ) -> set[str]:

def check_can_be_executed(self, constellation: TestPlanConstellation, context_msg: str = "") -> None:
test_context_msg = context_msg + f'Test "{ self.name }": '
needed_role_names = self.needed_role_names(context_msg) # may raise
constellation.check_defines_all_role_names(needed_role_names, test_context_msg )
needed_constellation_role_names = self.needed_constellation_role_names(context_msg) # may raise
constellation.check_defines_all_role_names(needed_constellation_role_names, test_context_msg )


def simplify(self) -> None:
Expand Down Expand Up @@ -387,10 +387,10 @@ def check_can_be_executed(self, context_msg: str = "") -> None:
test_spec.check_can_be_executed(self.constellation, context_msg + f'Test (index {index}): ')


def needed_role_names(self) -> set[str]:
def needed_constellation_role_names(self) -> set[str]:
ret = set()
for test in self.tests:
ret |= test.needed_role_names()
ret |= test.needed_constellation_role_names()
return ret


Expand All @@ -399,7 +399,7 @@ def instantiate_with_constellation(self, constellation: TestPlanConstellation, n
Treat this session as a template. Create a new (non-template) session that's like this one
and that uses the provided constellation.
"""
constellation.check_defines_all_role_names(self.needed_role_names())
constellation.check_defines_all_role_names(self.needed_constellation_role_names())
return TestPlanSession(constellation=constellation,tests=self.tests, name=name)


Expand Down
2 changes: 1 addition & 1 deletion src/feditest/testrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def run(self, controller: feditest.testruncontroller.TestRunController) -> None:
info(f'Started test { self.str_in_session() }')

args = {}
for local_role_name in self.plan_testspec.needed_role_names():
for local_role_name in self.plan_testspec.get_test().needed_local_role_names():
constellation_role_name = local_role_name
if self.plan_testspec.rolemapping and local_role_name in self.plan_testspec.rolemapping:
constellation_role_name = self.plan_testspec.rolemapping[local_role_name]
Expand Down
Loading