github.com/hernad/nomad@v1.6.112/nomad/structs/connect_test.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package structs
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/hernad/nomad/ci"
    10  	"github.com/stretchr/testify/require"
    11  )
    12  
    13  func TestTaskKind_IsAnyConnectGateway(t *testing.T) {
    14  	ci.Parallel(t)
    15  
    16  	t.Run("gateways", func(t *testing.T) {
    17  		require.True(t, NewTaskKind(ConnectIngressPrefix, "foo").IsAnyConnectGateway())
    18  		require.True(t, NewTaskKind(ConnectTerminatingPrefix, "foo").IsAnyConnectGateway())
    19  		require.True(t, NewTaskKind(ConnectMeshPrefix, "foo").IsAnyConnectGateway())
    20  	})
    21  
    22  	t.Run("not gateways", func(t *testing.T) {
    23  		require.False(t, NewTaskKind(ConnectProxyPrefix, "foo").IsAnyConnectGateway())
    24  		require.False(t, NewTaskKind(ConnectNativePrefix, "foo").IsAnyConnectGateway())
    25  		require.False(t, NewTaskKind("", "foo").IsAnyConnectGateway())
    26  	})
    27  }