tests

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2021 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	VirtualMesh         *networkingv1.VirtualMesh
	VirtualMeshManifest utils.Manifest
)
View Source
var (
	BookinfoNamespace = "bookinfo"

	MgmtClusterName   = "mgmt-cluster"
	RemoteClusterName = "remote-cluster"

	MgmtMesh = &v1.ObjectRef{
		Name:      "istiod-istio-system-mgmt-cluster",
		Namespace: "gloo-mesh",
	}

	RemoteMesh = func() (*v1.ObjectRef, error) {
		var meshName string
		var out bytes.Buffer

		cmd := exec.Command("bash", "-c", "istioctl version")
		cmd.Stdout = &out
		err := cmd.Run()
		if err != nil {
			return nil, err
		}

		outputString := out.String()
		if strings.Contains(outputString, "1.7") {

			meshName = "istiod-istio-system-remote-cluster"
		} else {

			meshName = "istiod-rev-istio-system-remote-cluster"
		}

		return &v1.ObjectRef{
			Name:      meshName,
			Namespace: "gloo-mesh",
		}, nil
	}

	CurlReviews = func() string {
		return CurlFromProductpage("http://reviews:9080/reviews/1")
	}

	CurlHelloServer = func() string {
		return CurlFromProductpage(fmt.Sprintf("http://%v:%v/", extensions.HelloServerHostname, extensions.HelloServerPort))
	}

	CurlRemoteReviews = func(federatedSuffix string) func() string {
		return func() string {
			return CurlFromProductpage(fmt.Sprintf("http://reviews.%v.svc.%v.%s:9080/reviews/1", BookinfoNamespace, RemoteClusterName, federatedSuffix))
		}
	}

	CurlRatings = func() string {
		return CurlFromProductpage("http://ratings:9080/ratings/1")
	}

	CurlUrl = func(url string) func() string {
		return func() string {
			return CurlFromProductpage(url)
		}
	}

	// Public to be used in enterprise
	CurlFromProductpage = func(url string) string {
		env := e2e.GetEnv()
		ctx, cancel := context.WithTimeout(context.Background(), time.Minute/2)
		defer cancel()
		out := env.Management.GetPod(ctx, BookinfoNamespace, "productpage").Curl(ctx, url, "-v")
		GinkgoWriter.Write([]byte(out))
		return out
	}

	CurlGateway = func(hostname, path, body, method string) string {
		out, err := CurlLocal(hostname, path, body, method, "32000")
		Expect(err).NotTo(HaveOccurred())
		return out
	}

	CurlIngressMgmt = func(hostname, path, body, method string) (string, error) {
		return CurlLocal(hostname, path, body, method, "32011")
	}

	CurlIngressRemote = func(hostname, path, body, method string) (string, error) {
		return CurlLocal(hostname, path, body, method, "32010")
	}

	CurlLocal = func(hostname, path, body, method, port string) (string, error) {
		curlCmd := exec.Command("curl", "--connect-timeout", "1", "--max-time", "5", "-H", "Host: "+hostname, "http://localhost:"+port+path, "-v", "-d", body, "-X", method)
		out, err := curlCmd.CombinedOutput()
		if err == nil {
			GinkgoWriter.Write(out)
		}

		return string(out), err
	}
)

Shared test vars

Functions

func AccessPolicyTest

func AccessPolicyTest()

run tests for AccessPolicy CRD functionality

func ConflictDetectionTest added in v1.1.0

func ConflictDetectionTest()

This test assumes conflict detection is enabled at Gloo Mesh boot time using the "--disallow-intersecting-config=true" CLI flag.

func DiscoveryTest added in v1.0.0

func DiscoveryTest()

run Enterprise Discovery regression tests

func FederateClusters added in v0.12.3

func FederateClusters(vm *networkingv1.VirtualMesh, timeoutMinutes int)

exported for use in enterprise

func FederationTest

func FederationTest()

func InitializeTests

func InitializeTests() bool

initialize all tests in suite should be called from init() function or top level var

func NetworkingExtensionsTest

func NetworkingExtensionsTest()

func SetupClustersAndFederation

func SetupClustersAndFederation(customDeployFuc func())

Before running tests, federate the two clusters by creating a VirtualMesh with mTLS enabled.

func TeardownFederationAndClusters

func TeardownFederationAndClusters()

func TrafficPolicyTest

func TrafficPolicyTest()

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL