Skip to content

test: run the tests on macOS, and the installer registry test on its own - #1978

Merged
lagergren merged 2 commits into
redhat-developer:mainfrom
lagergren:test/run-the-tests-on-macos-and-alone
Nov 12, 2026
Merged

lagergren merged 2 commits into
redhat-developer:mainfrom
lagergren:test/run-the-tests-on-macos-and-alone

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Two test problems that only show up locally: on a Mac, and when a test class runs on its own. CI passes either way, but a full local run on a Mac had 7 failures that could hide a real one.

Temporary files on macOS

Seven tests in LSPIJUtils_applyWorkspaceEdit_{Go,TypeScript,Scala,Zig}Test and CommandExecutorTest created their file with Files.createTempFile(null, …), in the system's temporary directory. On macOS that directory is under /var, a link to /private/var. IntelliJ resolves the link, and the test framework then failed the tests:

File accessed outside allowed roots: file:///private/var/folders/…/T/4862068706077611464.go

They now create the file in the test's own temporary directory (FileUtil.getTempDirectory()). The framework allows that directory, and deletes it after the test.

InstallerTaskRegistryFileExistsTest on its own

Its download tasks look up an application service (GitHubAssetFetcherManager), so the test passed only after another platform test had started the application in the same JVM. Run on its own, 16 of its 28 tests failed with a NullPointerException from ApplicationManager.getApplication(). A @BeforeClass now starts the test application, as a platform test's set-up does.

How this was checked

  • On a Mac, the 7 tests fail on main and pass with this.
  • ./gradlew test --tests '*InstallerTaskRegistryFileExistsTest' on its own: 16 of 28 fail on main, and all 28 pass with this.

…directory

Seven tests created their file in the system's temporary directory,
which on macOS is under /var, a link to /private/var. IntelliJ resolves
the link, and the test framework then failed the tests with 'File
accessed outside allowed roots'. They passed on CI, but failed when run
on a Mac. They now create the file in the test's own temporary
directory, which the framework allows, and deletes.
Its download tasks look up an application service, so the test passed
only after another platform test had started the application in the
same JVM: run on its own, 16 of its tests failed. It now starts the
test application itself.
@lagergren lagergren added this to the 0.30.0 milestone Nov 12, 2026
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Updated temporary-file setup for workspace-edit and command tests to use the IDE’s configured temporary directory across Go, Scala, TypeScript, and Zig scenarios.
    • Installer registry tests now initialize the test application before running.
    • Test scenarios and expected workspace-edit results remain unchanged.

Tests now create temporary source files under IntelliJ’s configured temporary directory. The installer registry test also initializes the test application before running.

Changes: Test setup changes

Layer / File(s) Summary
Use IntelliJ temporary directory
src/test/java/com/redhat/devtools/lsp4ij/LSPIJUtils_applyWorkspaceEdit_*Test.java, src/test/java/com/redhat/devtools/lsp4ij/commands/CommandExecutorTest.java
Go, Scala, TypeScript, Zig, and command tests create temporary source files under FileUtil.getTempDirectory().
Initialize test application
src/test/java/com/redhat/devtools/lsp4ij/installation/definition/InstallerTaskRegistryFileExistsTest.java
A @BeforeClass method initializes the test application through TestApplicationManager.getInstance().

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Suggested reviewers: angelozerr

Merge Risk: Minimal · up to e3d24

This change only adjusts test setup so the tests run reliably on macOS and in isolation. It has no production impact and no remaining merge-blocking concerns.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two changes in the PR: running tests on macOS (temporary-file location fix) and running the installer registry test on its own (application setup fix). Both are present in the chan…
Description check Passed The description explains the macOS temporary-file failure and the standalone InstallerTaskRegistryFileExistsTest failure. It names the changed test files, the FileUtil.getTempDirectory() fix, the @Bef…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two changes in the PR: running tests on macOS (temporary-file location fix) and running the installer registry test on its own (application setup fix). Both are present in the changeset. The title is long and lists two topics, but it reflects the main changes.

Full details: Description check

Explanation

The description explains the macOS temporary-file failure and the standalone InstallerTaskRegistryFileExistsTest failure. It names the changed test files, the FileUtil.getTempDirectory() fix, the @BeforeClass setup, and how the change was verified. This matches the changeset.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 73ac89c9-14ad-48e0-8099-4207b2779968
Commits

Reviewing files that changed from the base of the PR and between 358015d and e3d2446.

Files selected for processing: 6

  • src/test/java/com/redhat/devtools/lsp4ij/LSPIJUtils_applyWorkspaceEdit_GoTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/LSPIJUtils_applyWorkspaceEdit_ScalaTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/LSPIJUtils_applyWorkspaceEdit_TypeScriptTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/LSPIJUtils_applyWorkspaceEdit_ZigTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/commands/CommandExecutorTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/installation/definition/InstallerTaskRegistryFileExistsTest.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.42%. Comparing base (358015d) to head (e3d2446).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1978      +/-   ##
==========================================
+ Coverage   48.36%   48.42%   +0.05%     
==========================================
  Files         810      810              
  Lines       32612    32612              
  Branches     5037     5037              
==========================================
+ Hits        15774    15793      +19     
+ Misses      14326    14315      -11     
+ Partials     2512     2504       -8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lagergren
lagergren merged commit 1224c41 into redhat-developer:main Nov 12, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant