ntopts

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 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 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 RequireHelmProvider added in v1.18.0

func RequireHelmProvider(opt *New)

RequireHelmProvider will enable Helm repo client login and logout

func RequireLocalGitProvider added in v1.18.0

func RequireLocalGitProvider(opt *New)

RequireLocalGitProvider will skip the test with non-local GitProvider types

func RequireLocalHelmProvider added in v1.18.0

func RequireLocalHelmProvider(opt *New)

RequireLocalHelmProvider will skip the test with non-local HelmProvider types. RequireLocalHelmProvider implies RequireHelmProvider.

func RequireLocalOCIProvider added in v1.18.0

func RequireLocalOCIProvider(opt *New)

RequireLocalOCIProvider will skip the test with non-local OCIProvider types. RequireLocalOCIProvider implies RequireOCIProvider.

func RequireOCIProvider added in v1.18.0

func RequireOCIProvider(opt *New)

RequireOCIProvider will enable OCI repo client login and logout

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

	// RequireOCIProvider will enable GitProvider Login & Logout.
	RequireOCIProvider bool

	// RequireHelmProvider will enable HelmProvider Login & Logout.
	RequireHelmProvider bool

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

	// RequireLocalOCIProvider will skip the test if run with a OCIProvider type other than local.
	RequireLocalOCIProvider bool

	// RequireLocalHelmProvider will skip the test if run with a HelmProvider type other than local.
	RequireLocalHelmProvider 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.

func (*New) EvaluateSkipOptions added in v1.18.0

func (optsStruct *New) EvaluateSkipOptions(t testing.NTB)

EvaluateSkipOptions compares the flags for this specific test case against the runtime options that were provided to the test suite. The test may be skipped based on the below set of rules.

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 RequireCloudSourceRepository added in v1.18.0

func RequireCloudSourceRepository(t testing.NTB) Opt

RequireCloudSourceRepository requires the --git-provider flag to be set to csr

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 RequireHelmArtifactRegistry added in v1.18.0

func RequireHelmArtifactRegistry(t testing.NTB) Opt

RequireHelmArtifactRegistry requires the --helm-provider flag to be set to `gar`. RequireHelmArtifactRegistry implies RequireHelmProvider.

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 RequireOCIArtifactRegistry added in v1.18.0

func RequireOCIArtifactRegistry(t testing.NTB) Opt

RequireOCIArtifactRegistry requires the --oci-provider flag to be set to `gar`. RequireOCIArtifactRegistry implies RequireOCIProvider.

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 {

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