carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1//go:build linux
2
3package instancectl
4
5import (
6 "os"
7 "strconv"
8 "testing"
9)
10
11func TestProcStartReadsStableIdentity(t *testing.T) {
12 pid := os.Getpid()
13 a, err := procStart(pid)
14 if err != nil {
15 t.Fatal(err)
16 }
17 b, err := procStart(pid)
18 if err != nil || a == "" || a != b {
19 t.Fatalf("start %q %q %v", a, b, err)
20 }
21 if _, err := strconv.ParseUint(a, 10, 64); err != nil {
22 t.Fatal(err)
23 }
24}
25
26func TestProcStartRefusesMissingProcess(t *testing.T) {
27 if _, err := procStart(1 << 30); err == nil {
28 t.Fatal("missing pid accepted")
29 }
30}
31