MCPcopy Create free account
hub / github.com/archlinux-de/pkgstats-cli / TestGetOSId

Function TestGetOSId

internal/system/system_linux_test.go:38–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

36}
37
38func TestGetOSId(t *testing.T) {
39 sys := system.NewSystem()
40 osId, err := sys.GetOSId()
41 if err != nil {
42 t.Fatalf("unexpected error getting OSId: %v", err)
43 }
44
45 _, err1 := os.Stat("/etc/os-release")
46 _, err2 := os.Stat("/usr/lib/os-release")
47
48 if os.IsNotExist(err1) && os.IsNotExist(err2) {
49 if osId != runtime.GOOS {
50 t.Errorf("expected OSId %q, got %q", runtime.GOOS, osId)
51 }
52 } else {
53 if osId == "" {
54 t.Error("expected a non-empty OSId, but it was empty")
55 }
56 }
57}

Callers

nothing calls this directly

Calls 2

GetOSIdMethod · 0.95
NewSystemFunction · 0.92

Tested by

no test coverage detected