e2e

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

README

Open Match E2E Tests

Open Match can run locally (aka Minimatch) or on a Kubernetes cluster. This package provides a framework to create tests that can run in both environments.

Minimatch

Minimatch is a single process instance of Open Match that runs with a test in-memory Redis instance. This allows you to run Open Match tests without a Kubernetes cluster quickly. There's only 1 instance of each service and they are served from the same port on localhost.

Kubernetes

Running Open Match on Kubernetes is how Open Match is meant to be run in production. By default, 3 replicas of each server is running behind a load balancer. Running tests against a cluster has the benefits of running the tests in a realistic setting where requests may not be routed to the same server.

How to Use the E2E Test Framework?

For a new test package under test/e2e/ do the following:

Copy the contents of internal/testing/e2e/main_test.go and change the package name and add the open-match.dev/open-match/internal/testing/e2e import.

Example (may be out of date):

// Copyright 2019 Google LLC
//
// 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 tickets

import (
	"open-match.dev/open-match/internal/testing/e2e"
	"testing"
)

func TestMain(m *testing.M) {
	e2e.RunMain(m)
}

Then create your tests like other tests in the test/e2e/ directory.

If your test is not compatible with E2E cluster tests then add // +build !e2ecluster at the top of the file. It must be the first line!

How Does it Work?

Minimatch

Minimatch mode essentially binds all the services that Open Match provides into a single gRPC/HTTP server. The magic happens in the internal/app/minimatch/minimatch.go's BindService() method.

In addition, there's an in-memory Redis instance that's initialized and bound in internal/testing/e2e/in_memory.go.

From here the OM instance encapsulates the details of communicating with these components.

Kubernetes Cluster

Kubernetes cluster mode is managed via internal/testing/e2e/cluster.go

Documentation

Index

Constants

View Source
const (
	// Map1BeginnerPool is a pool name.
	Map1BeginnerPool = "map1beginner"
	// Map1AdvancedPool is pool name.
	Map1AdvancedPool = "map1advanced"
	// Map2BeginnerPool is pool name.
	Map2BeginnerPool = "map2beginner"
	// Map2AdvancedPool is pool name.
	Map2AdvancedPool = "map2advanced"
	// DoubleArgMMR is an index used to test DoubleRangeFilter.
	DoubleArgMMR = "attribute.mmr"
	// DoubleArgLevel is an index used to test DoubleRangeFilter.
	DoubleArgLevel = "attribute.level"
	// DoubleArgDefense is an index used to test DoubleRangeFilter.
	DoubleArgDefense = "attribute.defense"
	// ModeDemo is an index used to test BoolEqualsFilter
	ModeDemo = "mode.demo"
	// Role is an index used to test StringEqualsFilter
	Role = "char"
)

Variables

This section is empty.

Functions

func RunMain

func RunMain(m *testing.M)

RunMain provides the setup and teardown for Open Match e2e tests.

Types

type OM

type OM interface {
	// MustFrontendGRPC returns a gRPC client to frontend server.
	MustFrontendGRPC() pb.FrontendServiceClient
	// MustBackendGRPC returns a gRPC client to backend server.
	MustBackendGRPC() pb.BackendServiceClient
	// MustQueryServiceGRPC returns a gRPC client to query server.
	MustQueryServiceGRPC() pb.QueryServiceClient
	// HealthCheck probes the cluster for readiness.
	HealthCheck() error
	// MustMmfConfigGRPC returns a grpc match function config for backend server.
	MustMmfConfigGRPC() *pb.FunctionConfig
	// MustMmfConfigHTTP returns a http match function config for backend server.
	MustMmfConfigHTTP() *pb.FunctionConfig
	// Context provides a context to call remote methods.
	Context() context.Context
	// contains filtered or unexported methods
}

OM is the interface for communicating with Open Match.

func New

func New(t *testing.T) (OM, func())

New creates a new e2e test interface.

Jump to

Keyboard shortcuts

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