-
Notifications
You must be signed in to change notification settings - Fork 63
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
Improve tag mapping specs #170
Conversation
@miq-bot add-label test, gaprindashvili/yes @zeari @moolitayer Please review |
@cben so this change is testing that additional tags that did not come back in refresh are not removed? |
@moolitayer This tests not removing a user-defined user-assigned tag. We should of course be removing mapping-generated mapping-assigned tags, when the label disappears. |
4f7d2e6
to
54595b6
Compare
- Use factory for more accurate test. Previous test didn't set read_only nor used 'kubernetes:' prefix, will fail with upcoming retagging implementation. - Test that we don't remove user-assigned tags.
54595b6
to
5b594f3
Compare
Fixed potential double tagging on 3rd refresh. |
Checked commit cben@5b594f3 with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0 |
|
||
# Now records exist, simulate user assigning tags by Edit Tags, to test later refreshes don't remove them. | ||
@replicator.reload.tags |= [@user_tag] | ||
@containergroup.reload.tags |= [@user_tag] |
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.
I might be missing something, but if the refresh does remove the user tags won't this code re set them?
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.
No. This was a tricky point with the loop but is simpler now it's unrolled:
here is the one and only time we set the user tag.
next 2 full refreshes only perform refresh, and assert the tag is still assigned.
Do you see any clearer way to write this? I'm really happy with the structure I reached currently, but what matters is somebody else being able to understand...
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.
LGTM 👍
@replicator.reload.tags |= [@user_tag]
means
@replicator.reload.tags = @replicator.reload.tags | [@user_tag]
right?
do we reload here twice?
Merging and we can reiterate if needed, thanks!
Improve tag mapping specs (cherry picked from commit ef60398)
Gaprindashvili backport details:
|
Split from #162
Use factory for more accurate test, matching UI-created mapping categories.
Previous test didn't set read_only nor used 'kubernetes:' prefix,
failed with attempted retagging implementation Replace ContainerLabelTagMapping.controls_tag? with Tag.controlled_by_mapping scope manageiq#16449
and will fail with its upcoming replacement.
Test that we don't remove user-assigned tags.