-
Notifications
You must be signed in to change notification settings - Fork 60
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
NOJIRA: Test through tuple traversal #1295
base: master
Are you sure you want to change the base?
NOJIRA: Test through tuple traversal #1295
Conversation
8eefbd7
to
b8d18f9
Compare
group_filter: Callable[[T], bool] = lambda _: True, | ||
require_full_match: bool = False, | ||
match_once: bool = True, | ||
) -> Tuple[dict[T, "TupleSet"], dict[T, "TupleSet"]]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These methods are just moved from InMemoryTuples.
Basically we reorganized things a little bit so that results from InMemoryTuples return a TupleSet type which can be further filtered. The novelty of this PR is that it adds a traverse_subjects
method in this queryset which is not a filter but a traversal.
traversed = self._full_set.find_tuples( | ||
resource(tuple.subject_type_namespace, tuple.subject_type_name, tuple.subject_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key bit here is that this uses the full set of tuples to search, not just what was filtered in this result set. This result set is just used as the base for traversal (using the resource
predicate for each subject in this set).
Link(s) to Jira
Description of Intent of Change(s)
I wanted to test the migrator a bit more, without relying on implementation detail like BindingMappings. To do this I experimented with some change to InMemoryTuples to allow traversing the tuples so we can test relationships without necessarily having to first lookup every ID, which is helpful when we don't know (or care) about specific IDs (e.g. they are random), but mainly the relationships between objects.
This should be generally helpful when testing replication and tuple mapping.
Local Testing
How can the feature be exercised?
How can the bug be exploited and fix confirmed?
Is any special local setup required?
Checklist
Secure Coding Practices Checklist Link
Secure Coding Practices Checklist