Skip to content

Commit 5e82cba

Browse files
qmuntalgopherbot
authored andcommitted
os/user: skip tests that create users when running on dev machines
Creating and deleting users is tricky to get right, and it's not something we want to do on a developer machine. This change skips the tests that create users when not running on a Go builder. This will fix #70396, although I still don't understand why the test user couldn't be recreated. Fixes #70396 Change-Id: Ie7004dc209f94e72152c7d6bd8ec95cc12c79757 Reviewed-on: https://go-review.googlesource.com/c/go/+/627877 Reviewed-by: Ian Lance Taylor <[email protected]> Reviewed-by: Cherry Mui <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 45869f5 commit 5e82cba

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/os/user/user_windows_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ import (
2424
// If the user already exists, it will be deleted and recreated.
2525
// The caller is responsible for closing the token.
2626
func windowsTestAccount(t *testing.T) (syscall.Token, *User) {
27+
if testenv.Builder() == "" {
28+
// Adding and deleting users requires special permissions.
29+
// Even if we have them, we don't want to create users on
30+
// on dev machines, as they may not be cleaned up.
31+
// See https://dev.go/issue/70396.
32+
t.Skip("skipping non-hermetic test outside of Go builders")
33+
}
2734
const testUserName = "GoStdTestUser01"
2835
var password [33]byte
2936
rand.Read(password[:])

0 commit comments

Comments
 (0)