ntopts

package
v1.13.0-rc.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DelegatedControl indicates the central admin only declares the Namespace
	// in the Root Repo and delegates declaration of RepoSync to the app operator.
	DelegatedControl = "Delegated"
	// CentralControl indicates the central admin only declares the Namespace
	// in the Root Repo and delegates declaration of RepoSync to the app operator.
	CentralControl = "Central"
)

Variables

This section is empty.

Functions

func GCENodeTest

func GCENodeTest(opt *New)

GCENodeTest specifies the test is for verifying the gcenode auth type.

func InstallResourceGroupController

func InstallResourceGroupController(opts *New)

InstallResourceGroupController installs the resource-group controller.

func KccTest

func KccTest(opt *New)

KccTest specifies the test is a kcc test.

func LoadTest

func LoadTest(opt *New)

LoadTest specifies the test is a load test.

func MultiRepoIncompatible

func MultiRepoIncompatible(opt *New)

MultiRepoIncompatible will always skip the test in multi repo mode.

func NamespaceRepo

func NamespaceRepo(ns, name string) func(opt *New)

NamespaceRepo tells the test case that a Namespace Repo should be configured that points at the provided Repository.

func NamespaceRepoWithUpstream

func NamespaceRepoWithUpstream(ns, name string, upstreamURL string) func(opt *New)

NamespaceRepoWithUpstream tells the test case that a Namespace Repo should be configured that points at the provided Repository.

func RootRepo

func RootRepo(name string) func(opt *New)

RootRepo tells the test case that a Root Repo should be configured that points at the provided Repository.

func SkipAutopilotCluster

func SkipAutopilotCluster(opt *New)

SkipAutopilotCluster will skip the test on the autopilot cluster.

func SkipMonoRepo

func SkipMonoRepo(opt *New)

SkipMonoRepo will skip the test in mono repo mode.

func SkipMultiRepo

func SkipMultiRepo(opt *New)

SkipMultiRepo will skip the test in multi repo mode.

func SkipNonLocalGitProvider

func SkipNonLocalGitProvider(opt *New)

SkipNonLocalGitProvider will skip the test with non-local GitProvider types

func StressTest

func StressTest(opt *New)

StressTest specifies the test is a stress test.

func Unstructured

func Unstructured(opts *New)

Unstructured will set the option for unstructured repo.

func UpstreamRepo

func UpstreamRepo(upstreamURL string) func(opt *New)

UpstreamRepo tells the test case that an Upstream Repo should be used to seed the test repo

func WithCentralizedControl

func WithCentralizedControl(opt *New)

WithCentralizedControl will specify the Central Control Pattern.

func WithDelegatedControl

func WithDelegatedControl(opt *New)

WithDelegatedControl will specify the Delegated Control Pattern.

func WithInitialCommit

func WithInitialCommit(initialCommit Commit) func(opt *New)

WithInitialCommit creates the initialCommit before the first sync

func WithReconcileTimeout

func WithReconcileTimeout(timeout time.Duration) func(opt *New)

WithReconcileTimeout tells the test case to override the default reconcile timeout on all RootSyncs and RepoSyncs.

Types

type Commit

type Commit struct {
	// Message is the commit message
	Message string
	// Files is a map of file paths to Objects
	Files map[string]client.Object
}

Commit represents a commit to be created on a git repository

type KindVersion

type KindVersion string

KindVersion is a specific Kind version associated with a Kubernetes minor version.

const (
	Kind1_24 KindVersion = "kindest/node:v1.24.0@sha256:0866296e693efe1fed79d5e6c7af8df71fc73ae45e3679af05342239cdc5bc8e"
	Kind1_23 KindVersion = "kindest/node:v1.23.6@sha256:b1fa224cc6c7ff32455e0b1fd9cbfd3d3bc87ecaa8fcb06961ed1afb3db0f9ae"
	Kind1_22 KindVersion = "kindest/node:v1.22.9@sha256:8135260b959dfe320206eb36b3aeda9cffcb262f4b44cda6b33f7bb73f453105"
	Kind1_21 KindVersion = "kindest/node:v1.21.12@sha256:f316b33dd88f8196379f38feb80545ef3ed44d9197dca1bfd48bcb1583210207"
	Kind1_20 KindVersion = "kindest/node:v1.20.15@sha256:6f2d011dffe182bad80b85f6c00e8ca9d86b5b8922cdf433d53575c4c5212248"
	Kind1_19 KindVersion = "kindest/node:v1.19.16@sha256:d9c819e8668de8d5030708e484a9fdff44d95ec4675d136ef0a0a584e587f65c"
	Kind1_18 KindVersion = "kindest/node:v1.18.20@sha256:738cdc23ed4be6cc0b7ea277a2ebcc454c8373d7d8fb991a7fcdbd126188e6d7"
	Kind1_17 KindVersion = "kindest/node:v1.17.17@sha256:e477ee64df5731aa4ef4deabbafc34e8d9a686b49178f726563598344a3898d5"
	Kind1_16 KindVersion = "kindest/node:v1.16.15@sha256:64bac16b83b6adfd04ea3fbcf6c9b5b893277120f2b2cbf9f5fa3e5d4c2260cc"
	Kind1_15 KindVersion = "kindest/node:v1.15.12@sha256:9dfc13db6d3fd5e5b275f8c4657ee6a62ef9cb405546664f2de2eabcfd6db778"
	Kind1_14 KindVersion = "kindest/node:v1.14.10@sha256:b693339da2a927949025869425e20daf80111ccabf020d4021a23c00bae29d82"

	// Kubeconfig is the filename of the KUBECONFIG file.
	Kubeconfig = "KUBECONFIG"
)

kind v0.14.x supports k8s 1.18-1.24 - images from https://github.com/kubernetes-sigs/kind/releases/tag/v0.14.0 kind v0.12.x supports k8s 1.14-1.23 - images from https://github.com/kubernetes-sigs/kind/releases/tag/v0.12.0

type MultiRepo

type MultiRepo struct {
	// NamespaceRepos is a set representing the Namespace repos to create.
	//
	// We don't support referencing the Root repository in this map; while we do
	// support this use case, it isn't special behavior that tests any unique code
	// paths.
	NamespaceRepos map[types.NamespacedName]RepoOpts

	// RootRepos is a set representing the Root repos to create.
	RootRepos map[string]RepoOpts

	// Control indicates options for configuring Namespace Repos.
	Control repoControl

	// SkipMultiRepo will skip the test if run in multi repo mode.  This stutters because we decided to embed
	// this struct inside of the "New" struct rather than have it as a member.
	SkipMultiRepo bool

	// MultiRepoIncompatible will disable the test for multi repo.  Setting --skip-mode will not affect whether it gets run.
	// This should be used for disabling tests
	MultiRepoIncompatible bool

	// SkipMonoRepo will skip the test if run in mono repo mode.
	SkipMonoRepo bool

	// ResourceGroup indicates that NT should also install the resource-group controller
	ResourceGroup bool

	// ReconcileTimeout sets spec.override.reconcileTimeout on each R*Sync
	// Default: 5m.
	ReconcileTimeout *time.Duration

	// SkipNonLocalGitProvider will skip the test if run with a GitProvider type other than local.
	SkipNonLocalGitProvider bool
}

MultiRepo configures the NT for use with multi-repo tests. If NonRootRepos is non-empty, the test is assumed to be running in multi-repo mode.

type New

type New struct {
	// Name is the name of the test. Overrides the one generated from the test
	// name.
	Name string

	// TmpDir is the base temporary directory to use for the test. Overrides the
	// generated directory based on Name and the OS's main temporary directory.
	TmpDir string

	// RESTConfig is the config for creating a Client connection to a K8s cluster.
	RESTConfig *rest.Config

	// SkipAutopilot will skip the test if running on an Autopilot cluster.
	SkipAutopilot bool

	// InitialCommit commit to create before the initial sync
	InitialCommit *Commit

	Nomos
	MultiRepo
	TestType
}

New is the set of options for instantiating a new NT test.

type Nomos

type Nomos struct {
	filesystem.SourceFormat

	// MultiRepo indicates that NT should setup and test multi-repo behavior
	// rather than mono-repo behavior.
	MultiRepo bool

	// UpstreamURL upstream URL of repo we need to use for seeding
	UpstreamURL string
}

Nomos configures options for installing Nomos on the test cluster.

type Opt

type Opt func(opt *New)

Opt is an option type for ntopts.New.

func GKECluster

func GKECluster(t testing.NTB) Opt

GKECluster tells the test to use the GKE cluster pointed to by the config flags.

func Kind

func Kind(t testing.NTB, version string) Opt

Kind creates a Kind cluster for the test and fills in the RESTConfig option with the information needed to establish a Client with it.

version is one of the KindVersion constants above.

func RequireGKE

func RequireGKE(t testing.NTB) Opt

RequireGKE requires the --test-cluster flag to be `gke` so that the test only runs on GKE clusters.

func RequireManual

func RequireManual(t testing.NTB) Opt

RequireManual requires the --manual flag is set. Otherwise it will skip the test. This avoids running tests (e.g stress tests) that aren't safe to run against a remote cluster automatically.

type RepoOpts

type RepoOpts struct {
	// UpstreamURL provides the upstream repo to initialize the repo with
	UpstreamURL string
}

RepoOpts defines options for a Repo

type TestType

type TestType struct {
	// LoadTest specifies the test is a load test.
	LoadTest bool

	// StressTest specifies the test is a stress test.
	StressTest bool

	// KccTest specifies the test is for KCC resources.
	KccTest bool

	// GCENodeTest specifies the test is for verifying the gcenode auth type.
	// It requires a GKE cluster with workload identity disabled.
	GCENodeTest bool
}

TestType represents the test type.

Jump to

Keyboard shortcuts

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