34 lines
839 B
Go
34 lines
839 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func assertCheckComputeSubstring(t *testing.T, label string, expected bool) {
|
|
res := CheckComputeSubstring(label)
|
|
assert.Equal(t, expected, res)
|
|
}
|
|
|
|
func TestCheckComputeSubstringWithkvmHostname(t *testing.T) {
|
|
hostname := string("kvm10.specterops.iad1.vexxhost.net")
|
|
expected := bool(true)
|
|
assertCheckComputeSubstring(t, hostname, expected)
|
|
|
|
}
|
|
|
|
func TestCheckComputeSubstringWithcomputeHostname(t *testing.T) {
|
|
hostname := string("compute.specterops.iad1.vexxhost.net")
|
|
expected := bool(true)
|
|
assertCheckComputeSubstring(t, hostname, expected)
|
|
|
|
}
|
|
|
|
func TestCheckComputeSubstringWithNoneComputeHostname(t *testing.T) {
|
|
hostname := string("ctl1.specterops.iad1.vexxhost.net")
|
|
expected := bool(false)
|
|
assertCheckComputeSubstring(t, hostname, expected)
|
|
|
|
}
|