Skip to content

fix TestFromDirSymlink on Windows due to missing drive-letter#283

Merged
dnephin merged 1 commit intogotestyourself:mainfrom
thaJeztah:fix_TestFromDirSymlink_windows
Aug 29, 2024
Merged

fix TestFromDirSymlink on Windows due to missing drive-letter#283
dnephin merged 1 commit intogotestyourself:mainfrom
thaJeztah:fix_TestFromDirSymlink_windows

Conversation

@thaJeztah
Copy link
Contributor

@thaJeztah thaJeztah commented Aug 26, 2024

This test was failing, because it expected the drive-letter to always
be returned, which wasn't the case;

=== FAIL: fs TestFromDirSymlink (0.01s)
    ops_test.go:55: assertion failed: directory C:\Users\circleci\AppData\Local\Temp\test-from-dir-2260318643 does not match expected:
        \a\b\3
          target: expected C:\some\inexistent\link got \some\inexistent\link

This patch removes the special-case from d44953d,
which unconditionally added the drive-letter. Instead, we only change
the check to use the expected directory-separator.

@thaJeztah thaJeztah force-pushed the fix_TestFromDirSymlink_windows branch from 2533182 to b848e70 Compare August 26, 2024 10:09
@thaJeztah
Copy link
Contributor Author

thaJeztah commented Aug 26, 2024

Hm... nope; that didn't help. Looks like something else needs to be updated; perhaps as part of the fs.Equal itself?

=== Failed
=== FAIL: fs TestFromDirSymlink (0.01s)
    ops_test.go:59: assertion failed: directory C:\Users\circleci\AppData\Local\Temp\test-from-dir-2043988436 does not match expected:
        \a\b\3
          target: expected C:\some\inexistent\link got \some\inexistent\link

Hm.. looking again, it looks like it's actual failing on the part related to

if runtime.GOOS == "windows" {
link3 = filepath.Join(filepath.VolumeName(currentdir), link3)
}

Looks like that was added in;

Maybe that part is no longer needed; let me try just removing it

@thaJeztah thaJeztah force-pushed the fix_TestFromDirSymlink_windows branch from 2fe67a9 to 0b8a80e Compare August 26, 2024 11:17
This test was failing, because it expected the drive-letter to always
be returned, which wasn't the case;

    === FAIL: fs TestFromDirSymlink (0.01s)
        ops_test.go:55: assertion failed: directory C:\Users\circleci\AppData\Local\Temp\test-from-dir-2260318643 does not match expected:
            \a\b\3
              target: expected C:\some\inexistent\link got \some\inexistent\link

This patch removes the special-case from d44953d,
which unconditionally added the drive-letter. Instead, we only change
the check to use the expected directory-separator.

Signed-off-by: Sebastiaan van Stijn <[email protected]>

test

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah changed the title fix TestFromDirSymlink on Windows for tempdir without drive-letter fix TestFromDirSymlink on Windows due to missing drive-letter Aug 26, 2024
@thaJeztah thaJeztah force-pushed the fix_TestFromDirSymlink_windows branch from 0b8a80e to 109d43e Compare August 26, 2024 11:28
@thaJeztah thaJeztah marked this pull request as ready for review August 26, 2024 11:28
Copy link
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

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

Thank you!

I guess the Go stdlib changed in a recent version? This test was passing for a long time.

@dnephin dnephin merged commit 65a3150 into gotestyourself:main Aug 29, 2024
@thaJeztah thaJeztah deleted the fix_TestFromDirSymlink_windows branch August 29, 2024 06:39
@thaJeztah
Copy link
Contributor Author

Yeah, no clue either; also honestly don't have a Windows machine to test locally 😂. Given that the original fix was a workaround for CI, and nobody complained that the code itself wasn't working, I'm pretty sure nothing was severely broken, so just the test.

Crown0815 pushed a commit to Crown0815/forgejo-runner-windows that referenced this pull request May 21, 2025
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [gotest.tools/v3](https://github.com/gotestyourself/gotest.tools) | require | patch | `v3.5.1` -> `v3.5.2` |

---

### Release Notes

<details>
<summary>gotestyourself/gotest.tools (gotest.tools/v3)</summary>

### [`v3.5.2`](https://github.com/gotestyourself/gotest.tools/releases/tag/v3.5.2)

[Compare Source](gotestyourself/gotest.tools@v3.5.1...v3.5.2)

#### What's Changed

-   assert: ensure message is always displayed & fix under bazel by [@&#8203;cstrahan](https://github.com/cstrahan) in gotestyourself/gotest.tools#276
-   go.mod: golang.org/x/tools v0.13.0 for go1.22+ compatibility by [@&#8203;thaJeztah](https://github.com/thaJeztah) in gotestyourself/gotest.tools#282
-   poll: Continue(): use format.Message for formatting by [@&#8203;thaJeztah](https://github.com/thaJeztah) in gotestyourself/gotest.tools#279
-   fix TestFromDirSymlink on Windows due to missing drive-letter by [@&#8203;thaJeztah](https://github.com/thaJeztah) in gotestyourself/gotest.tools#283
-   Fix various linting issues and minor bugs by [@&#8203;thaJeztah](https://github.com/thaJeztah) in gotestyourself/gotest.tools#280
-   fix badges in readme, gofmt, and minor linting fix by [@&#8203;thaJeztah](https://github.com/thaJeztah) in gotestyourself/gotest.tools#284
-   circleci: add go1.21, go1.22, go1.23, and update golangci-lint to v1.60.3 by [@&#8203;thaJeztah](https://github.com/thaJeztah) in gotestyourself/gotest.tools#285
-   assert, assert/cmp: un-deprecate assert.ErrorType for now by [@&#8203;thaJeztah](https://github.com/thaJeztah) in gotestyourself/gotest.tools#286

#### New Contributors

-   [@&#8203;cstrahan](https://github.com/cstrahan) made their first contribution in gotestyourself/gotest.tools#276

**Full Changelog**: gotestyourself/gotest.tools@v3.5.1...v3.5.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMTIuMCIsInVwZGF0ZWRJblZlciI6IjM5LjI1Mi4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/524
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
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