mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-21 18:42:36 +00:00
posture: add get serial support for macOS
Updates #5902 Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:

committed by
Kristoffer Dalby

parent
9eedf86563
commit
d0b8bdf8f7
37
posture/serialnumber_macos_test.go
Normal file
37
posture/serialnumber_macos_test.go
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build cgo && darwin && !ios
|
||||
|
||||
package posture
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"tailscale.com/types/logger"
|
||||
"tailscale.com/util/cibuild"
|
||||
)
|
||||
|
||||
func TestGetSerialNumberMac(t *testing.T) {
|
||||
// Do not run this test on CI, it can only be ran on macOS
|
||||
// and we currenty only use Linux runners.
|
||||
if cibuild.On() {
|
||||
t.Skip()
|
||||
}
|
||||
|
||||
sns, err := GetSerialNumbers(logger.Discard)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to get serial number: %s", err)
|
||||
}
|
||||
|
||||
if len(sns) != 1 {
|
||||
t.Errorf("expected list of one serial number, got %v", sns)
|
||||
}
|
||||
|
||||
if len(sns[0]) <= 0 {
|
||||
t.Errorf("expected a serial number with more than zero characters, got %s", sns[0])
|
||||
}
|
||||
|
||||
fmt.Printf("serials: %v\n", sns)
|
||||
}
|
Reference in New Issue
Block a user