e2e

package
v1.13.0-rc.7 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package e2e and its subpacakages define go e2e tests for Nomos.

Running the Tests

A) With make, rebuilding the Nomos image:

$ make go-e2e-test

B) With make, without rebuilding the image:

$ make go-e2e-test-nobuild

C) Directly, without rebuilding:

$ go test ./e2e/... --e2e

Running the tests directly requires running scripts.docker-registry.sh as a one-time setup step.

You can use all of the normal `go test` flags. The `--e2e` is required or else the e2e tests won't run. This lets you run go test ./... to just run unit/integration tests.

Debugging

Use --debug to use the debug mode for tests. In this mode, on failure the test does not destroy the kind cluster and delete the temporary directory. Instead, it prints out where the temporary directory is and how to connect to the kind cluster.

The temporary directory includes:

  1. All manifests used to install ConfigSync
  2. The private/public SSH keys to connect to git-server
  3. The local repository(ies), already configured to talk to git server. Just remember to port-forward to the git-server Pod if you want to read from/write to it.

If you want to stop the test at any time, just use t.FailNow().

Package e2e defines e2e-test-specific imports and flags for use in e2e testing.

Index

Constants

View Source
const (
	// RunAll runs all tests whether skipped or not
	RunAll = "runAll"
	// RunSkipped runs only skipped tests
	RunSkipped = "runSkipped"
	// RunDefault runs tests as normal and skips skipped tests
	RunDefault = ""
)
View Source
const (
	// Kind indicates creating a Kind cluster for testing.
	Kind = "kind"
	// GKE indicates using an existing GKE cluster for testing.
	GKE = "gke"
	// Kubeconfig provides the context via KUBECONFIG for testing.
	Kubeconfig = "kube-config"
)
View Source
const (
	// Local indicates using a local git-test-server.
	Local = "local"
	// Bitbucket indicates using Bitbucket to host the repositories.
	Bitbucket = "bitbucket"
	// Github indicates using GitHub to host the repositories.
	Github = "github"
	// GitLab indicates using GitLab to host the repositories.
	GitLab = "gitlab"
	// CSR indicates using Google Cloud Source Repositories to host the repositories.
	CSR = "csr"
)
View Source
const DefaultImagePrefix = "localhost:5000"

DefaultImagePrefix points to the local docker registry.

Variables

View Source
var Debug = flag.Bool("debug", false,
	"If true, do not destroy cluster and clean up temporary directory after test.")

Debug enables running the test in debug mode. In debug mode:

  1. Test execution immediately stops on a call to t.Fatal.
  2. The test prints the absolute path to the test temporary directory, and not delete it.
  3. The test prints out how to connect to the kind cluster.
View Source
var E2E = flag.Bool("e2e", false,
	"If true, run end-to-end tests.")

E2E enables running end-to-end tests.

View Source
var GceNode = flag.Bool("gcenode", false,
	"If true, run test with 'gcenode' auth type.")

GceNode enables running the e2e tests for 'gcenode' auth type

View Source
var GitProvider = flag.String("git-provider", Local,
	"The git provider that hosts the Git repositories. Defaults to local")

GitProvider is the provider that hosts the Git repositories.

View Source
var ImagePrefix = flag.String("image-prefix", DefaultImagePrefix,
	"The prefix to use for Docker images. Defaults to the local Docker registry. Omit the trailing slash.")

ImagePrefix is where the Docker images are stored.

View Source
var ImageTag = flag.String("image-tag", "latest",
	"The tag to use for Docker images. Defaults to 'latest'")

ImageTag is the tag to use for Docker images.

View Source
var Kcc = flag.Bool("kcc", false,
	"If true, run kcc tests.")

Kcc enables running the e2e tests for kcc resources.

View Source
var KubeConfig = flag.String(Kubeconfig, "",
	"The file path to the kubeconfig file. If not set, use the default context.")

KubeConfig specifies the file path to the kubeconfig file.

View Source
var KubernetesVersion = flag.String("kubernetes-version", "1.21",
	"The version of Kubernetes to create")

KubernetesVersion is the version of Kubernetes to test against. Only has effect when testing against test-created Kind clusters.

View Source
var Load = flag.Bool("load", false,
	"If true, run load tests.")

Load enables running of load tests.

View Source
var Manual = flag.Bool("manual", false,
	"Specify that the test is being run manually.")

Manual indicates the test is being run manually. Some tests are not yet safe to be run automatically.

View Source
var MultiRepo = flag.Bool("multirepo", false,
	"If true, configure multi-repo Config Sync. Otherwise configure mono-repo.")

MultiRepo enables running the tests against multi-repo Config Sync.

View Source
var ShareTestEnv = flag.Bool("share-test-env", false,
	"Specify that the test is using a shared test environment instead of fresh installation per test case.")

ShareTestEnv indicates whether to share the test env for all test cases. If it is true, we only install nomos once before all tests and tear it down until all tests complete.

View Source
var SkipMode = flag.String("skip-mode", "",
	"Runs tests as given by the mode, one of \"\", runAll, runSkipped to run normally, run all tests, or run only skipped tests respectively")

SkipMode will only run the skipped multi repo tests.

View Source
var Stress = flag.Bool("stress", false,
	"If true, run stress tests.")

Stress enables running of stress tests.

View Source
var TestCluster = flag.String("test-cluster", Kind,
	fmt.Sprintf("The cluster config used for testing. Allowed values are: %s and %s. "+
		"If --test-cluster=%s, create a Kind cluster. Otherwise use the GKE context specified in %s.",
		GKE, Kind, Kind, Kubeconfig))

TestCluster specifies the cluster config used for testing.

Functions

func EnableParallel

func EnableParallel(t *testing.T)

EnableParallel allows parallel execution of test functions that call t.Parallel if test.parallel is greater than 1.

func RunInParallel

func RunInParallel() bool

RunInParallel indicates whether the test is running in parallel.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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