ntopts

package
v1.17.2 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 8 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 KCCTest added in v1.16.0

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 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 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 SkipConfigSyncInstall added in v1.15.1

func SkipConfigSyncInstall(opt *New)

SkipConfigSyncInstall skip installation of Config Sync components in cluster

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 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 by default.

func WithoutReconcileTimeout added in v1.16.0

func WithoutReconcileTimeout(opt *New)

WithoutReconcileTimeout tells the test case not to override the default reconcile timeout on all RootSyncs and RepoSyncs by default.

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 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

	// 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

	// RepoSyncPermissions will grant a list of PolicyRules to NS reconcilers
	RepoSyncPermissions []rbacv1.PolicyRule
}

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

	// ClusterName is the name of the target cluster used by the test.
	ClusterName string

	// IsEphemeralCluster indicates whether the cluster will be destroyed.
	IsEphemeralCluster bool

	// 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

	// KubeconfigPath is the path to the kubeconfig file
	KubeconfigPath string

	// SkipConfigSyncInstall skips installation/cleanup of Config Sync
	SkipConfigSyncInstall bool

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

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

	// TestFeature is the feature that the test verifies
	TestFeature testing.Feature

	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
}

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 RepoSyncPermissions added in v1.15.1

func RepoSyncPermissions(policy ...rbacv1.PolicyRule) Opt

RepoSyncPermissions specifies PolicyRule(s) to grant NS reconcilers

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 RequireKind added in v1.15.1

func RequireKind(t testing.NTB) Opt

RequireKind requires the --test-cluster flag to be `kind` so that the test only runs on kind 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.

func WithRestConfig added in v1.15.1

func WithRestConfig(restConfig *rest.Config) Opt

WithRestConfig uses the provided rest.Config

type RepoControl added in v1.15.1

type RepoControl string

RepoControl indicates the type of control for Namespace repos.

type RepoOpts

type RepoOpts struct{}

RepoOpts defines options for a Repository. Add options as-needed for tests.

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