mirror of
https://github.com/alibaba/higress.git
synced 2026-06-09 04:37:31 +08:00
feat: add support for ingress e2e test framework (#133)
Signed-off-by: bitliu <bitliu@tencent.com>
This commit is contained in:
69
test/ingress/e2e_test.go
Normal file
69
test/ingress/e2e_test.go
Normal file
@@ -0,0 +1,69 @@
|
||||
//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)
|
||||
}
|
||||
Reference in New Issue
Block a user