open-nomad/client/stats/cpu_darwin_test.go
hc-github-team-nomad-core e5fb6fe687
backport of commit 615e76ef3c23497f768ebd175f0c624d32aeece8 (#17993)
This pull request was automerged via backport-assistant
2023-07-19 13:31:14 -05:00

39 lines
718 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
//go:build darwin && arm64 && cgo
package stats
import (
"testing"
"github.com/shoenig/test/must"
)
func TestCPU_Init(t *testing.T) {
must.NoError(t, Init())
}
func TestCPU_CPUNumCores(t *testing.T) {
big, little := CPUNumCores()
must.Between(t, 4, big, 32)
must.Between(t, 2, little, 8)
}
func TestCPU_CPUMHzPerCore(t *testing.T) {
big, little := CPUMHzPerCore()
must.Between(t, 3_000, big, 6_000)
must.Between(t, 2_000, little, 4_000)
}
func TestCPU_CPUModelName(t *testing.T) {
name := CPUModelName()
must.NotEq(t, "", name)
}
func TestCPU_CPUCpuTotalTicks(t *testing.T) {
ticks := CpuTotalTicks()
must.Positive(t, ticks)
}