node-labeler/units_test.go
okozachenko 977f62ba56 Fix getting node name
Change-Id: Id34db7684a132a3e5eb108b4d5e925714e3b1fec
2020-07-23 20:01:31 +03:00

34 lines
804 B
Go

package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func assertCheckComputeNode(t *testing.T, label string, expected bool) {
res := CheckComputeNode(label)
assert.Equal(t, expected, res)
}
func TestCheckComputeSubstringWithkvmHostname(t *testing.T) {
hostname := string("kvm10.specterops.iad1.vexxhost.net")
expected := bool(true)
assertCheckComputeNode(t, hostname, expected)
}
func TestCheckComputeNodeWithcomputeHostname(t *testing.T) {
hostname := string("compute.specterops.iad1.vexxhost.net")
expected := bool(true)
assertCheckComputeNode(t, hostname, expected)
}
func TestCheckComputeNodeWithNoneComputeHostname(t *testing.T) {
hostname := string("ctl1.specterops.iad1.vexxhost.net")
expected := bool(false)
assertCheckComputeNode(t, hostname, expected)
}