Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[PAN-2900] Fix FlatFileTaskCollection tests #1833

Merged
merged 3 commits into from
Aug 8, 2019

Conversation

shemnon
Copy link
Contributor

@shemnon shemnon commented Aug 8, 2019

PR description

Windows has some slightly different Java NIO semantics, regarding size
after writing and whether files are deleted on close (they are not immediately deleted).

The first issue is we shouldn't be using Integer.SIZE when we mean
Integer.BYTES. Integer.SIZE is bit count, BYTES is byte count.

The second issue is we cannot count on these work files showing up or
being deleted from the file system consistently across platforms. The
ordering is consistent within platforms but not across. The test was
re-written to check the read and write file numbers instead.

shemnon added 2 commits August 7, 2019 23:08
Windows has some slightly different Java NIO semantics, regarding size
after writing and whether files are deleted on close (they aren not).

The first issue is we shouldn't be using Integer.SIZE when we mean
Integer.BYTES.

The second issue is we cannot count on these work files showing up or
being deleted from the file system consistently across platforms.  The
ordering is consistant within platforms but not across.  The test was
re-written to check the read and write file numbers instead.
@@ -72,8 +69,7 @@ public void shouldRollFilesWhenSizeExceeded() throws Exception {
removedTasks.add(queue.remove().getData());
}

// Fully read files should have been removed.
assertThat(getCurrentFiles(dataDir)).doesNotContain(firstFile);
assertThat(queue.getReadFileNumber()).isEqualTo(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

If the first file has been read and closed, shouldn't the readFile number increment to 1??

Suggested change
assertThat(queue.getReadFileNumber()).isEqualTo(0);
assertThat(queue.getReadFileNumber()).isEqualTo(1);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The file number doesn't get updated until it actually reads the file. This change will break the test but I'm adding a tweak to make sure it advances.

Copy link
Contributor

@mbaxter mbaxter left a comment

Choose a reason for hiding this comment

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

lgtm

@shemnon shemnon merged commit 9254200 into PegaSysEng:master Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants