ntopts

package
v1.23.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 10 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 GitHubAppTest

func GitHubAppTest(opt *New)

GitHubAppTest specifies the test is for verifying the githubapp auth type.

func KCCTest

func KCCTest(opt *New)

KCCTest specifies the test is a kcc test.

func ProfilingTest

func ProfilingTest(opt *New)

ProfilingTest specifies the test is a profiling test.

func RequireHelmProvider

func RequireHelmProvider(opt *New)

RequireHelmProvider will enable Helm repo client login and logout

func RequireLocalGitProvider

func RequireLocalGitProvider(opt *New)

RequireLocalGitProvider will skip the test with non-local GitProvider types

func RequireLocalHelmProvider

func RequireLocalHelmProvider(opt *New)

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

func RequireLocalOCIProvider

func RequireLocalOCIProvider(opt *New)

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

func RequireOCIProvider

func RequireOCIProvider(opt *New)

RequireOCIProvider will enable OCI repo client login and logout

func SkipAutopilotCluster

func SkipAutopilotCluster(opt *New)

SkipAutopilotCluster will skip the test on the autopilot cluster.

func SkipConfigSyncInstall

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 SyncWithGitSource

func SyncWithGitSource(id core.ID, gitOpts ...GitSourceOption) func(opt *New)

SyncWithGitSource tells the test case that a RootSync or RepoSync should be applied that points to an empty Git Repository. TODO: Add another option that allows specifying an existing Repository

func Unstructured

func Unstructured(source *syncsource.GitSyncSource)

Unstructured mutates a GitSyncSource to use the unstructured SourceFormat.

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

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 GitSourceOption

type GitSourceOption func(*syncsource.GitSyncSource)

GitSourceOption mutates a GitSyncSource

type MultiRepo

type MultiRepo struct {
	// SyncSources is the set of RootSyncs and RepoSync and their source config
	// for this test.
	SyncSources syncsource.Set

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

	// DeletionPropagationPolicy sets the deletion propagation policy for all RSyncs
	DeletionPropagationPolicy *metadata.DeletionPropagationPolicy
}

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

	// ClusterHash is a 64 character long unique identifier formed in hex used to identify a GKE cluster.
	ClusterHash 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

	MultiRepo
	TestType
}

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

func (*New) EvaluateSkipOptions

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 Opt

type Opt func(opt *New)

Opt is an option type for ntopts.New.

func RepoSyncPermissions

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

RepoSyncPermissions specifies PolicyRule(s) to grant NS reconcilers

func RequireCloudSourceRepository

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

func RequireHelmArtifactRegistry(t testing.NTB) Opt

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

func RequireKind

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

func RequireOCIArtifactRegistry(t testing.NTB) Opt

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

func RequireSecureSourceManagerRepository

func RequireSecureSourceManagerRepository(t testing.NTB) Opt

RequireSecureSourceManagerRepository requires the --git-provider flag to be set to ssm

func WithDeletionPropagationPolicy

func WithDeletionPropagationPolicy(policy metadata.DeletionPropagationPolicy) Opt

WithDeletionPropagationPolicy specifies the DeletionPropagationPolicy

func WithoutDeletionPropagationPolicy

func WithoutDeletionPropagationPolicy() Opt

WithoutDeletionPropagationPolicy specifies no DeletionPropagationPolicy No annotation will be added to RSyncs, causing the default policy to be used ("Orphan")

type RepoControl

type RepoControl string

RepoControl indicates the type of control for Namespace repos.

type TestType

type TestType struct {

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

	// ProfilingTest specifies the test is a profiling test.
	ProfilingTest 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

	// GitHubAppTest specifies the test is for verifying the githubapp auth type.
	GitHubAppTest bool
}

TestType represents the test type.

Jump to

Keyboard shortcuts

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