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
NIFI-10834 Fixed Flaky Test failing with NonDex #6672
Conversation
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.
Thanks for the contribution @priyanka-28. Although the proposed changes provide one potential solution, the additional swap and permute methods add some complexity to the unit test class. The check for the path attribute is helpful, but it seems like it would be simpler to just check that the path starts with the expected URL path, instead of attempting to check the entire string. This would avoid the need for the complex string parsing.
@@ -131,7 +172,7 @@ public void testHappyPathWithCustomQueryParameters() throws Exception { | |||
|
|||
// then | |||
testRunner.assertAllFlowFilesTransferred(PutSplunkHTTP.RELATIONSHIP_SUCCESS, 1); | |||
assertEquals("/services/collector/raw?sourcetype=test%3Fsource%3Ftype&source=test_source", path.getValue()); | |||
assertTrue(returnPermuations("/services/collector/raw?sourcetype=test%3Fsource%3Ftype&source=test_source").contains(path.getValue())); |
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.
assertTrue(returnPermuations("/services/collector/raw?sourcetype=test%3Fsource%3Ftype&source=test_source").contains(path.getValue())); | |
assertTrue(path.getValue().startsWith("/services/collector/raw")); |
@@ -163,7 +204,7 @@ public void testHappyPathWithCustomQueryParametersFromFlowFile() throws Exceptio | |||
|
|||
// then | |||
testRunner.assertAllFlowFilesTransferred(PutSplunkHTTP.RELATIONSHIP_SUCCESS, 1); | |||
assertEquals("/services/collector/raw?host=test_host&index=test_index&sourcetype=test%3Fsource%3Ftype&source=test_source", path.getValue()); | |||
assertTrue(returnPermuations("/services/collector/raw?host=test_host&index=test_index&sourcetype=test%3Fsource%3Ftype&source=test_source").contains(path.getValue())); |
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.
assertTrue(returnPermuations("/services/collector/raw?host=test_host&index=test_index&sourcetype=test%3Fsource%3Ftype&source=test_source").contains(path.getValue())); | |
assertTrue(path.getValue().startsWith("/services/collector/raw")); |
Thank you for your reply! I have added the updated changes |
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.
Thanks for making the adjustments @priyanka-28, the latest version looks good! +1 merging
This closes #6672 Signed-off-by: David Handermann <exceptionfactory@apache.org>
This closes apache#6672 Signed-off-by: David Handermann <exceptionfactory@apache.org>
Summary
NIFI-10834
Tests under TestPutSplunkHTTP express non-deterministic behavior as the order of the query parameters in the URL changes. The fix is generating all possible permutations of the query parameter and then checking the generated permutations with the value passed in the 'Assert' function to ensure deterministic behavior.
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000
NIFI-00000
Pull Request Formatting
main
branchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-check
Licensing
LICENSE
andNOTICE
filesDocumentation