21 lines
696 B
Go
21 lines
696 B
Go
package cluster
|
|
|
|
import "testing"
|
|
|
|
func TestRoutingIgnoresCustomerDomainPrefixes(t *testing.T) {
|
|
cases := []struct {
|
|
body map[string]any
|
|
host string
|
|
}{
|
|
{map[string]any{"name": "sv0123456789.customer.example", "domain": "svabcdef0123.example"}, ""},
|
|
{map[string]any{"hostName": "sv0123456789"}, "sv0123456789"},
|
|
{map[string]any{"site": map[string]any{"Name": "svabcdef0123", "Domain": "sv0123456789.customer.example"}}, "svabcdef0123"},
|
|
{map[string]any{"runtime": map[string]any{"ProjectName": "svabcdef0123_42"}}, "svabcdef0123"},
|
|
}
|
|
for _, tc := range cases {
|
|
if got := hostFromValue(tc.body); got != tc.host {
|
|
t.Fatalf("route identity = %q, want %q", got, tc.host)
|
|
}
|
|
}
|
|
}
|