2023-04-10 15:36:59 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2021-04-12 19:10:10 +00:00
|
|
|
package structs
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-03-15 12:42:43 +00:00
|
|
|
"github.com/hashicorp/nomad/ci"
|
2021-04-12 19:10:10 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestTaskKind_IsAnyConnectGateway(t *testing.T) {
|
2022-03-15 12:42:43 +00:00
|
|
|
ci.Parallel(t)
|
|
|
|
|
2021-04-12 19:10:10 +00:00
|
|
|
t.Run("gateways", func(t *testing.T) {
|
|
|
|
require.True(t, NewTaskKind(ConnectIngressPrefix, "foo").IsAnyConnectGateway())
|
|
|
|
require.True(t, NewTaskKind(ConnectTerminatingPrefix, "foo").IsAnyConnectGateway())
|
|
|
|
require.True(t, NewTaskKind(ConnectMeshPrefix, "foo").IsAnyConnectGateway())
|
|
|
|
})
|
|
|
|
|
|
|
|
t.Run("not gateways", func(t *testing.T) {
|
|
|
|
require.False(t, NewTaskKind(ConnectProxyPrefix, "foo").IsAnyConnectGateway())
|
|
|
|
require.False(t, NewTaskKind(ConnectNativePrefix, "foo").IsAnyConnectGateway())
|
|
|
|
require.False(t, NewTaskKind("", "foo").IsAnyConnectGateway())
|
|
|
|
})
|
|
|
|
}
|