blob: cd52a9ea7d488ba35ce4d7b052e6a837a8baac43 [file] [log] [blame]
//go:build integ
// +build integ
// Copyright Istio Authors
//
// 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 pilot
import (
"testing"
)
import (
"github.com/apache/dubbo-go-pixiu/pkg/config/protocol"
"github.com/apache/dubbo-go-pixiu/pkg/test/framework"
"github.com/apache/dubbo-go-pixiu/pkg/test/framework/components/echo"
"github.com/apache/dubbo-go-pixiu/pkg/test/framework/components/echo/common/deployment"
"github.com/apache/dubbo-go-pixiu/pkg/test/framework/components/istio"
"github.com/apache/dubbo-go-pixiu/pkg/test/framework/components/namespace"
"github.com/apache/dubbo-go-pixiu/pkg/test/framework/resource"
)
var (
i istio.Instance
// Below are various preconfigured echo deployments. Whenever possible, tests should utilize these
// to avoid excessive creation/tear down of deployments. In general, a test should only deploy echo if
// its doing something unique to that specific test.
apps = deployment.SingleNamespaceView{}
)
func supportsCRDv1(t resource.Context) bool {
for _, cluster := range t.Clusters() {
if !cluster.MinKubeVersion(16) {
return false
}
}
return true
}
// TestMain defines the entrypoint for pilot tests using a standard Istio installation.
// If a test requires a custom install it should go into its own package, otherwise it should go
// here to reuse a single install across tests.
func TestMain(m *testing.M) {
framework.
NewSuite(m).
Setup(istio.Setup(&i, nil)).
Setup(deployment.SetupSingleNamespace(&apps)).
Setup(func(t resource.Context) error {
gatewayConformanceInputs.Client = t.Clusters().Default()
gatewayConformanceInputs.Cleanup = !t.Settings().NoCleanup
return nil
}).
Run()
}
func echoConfig(ns namespace.Instance, name string) echo.Config {
return echo.Config{
Service: name,
Namespace: ns,
Ports: []echo.Port{
{
Name: "http",
Protocol: protocol.HTTP,
// We use a port > 1024 to not require root
WorkloadPort: 8090,
},
},
Subsets: []echo.SubsetConfig{{}},
}
}