Help us shape the future of Go! Take the 2026 Go Developer Survey

testing

package
v1.24.3 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ArtifactRegistryHost is the host address of the Artifact Registry
	ArtifactRegistryHost = "us-docker.pkg.dev"
	// GoogleContainerRegistryHost is the host address of the Container Registry
	GoogleContainerRegistryHost = "gcr.io"
	// CSRHost is the host address of the Cloud Source Repositories
	CSRHost = "https://source.developers.google.com"
	// GCSHost is the host address of Google Cloud Storage
	GCSHost = "https://storage.googleapis.com"

	// SSMInstanceID is the ID of the Secure Source Manager instance to be used by SSM tests
	SSMInstanceID = "configsync-test"

	// TestInfraContainerRepositoryPath is the Config Sync test-infra repository path
	TestInfraContainerRepositoryPath = "kpt-config-sync-ci-artifacts"
	// TestInfraArtifactRepositoryPath is the Config Sync test-infra repository path
	TestInfraArtifactRepositoryPath = "kpt-config-sync-ci-artifacts/test-infra"
	// ConfigSyncTestPublicRepositoryPath is the Config Sync config-sync-test-public repository path
	ConfigSyncTestPublicRepositoryPath = "kpt-config-sync-ci-artifacts/config-sync-test-public"
	// ConfigSyncTestHelmChartsBucket is the Config Sync GCS bucket name
	ConfigSyncTestHelmChartsBucket = "kpt-config-sync-ci-test-helm-charts"

	// TestInfraContainerRepositoryAddress is the Config Sync test-infra repository hosted on GCR
	TestInfraContainerRepositoryAddress = GoogleContainerRegistryHost + "/" + TestInfraContainerRepositoryPath
	// TestInfraArtifactRepositoryAddress is the Config Sync test-infra repository hosted on GAR
	TestInfraArtifactRepositoryAddress = ArtifactRegistryHost + "/" + TestInfraArtifactRepositoryPath
	// ConfigSyncTestPublicRepositoryAddress is the Config Sync config-sync-test-public repository hosted on GAR
	ConfigSyncTestPublicRepositoryAddress = ArtifactRegistryHost + "/" + ConfigSyncTestPublicRepositoryPath
	// ConfigSyncTestHelmChartsAddress is the Config Sync GCS bucket address
	ConfigSyncTestHelmChartsAddress = GCSHost + "/" + ConfigSyncTestHelmChartsBucket

	// HTTPDImage is the httpd image used by on-cluster test components
	HTTPDImage = "httpd:2"
	// RegistryImage is the registry image used by on-cluster test components
	RegistryImage = "registry:2"
	// NginxImage is the nginx image used by on-cluster test components
	NginxImage = "nginx:1.23"
	// PrometheusImage is the prometheus image used by on-cluster test components
	PrometheusImage = "prom/prometheus:v2.37.6"
)
View Source
const (
	// ACMController verifies features like the resource-group-controller, reconciler-manager, and etc.
	ACMController Feature = "acm-controller"
	// NomosCLI verifies the CLI.
	NomosCLI = "nomos-cli"
	// Selector verifies ClusterSelector, the cluster-name-selector annotation, and NamespaceSelector
	Selector = "selector"
	// DriftControl verifies the admission webhook and drift correction.
	DriftControl = "drift-control"
	// Hydration verifies the rendering feature in the hydration-controller.
	Hydration = "hydration"
	// Lifecycle verifies the lifecycle directives feature.
	Lifecycle = "lifecycle"
	// MultiRepos verifies the multiple repos, including multiple root repos, namespace repos and different control modes.
	MultiRepos = "multi-repos"
	// OverrideAPI verifies the override API in RSync.
	OverrideAPI = "override-api"
	// Reconciliation1 verifies the first part of the reconciliation test.
	Reconciliation1 = "reconciliation-1"
	// Reconciliation2 verifies the second part of the reconciliation test.
	Reconciliation2 = "reconciliation-2"
	// SyncSourceGit verifies syncing from a Git repository
	SyncSourceGit = "sync-source-git"
	// SyncSourceOCI verifies syncing from an OCI image
	SyncSourceOCI = "sync-source-oci"
	// SyncSourceHelm verifies syncing from a Helm chart
	SyncSourceHelm = "sync-source-helm"
	// WorkloadIdentity verifies authenticating with workload identity (GKE and Fleet).
	WorkloadIdentity = "workload-identity"
)

Variables

This section is empty.

Functions

func KnownFeature

func KnownFeature(f Feature) bool

KnownFeature indicates whether the test verifies a known feature

Types

type FakeNTB

type FakeNTB struct {
	// contains filtered or unexported fields
}

FakeNTB implements NTB with standard print out and exit. It is used in `e2e/testcases/main_test.go` when `--share-test-env` is turned on.

func NewFakeNTB

func NewFakeNTB(name string) *FakeNTB

NewFakeNTB returns a new FakeNTB

func (*FakeNTB) Cleanup

func (t *FakeNTB) Cleanup(f func())

Cleanup registers a cleanup function to call at the end of the test suite.

func (*FakeNTB) Error

func (t *FakeNTB) Error(args ...interface{})

Error is equivalent to Log followed by Fail.

func (*FakeNTB) Errorf

func (t *FakeNTB) Errorf(format string, args ...interface{})

Errorf is equivalent to Logf followed by Fail.

func (*FakeNTB) Fail

func (t *FakeNTB) Fail()

Fail marks the function as having failed but continues execution.

func (*FakeNTB) FailNow

func (t *FakeNTB) FailNow()

FailNow marks the function as having failed and stops its execution by calling runtime.Goexit (which then runs all deferred calls in the current goroutine).

func (*FakeNTB) Failed

func (t *FakeNTB) Failed() bool

Failed reports whether the function has failed.

func (*FakeNTB) Fatal

func (t *FakeNTB) Fatal(args ...interface{})

Fatal is equivalent to Log followed by FailNow.

func (*FakeNTB) Fatalf

func (t *FakeNTB) Fatalf(format string, args ...interface{})

Fatalf is equivalent to Logf followed by FailNow.

func (*FakeNTB) Helper

func (t *FakeNTB) Helper()

Helper is a no-op function.

func (*FakeNTB) Log

func (t *FakeNTB) Log(args ...interface{})

Log generates the output. It's always at the same stack depth.

func (*FakeNTB) Logf

func (t *FakeNTB) Logf(format string, args ...interface{})

Logf formats its arguments according to the format, analogous to Printf, and records the text in the error log.

func (*FakeNTB) Name

func (t *FakeNTB) Name() string

Name returns an empty string.

func (*FakeNTB) RunCleanup

func (t *FakeNTB) RunCleanup()

RunCleanup invokes all registered cleanup functions. this should be called at the end of the shared test quite after all tests have completed.

func (*FakeNTB) Skip

func (t *FakeNTB) Skip(...interface{})

Skip is a no-op function.

func (*FakeNTB) SkipNow

func (t *FakeNTB) SkipNow()

SkipNow is a no-op function.

func (*FakeNTB) Skipf

func (t *FakeNTB) Skipf(string, ...interface{})

Skipf is a no-op function.

func (*FakeNTB) Skipped

func (t *FakeNTB) Skipped() bool

Skipped is a no-op function.

type Feature

type Feature string

Feature indicates which feature the e2e test verifies

type NTB

type NTB interface {
	Cleanup(func())
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Fail()
	FailNow()
	Failed() bool
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
	Helper()
	Log(args ...interface{})
	Logf(format string, args ...interface{})
	Name() string
	Skip(args ...interface{})
	SkipNow()
	Skipf(format string, args ...interface{})
	Skipped() bool
}

NTB partially implements testing.TB It is used by the shared setup steps to invoke the per-test functions.

func New

func New(t *testing.T, testFeature Feature) NTB

New creates a new instance of the Testing Wrapper that provides additional functionality beyond the standard testing package.

func NewShared

func NewShared(t *FakeNTB) NTB

NewShared creates a new instance of the Testing Wrapper that provides additional functionality beyond the standard testing package. It doesn't require the testFeature param.

Jump to

Keyboard shortcuts

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