Skip to content

Migrate Burst to TestBalloon - #1865

Open
wilburx9 wants to merge 17 commits into
lysine-dev:mainfrom
wilburx9:migrate-burt-to-testballoon
Open

wilburx9 wants to merge 17 commits into
lysine-dev:mainfrom
wilburx9:migrate-burt-to-testballoon

Conversation

@wilburx9

@wilburx9 wilburx9 commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Migrated Burst to TestBalloon

Part 2 of #1846

Comment thread gradle/libs.versions.toml Resolved
@wilburx9
wilburx9 marked this pull request as ready for review August 31, 2026 16:39
@wilburx9
wilburx9 requested a review from JakeWharton August 31, 2026 16:41
@wilburx9 wilburx9 mentioned this pull request Sep 1, 2026
@wilburx9

wilburx9 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@JakeWharton TestBalloon doesn't support JVM 8, and I raised an issue here: infix-de/testBalloon#97. In the interim, I am curious to know why we still support v8.

@JakeWharton

Copy link
Copy Markdown
Collaborator

There hasn't been a reason to drop it. We like compatibility.

@wilburx9

wilburx9 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

@JakeWharton The beta testballoon fixes the test. What are your thoughts on going with a beta version, though?

@JakeWharton

Copy link
Copy Markdown
Collaborator

Yep, that's fine. We can tolerate instability in test dependencies.

fun TestSuiteScope.testDirectory(
fileSystem: FileSystem,
temporaryDirectory: Path = FileSystem.SYSTEM_TEMPORARY_DIRECTORY,
) = testFixture { fileSystem.createTestPath(temporaryDirectory) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does this get deleted after use? If not and if that makes sense, here is an example strategy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@OliverO2, thanks for the suggestion. I believe I tried that approach, but some tests were failing because of the recursive deletion, so I had to remove it. Or do you mean only deleting for non-CI builds?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I was thinking of this as a general practice: I'd expect resources like temporary files/directories to have a lifetime tied to the scope (test suite) they are used in. A test fixture automatically takes care of this, closing its resource at the end of its TestSuiteScope.

This should work regardless of CI. The CI special case was just an example, where the contents of resources would only be examined locally (non-CI), and only for failing tests.

One thing I could imagine is: If you are using concurrent invocation and the same file path is used in concurrently executing suites, these could collide. Could this be the case?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like a bug in WasiFileSystem:

If I clean up the temporary directory like this:

fun TestSuiteScope.testDirectory(
  fileSystem: FileSystem,
  temporaryDirectory: Path = FileSystem.SYSTEM_TEMPORARY_DIRECTORY,
) = testFixture { fileSystem.createTestPath(temporaryDirectory) } closeWith {
    fileSystem.deleteRecursively(this)
}

the failing test is okio.WasiTest↘canonicalizeAbsolutePathWithSymlinkCycle.

This test creates a cycle of three symlinks. When trying to delete the parent directory via fileSystem.deleteRecursively(), the function WasiFileSystem.pathOpen gets called and tries to open one of the symlinks. This fails with errno 32 (loop).

Seems like there is no "follow symlinks" option in the functions that list directory entries. Maybe either pathOpen or the list function calling it should (conditionally) check for a symlink first before trying to open it. Otherwise, with a symlink cycle it is bound to fail as expected and fileSystem.deleteRecursively() can never succeed in this case.

Println debugging trace:

>>> commonDeleteRecursively on /tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4
>>> collectRecursively start: /tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4
>>> collectRecursively before children
>>> listOrNull(/tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4) start
>>> list(/tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4) start
>>> pathOpen(/tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4) start
>>> pathOpen(/tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4) path_open errno=0
>>> list(/tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4) after pathOpen
>>> list(/tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4) start
>>> list(/tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4): errno=0
>>> collectRecursively children: [/tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4/paper, /tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4/rock, /tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4/scissors]
>>> collectRecursively symlink: /tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4
>>> collectRecursively child: /tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4/paper
>>> collectRecursively start: /tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4/paper
>>> collectRecursively before children
>>> listOrNull(/tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4/paper) start
>>> list(/tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4/paper) start
>>> pathOpen(/tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4/paper) start
>>> pathOpen(/tmp/test-f4e97d1653c0ae50da5d749cf8e8bcf4/paper) path_open errno=32
loop
ErrnoException: loop

@wilburx9 wilburx9 Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Interesting. I'd suggest we open a separate issue to investigate this. In the interim, I can bring back closeWith but disable folder deletion with a flag passed to testDirectory(). Then explicitly disable it for the failing test.

Thoughts? @JakeWharton @OliverO2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Created #1874 and provided a fix in wilburx9#1.

Feel free to cherry-pick and/or change as required.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A flag for now is fine, if only to get it landed sooner rather than later!

Comment on lines +119 to +124
val children =
(if (followSymlinks || fileSystem.metadataOrNull(path)?.symlinkTarget == null) {
fileSystem.listOrNull(path)
} else {
null
}) ?: listOf()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If we're going to fix this, which is fine, we should land it with its own test as a separate commit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair enough.
@OliverO2 Why don't I revert your fix, go with the flag I suggested earlier and you can raise the PR when this is merged? Thoughts?

@JakeWharton JakeWharton Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If you want to add a test and squash it all into two commits (first one with fix+test, second migrating the tests) that would be fine, too. I can do a merge without squash then.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I agree that this bug deserves its own test. I can probably contribute one but need to familiarize myself with doing it at the common source set level first. Unfortunately, due to a packed schedule, that could happen no earlier than Oct 10.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@wilburx9 I've created wilburx9#2 with a separate commit for the fix plus test to merge it here, along with thoughts on how to proceed. Let me know if you need anything else.

@OliverO2

OliverO2 commented Nov 6, 2026

Copy link
Copy Markdown

@wilburx9 Do you want to proceed with this?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants