Files
higress/test/ingress/e2e_test.go
2023-01-18 17:36:10 +08:00

70 lines
2.0 KiB
Go

//go:build conformance
// +build conformance
// Copyright (c) 2022 Alibaba Group Holding Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package test
import (
"flag"
"testing"
"github.com/alibaba/higress/test/ingress/conformance/tests"
"github.com/alibaba/higress/test/ingress/conformance/utils/flags"
"github.com/alibaba/higress/test/ingress/conformance/utils/suite"
"github.com/stretchr/testify/require"
v1 "k8s.io/api/networking/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"
)
var useUniquePorts = flag.Bool("use-unique-ports", true, "whether to use unique ports")
func TestHigressConformanceTests(t *testing.T) {
flag.Parse()
cfg, err := config.GetConfig()
require.NoError(t, err)
client, err := client.New(cfg, client.Options{})
require.NoError(t, err)
require.NoError(t, v1.AddToScheme(client.Scheme()))
validUniqueListenerPorts := []int{
80,
443,
}
if !*useUniquePorts {
validUniqueListenerPorts = []int{}
}
cSuite := suite.New(suite.Options{
Client: client,
IngressClassName: *flags.IngressClassName,
Debug: *flags.ShowDebug,
CleanupBaseResources: *flags.CleanupBaseResources,
ValidUniqueListenerPorts: validUniqueListenerPorts,
SupportedFeatures: map[suite.SupportedFeature]bool{},
GatewayAddress: "localhost",
})
cSuite.Setup(t)
higressTests := []suite.ConformanceTest{
tests.HTTPRouteSimpleSameNamespace,
}
cSuite.Run(t, higressTests)
}