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

Fix corner cases in tests discovered after running on Github Actions #1579

Merged
merged 3 commits into from
Nov 28, 2023

Conversation

cmelchior
Copy link
Contributor

This PR is an attempt to cleanup #881

  • It pulls out a number of smaller fixes to out test suit which resulted in errors when running tests on Windows.
  • Improves the CI check to check for both Jenkins and GHA
  • Increases the wait period for some tests that timed out when running on GHA

@cmelchior
Copy link
Contributor Author

This PR is now ready for review

Copy link
Collaborator

@nhachicha nhachicha left a comment

Choose a reason for hiding this comment

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

Nice catches 🎣

File(path).deleteRecursively()
val rootPath: Path = Paths.get(path)
val pathsToDelete: List<Path> =
Files.walk(rootPath).sorted(Comparator.reverseOrder()).collect(Collectors.toList())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the sort needed to delete files first?

delay(1000)
counter--
}
assertEquals(expectedThreadCount, totalThreadCount(), "Unexpected thread count after closing realm: ${newThreads()}")
val totalThreadCount = totalThreadCount()
Copy link
Collaborator

Choose a reason for hiding this comment

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

For the sake of debugging, we should print the stack trace of all non-daemon thread to find where they're are blocking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about this, but it would massively expand the output and so far all the cases we had for this, it was enough to get the name of the thread to figure out what was going on. So for now I think I would prefer to keep as as is.

Copy link
Contributor

@rorbech rorbech left a comment

Choose a reason for hiding this comment

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

LGTM - Some minor comments

@@ -76,5 +76,9 @@ class SystemNotificationTests {
writer1.write { copyToRealm(Sample()) }
writer2.write { copyToRealm(Sample()) }
}
writer1.close()
writer2.close()
liveRealmContext.close()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this actually green on CI? I tried to clean this up as part of another PR but ended up splitting into this separate issue #1563

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. Maybe closing the writers individually first make it work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is working on GHA.

try {
Files.deleteIfExists(p)
} catch (e: java.nio.file.FileSystemException) {
// Sometimes (on Windows) we need the give a GC a chance to run and close all native pointers
Copy link
Contributor

Choose a reason for hiding this comment

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

🤦

@cmelchior cmelchior merged commit 75b35dc into main Nov 28, 2023
2 checks passed
@cmelchior cmelchior deleted the cm/prepare-for-gha branch November 28, 2023 18:43
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants