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

test: windows path resolution #4159

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft

test: windows path resolution #4159

wants to merge 12 commits into from

Conversation

mpeddada1
Copy link
Contributor

Thank you for your interest in contributing! For general guidelines, please refer to
the contributing guide.

Before filing a pull request, make sure to do the following:

This helps to reduce the chance of having a pull request rejected.

Fixes #<issue_number_goes_here> 🛠️

@mpeddada1
Copy link
Contributor Author

mpeddada1 commented Dec 21, 2023

Modifying test to assertThat(testJibExtension.getExtraDirectories().getPaths().get(0).getFrom()) .isEqualTo(fakeProject.getProjectDir().toPath().resolve("foo")); in a34d24d results in tests passing in windows and failing with the following error in ubuntu:

com.google.cloud.tools.jib.gradle.JibExtensionTest > testProperties FAILED
    expected: /tmpfs/src/github/jib/jib-gradle-plugin/build/tmp/test/work/gradle16051347658540989475projectDir/foo
    but was : /foo
        at app//com.google.cloud.tools.jib.gradle.JibExtensionTest.testProperties(JibExtensionTest.java:525)

com.google.cloud.tools.jib.gradle.JibPluginTest > testLazyEvalForExtraDirectories_individualPaths STANDARD_OUT
    Downloading https://services.gradle.org/distributions/gradle-8.0-bin.zip

Further exploration of the return values in the logic shows a difference starting at ExtraDirectoryParameters#getFrom. Verified through printing the value od System.out.println(from.getSingleFile().toPath()); at cfecdc8 which results in the following log statements:

  WINDOWS PATH TEST
    \foo
    VALUE OF FROM
    file collection
    VALUE OF FROM
    file collection
    VALUE OF GET FROM
    C:\tmpfs\src\github\jib\jib-gradle-plugin\build\tmp\test\work\gradle1471789139889995471projectDir\foo

On the other hand, ubuntu's log statements show:

com.google.cloud.tools.jib.gradle.JibExtensionTest > testProperties STANDARD_OUT
   .  . .
    VALUE OF GET FROM
    /foo

However, note that in JibExtenisonTest#testExtraDirectories(), the paths seem to always resolve to the absolute path in both windows and ubuntu. The difference occurs when we use System properties to specify the file path.

Copy link

sonarcloud bot commented Dec 21, 2023

Quality Gate Failed Quality Gate failed

Failed conditions

0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

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.

2 participants