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

os: TestErrIsNotExist in error_test.go is not robust #45407

Closed
perillo opened this issue Apr 6, 2021 · 2 comments
Closed

os: TestErrIsNotExist in error_test.go is not robust #45407

perillo opened this issue Apr 6, 2021 · 2 comments
Labels
FrozenDueToAge help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@perillo
Copy link
Contributor

perillo commented Apr 6, 2021

What version of Go are you using (go version)?

$ go version
go version go1.16.3 linux/amd64

In the testErrNotExist function, the code calls os.Chdir expecting to fail, but does not restore the original working directory in the case where it does not fail. The following code however assumes that os.Chdir may not fail.

@dmitshur dmitshur added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure. labels Apr 6, 2021
@dmitshur dmitshur added this to the Backlog milestone Apr 6, 2021
@gopherbot
Copy link

Change https://golang.org/cl/308849 mentions this issue: os/os_test: make testErrNotExist return to cwd if os.Chdir succeeds

@gh4n
Copy link

gh4n commented Apr 9, 2021

Had a go at fixing this, would appreciate any/all feedback

@golang golang locked and limited conversation to collaborators Apr 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

5 participants