hostinfo: fix earlier git fail, add files lost in move

This was meant to be part of 47045265b9
which instead deleted them :(

Updates tailscale/corp#1959
This commit is contained in:
Brad Fitzpatrick
2021-08-22 21:12:27 -07:00
parent 71b375c502
commit 3ac731dda1
3 changed files with 161 additions and 0 deletions

29
hostinfo/hostinfo_test.go Normal file
View File

@@ -0,0 +1,29 @@
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package hostinfo
import (
"encoding/json"
"testing"
)
func TestNew(t *testing.T) {
hi := New()
if hi == nil {
t.Fatal("no Hostinfo")
}
j, err := json.MarshalIndent(hi, " ", "")
if err != nil {
t.Fatal(err)
}
t.Logf("Got: %s", j)
}
func TestOSVersion(t *testing.T) {
if osVersion == nil {
t.Skip("not available for OS")
}
t.Logf("Got: %#q", osVersion())
}