-
Notifications
You must be signed in to change notification settings - Fork 207
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
[BUG] Fixed some failing unit tests on Windows #968
Conversation
Signed-off-by: Taylor Gray <[email protected]>
Signed-off-by: Taylor Gray <[email protected]>
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 improving our tests!
@@ -93,7 +93,7 @@ public void testBuild_withoutTimeReceived() { | |||
final Instant timeReceived = result.getTimeReceived(); | |||
assertThat(timeReceived, notNullValue()); | |||
assertThat(timeReceived, is(greaterThan(before))); | |||
assertThat(timeReceived, is(lessThan(Instant.now()))); | |||
assertThat(timeReceived, is(lessThan(Instant.now().plusSeconds(1)))); |
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'm guessing you are adding second incase the times are the same. You be able to use lessThanOrEqualTo
instead.
@@ -65,10 +67,12 @@ public void testGivenNullArgumentThenThrowException() { | |||
public void testGivenLogstashConfigPathThenPipelineConfigCreated() { | |||
final DataPrepperArgs args = new DataPrepperArgs(LOGSTASH_PIPELINE_FILE_PATH, DP_CONFIG_YAML_FILE_PATH); | |||
|
|||
final String configFileEnding = String.format("src%stest%sresources%slogstash-filter.yaml", File.separator, File.separator, File.separator); |
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.
You could probably write this as:
Paths.get("src", "test, "resources", "logstash-filter.yaml");
@@ -64,8 +64,8 @@ public void testWriteMetrics() throws TimeoutException { | |||
Assert.assertTrue( | |||
MetricsTestUtil.isBetween( | |||
MetricsTestUtil.getMeasurementFromList(writeTimeMeasurements, Statistic.TOTAL_TIME).getValue(), | |||
0.5, | |||
0.6)); | |||
0.4, |
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.
Would 0.45
and 0.65
work here? Similar to what you did in testWriteAllMetrics
?
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.
They should still work yes. I can tighten it to that.
Signed-off-by: Taylor Gray <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #968 +/- ##
=========================================
Coverage 91.36% 91.36%
Complexity 683 683
=========================================
Files 84 84
Lines 1993 1993
Branches 168 168
=========================================
Hits 1821 1821
Misses 132 132
Partials 40 40 Continue to review full report at Codecov.
|
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.
Nice!
Description
There are a handful of unit tests that fail when running on Windows. This PR fixes some of them. The reasons for failing tests include:
USE_PLATFORM_LINE_BREAKS
to not always default to Unix\n
(Windows standard is\r\n
/
, while windows uses\
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.