Skip to content

Commit

Permalink
Fix confusion of whether role_names are before or after rolemapping: …
Browse files Browse the repository at this point in the history
…better name of function: needed_constellation_role_names, fixes role mapping issue (#352)

Co-authored-by: Johannes Ernst <git@j12t.org>
  • Loading branch information
jernst and Johannes Ernst authored Sep 21, 2024
1 parent 996106d commit 84e736b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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

0 comments on commit 84e736b

Please sign in to comment.