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

PodTemplateUtils#combine shouldn't have a side-effect on the parent pod template #853

Merged

Conversation

Vlatombe
Copy link
Member

@Vlatombe Vlatombe commented Oct 2, 2020

@Vlatombe Vlatombe requested a review from jglick October 2, 2020 09:53
@Vlatombe Vlatombe changed the title PodTemplateUtils#combine shouldn't have a side-effect on the parent pod template PodTemplateUtils#combine shouldn't have a side-effect on the parent pod template Oct 2, 2020
@Vlatombe Vlatombe added the bug Bug Fixes label Oct 2, 2020
assertThat(result.getNodeProperties(), hasItems(nodeProperties1.get(0),nodeProperties2.get(0)));
assertThat(podTemplate1.getNodeProperties(), contains(toolHome1));
assertThat(podTemplate2.getNodeProperties(), contains(toolHome2));
assertThat(result.getNodeProperties(), contains(toolHome1, toolHome2));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this test reproducing the bug? I thought that the problem was that the parent template would grow endlessly, so we should have a test asserting that after combination the parent template does not contain some property.

Copy link
Contributor

@kerogers-cloudbees kerogers-cloudbees Oct 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or that the size of the parent template's nodeProperties didn't change.

Copy link
Member Author

@Vlatombe Vlatombe Oct 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First assertion failed with the previous code, since there was a side-effect on the first pod template. Note that contains does an exact match of all specified elements, unlike hasItems.

@Vlatombe Vlatombe merged commit e83e51f into jenkinsci:master Oct 5, 2020
@Vlatombe Vlatombe deleted the podtemplateutils-combine-nodeproperties branch October 5, 2020 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants