Skip to content

Comments

Fix path test on windows#2818

Open
t-burch wants to merge 1 commit intomasterfrom
windows-test-fixes-path
Open

Fix path test on windows#2818
t-burch wants to merge 1 commit intomasterfrom
windows-test-fixes-path

Conversation

@t-burch
Copy link
Collaborator

@t-burch t-burch commented Feb 23, 2026

Summary by CodeRabbit

  • Tests
    • Updated test expectations for path combination handling to improve cross-platform compatibility.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 23, 2026

📝 Walkthrough

Walkthrough

Test expectations updated to account for Windows-style absolute paths when combining file URLs with relative path components, ensuring correct path resolution behavior across platforms.

Changes

Cohort / File(s) Summary
Test Expectations
core/src/test/java/com/predic8/membrane/core/resolver/ResolverMapCombineTest.java
Updated file path combination test cases to expect Windows-style absolute paths (file:/C:/...) alongside UNIX-style paths when resolving relative components against file URLs.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Files dance on Windows and Unix alike,
Paths combined with care and might,
Slashes and colons in their place,
Cross-platform dreams find their space!
Tests now pass with cheerful grace,

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix path test on windows' directly and accurately summarizes the main change: updating test expectations for file path combinations to handle Windows-style absolute paths.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch windows-test-fixes-path

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@core/src/test/java/com/predic8/membrane/core/resolver/ResolverMapCombineTest.java`:
- Around line 66-67: The tests in ResolverMapCombineTest use hardcoded
"file:/C:/" URIs which fail on non-C drives; update the assertions that call
combine(...) and wl(...) to build expected file URIs dynamically using the
existing platform-aware helper/variable (e.g., the current variable used
elsewhere in the test) or by converting a java.io.File to a file URI (via
File#getAbsoluteFile or File#toURI) so the expected string matches the runtime
drive; adjust assertions referencing combine("file:/chi/elm","gnat") and other
hardcoded "file:/C:..." occurrences to use that computed URI instead.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb88166 and f75bcbc.

📒 Files selected for processing (1)
  • core/src/test/java/com/predic8/membrane/core/resolver/ResolverMapCombineTest.java

Comment on lines +66 to +67
assertEquals(wl("file:/C:/chi/gnat",
"file:/chi/gnat"), combine("file:/chi/elm","gnat"));
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -name "ResolverMap.java" -type f

Repository: membrane/api-gateway

Length of output: 136


🏁 Script executed:

rg -n "public.*combine" --type=java -A 30 | head -100

Repository: membrane/api-gateway

Length of output: 5255


🏁 Script executed:

rg -n "combine" core/src/main/java/com/predic8/membrane/core/resolver/ResolverMap.java -A 15 | head -80

Repository: membrane/api-gateway

Length of output: 2952


🏁 Script executed:

find . -name "URIUtil.java" -o -name "FileUtil.java" | head -5

Repository: membrane/api-gateway

Length of output: 194


🏁 Script executed:

rg -n "pathFromFileURI|convertPath2FilePathString" --type=java -B 2 -A 10 | head -100

Repository: membrane/api-gateway

Length of output: 10905


🏁 Script executed:

# Check URIUtil class
rg -n "class URIUtil" --type=java -A 40

Repository: membrane/api-gateway

Length of output: 7905


🏁 Script executed:

rg -n "getDirectoryPart|public.*resolve" core/src/main/java/com/predic8/membrane/core/util/FileUtil.java -A 8

Repository: membrane/api-gateway

Length of output: 617


🏁 Script executed:

# Get full FileUtil class to understand resolve method
cat -n core/src/main/java/com/predic8/membrane/core/util/FileUtil.java | head -150

Repository: membrane/api-gateway

Length of output: 4319


🏁 Script executed:

# Look at the full test file to see current variable and other file URI tests
cat -n core/src/test/java/com/predic8/membrane/core/resolver/ResolverMapCombineTest.java | head -150

Repository: membrane/api-gateway

Length of output: 5607


🏁 Script executed:

# Check the `@BeforeAll` setup
rg -n "@BeforeAll|current" core/src/test/java/com/predic8/membrane/core/resolver/ResolverMapCombineTest.java -B 2 -A 3

Repository: membrane/api-gateway

Length of output: 2416


🏁 Script executed:

cat -n core/src/test/java/com/predic8/membrane/core/resolver/ResolverMapCombineTest.java | sed -n '190,210p'

Repository: membrane/api-gateway

Length of output: 795


🏁 Script executed:

# Also check if there are any other file URI tests that don't use hardcoded C:
rg -n "file:/" core/src/test/java/com/predic8/membrane/core/resolver/ResolverMapCombineTest.java | head -30

Repository: membrane/api-gateway

Length of output: 1500


The hardcoded C: drive assumption will cause test failures on Windows systems with non-C: drives.

The code flow in FileUtil.resolve()toFileURIString()f.getAbsolutePath() uses the current working drive when resolving relative paths. On Windows, new File("/chi", "gnat").getAbsolutePath() returns the actual current drive (D:, E:, etc.), not C:\. These tests will fail when run from any drive other than C:.

This inconsistency is pre-existing (lines 72, 79, 86, 94, 102, 146 all hardcode C:), but the two changed tests extend it. Consider using the dynamically computed current variable (already used in relative-path tests) or a platform-aware approach for file URI tests to ensure portability.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/src/test/java/com/predic8/membrane/core/resolver/ResolverMapCombineTest.java`
around lines 66 - 67, The tests in ResolverMapCombineTest use hardcoded
"file:/C:/" URIs which fail on non-C drives; update the assertions that call
combine(...) and wl(...) to build expected file URIs dynamically using the
existing platform-aware helper/variable (e.g., the current variable used
elsewhere in the test) or by converting a java.io.File to a file URI (via
File#getAbsoluteFile or File#toURI) so the expected string matches the runtime
drive; adjust assertions referencing combine("file:/chi/elm","gnat") and other
hardcoded "file:/C:..." occurrences to use that computed URI instead.

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