summaryrefslogtreecommitdiffhomepage
path: root/util/pidowner/pidowner_test.go
diff options
context:
space:
mode:
authorAndrew Lytvynov <awly@tailscale.com>2026-04-24 15:53:27 -0700
committerAndrew Lytvynov <awly@tailscale.com>2026-04-24 15:53:27 -0700
commit4d91c36b9ce0228c1a348088d761d8f213e06287 (patch)
treee0f0fd0f9cbfbc131b7c456cabf4809f8c15cf94 /util/pidowner/pidowner_test.go
parent1b40911611b37947bdc905dec30b2914af540920 (diff)
downloadtailscale-awly/deadcode-pidowner.tar.xz
tailscale-awly/deadcode-pidowner.zip
util/pidowner: remove unused packageawly/deadcode-pidowner
Added in 2020, this appears to be unused. Updates #cleanup
Diffstat (limited to 'util/pidowner/pidowner_test.go')
-rw-r--r--util/pidowner/pidowner_test.go50
1 files changed, 0 insertions, 50 deletions
diff --git a/util/pidowner/pidowner_test.go b/util/pidowner/pidowner_test.go
deleted file mode 100644
index 2774a8ab0..000000000
--- a/util/pidowner/pidowner_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) Tailscale Inc & contributors
-// SPDX-License-Identifier: BSD-3-Clause
-
-package pidowner
-
-import (
- "math/rand"
- "os"
- "os/user"
- "testing"
-)
-
-func TestOwnerOfPID(t *testing.T) {
- id, err := OwnerOfPID(os.Getpid())
- if err == ErrNotImplemented {
- t.Skip(err)
- }
- if err != nil {
- t.Fatal(err)
- }
- t.Logf("id=%q", id)
-
- u, err := user.LookupId(id)
- if err != nil {
- t.Fatalf("LookupId: %v", err)
- }
- t.Logf("Got: %+v", u)
-}
-
-// validate that OS implementation returns ErrProcessNotFound.
-func TestNotFoundError(t *testing.T) {
- // Try a bunch of times to stumble upon a pid that doesn't exist...
- const tries = 50
- for range tries {
- _, err := OwnerOfPID(rand.Intn(1e9))
- if err == ErrNotImplemented {
- t.Skip(err)
- }
- if err == nil {
- // We got unlucky and this pid existed. Try again.
- continue
- }
- if err == ErrProcessNotFound {
- // Pass.
- return
- }
- t.Fatalf("Error is not ErrProcessNotFound: %T %v", err, err)
- }
- t.Errorf("after %d tries, couldn't find a process that didn't exist", tries)
-}