utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GitServerNamespace is where the e2e git server (and the fixture fleet)
	// lives.
	GitServerNamespace = "wavefront-e2e"
	// GitServerService is the Service in front of the git server; its
	// in-cluster address is what the fixture GitRepositories point at.
	GitServerService = "gitserver"
	// GitServerPort is the port the git server listens on.
	GitServerPort = 8080
	// GitServerLocalPort is the host-side end of the port-forward the suite
	// pushes through.
	GitServerLocalPort = 18080

	// GitBranch is the branch every fixture repository tracks.
	GitBranch = "main"
)

Variables

This section is empty.

Functions

func GetNonEmptyLines

func GetNonEmptyLines(output string) []string

GetNonEmptyLines converts given command output string into individual objects according to line breakers, and ignores the empty elements in it.

func GetProjectDir

func GetProjectDir() (string, error)

GetProjectDir will return the directory where the project is

func GitServerClusterURL

func GitServerClusterURL(repo string) string

GitServerClusterURL is the in-cluster URL of one repository.

func GitServerLocalURL

func GitServerLocalURL(repo string) string

GitServerLocalURL is the push URL of one repository on the git server, as reached from the host through the port-forward. The in-cluster URL that goes into a GitRepository spec addresses the very same repositories.

func InstallCertManager

func InstallCertManager() error

InstallCertManager installs the cert manager bundle.

func IsCertManagerCRDsInstalled

func IsCertManagerCRDsInstalled() bool

IsCertManagerCRDsInstalled checks if any Cert Manager CRDs are installed by verifying the existence of key CRDs related to Cert Manager.

func KindClusterName

func KindClusterName() string

KindClusterName is the kind cluster the suite is allowed to touch: KIND_CLUSTER as `make test-e2e` sets it, or kind's own default.

func LoadImageToKindClusterWithName

func LoadImageToKindClusterWithName(name string) error

LoadImageToKindClusterWithName loads a local docker image to the kind cluster

func Run

func Run(cmd *exec.Cmd) (string, error)

Run executes the provided command within this context

func UncommentCode

func UncommentCode(filename, target, prefix string) error

UncommentCode searches for target in the file and remove the comment prefix of the target content. The target content may span multiple lines.

func UninstallCertManager

func UninstallCertManager()

UninstallCertManager uninstalls the cert manager

Types

type PortForward

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

PortForward supervises a `kubectl port-forward` for the lifetime of the suite. kubectl gives up on its side of a dropped connection, so the forward is restarted rather than trusted to survive a whole e2e run unattended.

func StartPortForward

func StartPortForward(namespace, service string, local, remote int) *PortForward

StartPortForward launches the supervised forward. Call WaitReady before using it.

func (*PortForward) Stop

func (f *PortForward) Stop()

Stop tears the forward down and waits for the supervisor to exit.

func (*PortForward) WaitReady

func (f *PortForward) WaitReady(timeout time.Duration) error

WaitReady blocks until the forward carries an HTTP round trip end to end. Any status code counts: reaching the git server at all is the signal.

type Repo

type Repo struct {
	Name string
	// contains filtered or unexported fields
}

Repo is a local working copy wired to one repository on the e2e git server. The server auto-creates repositories on first push, so seeding a fixture repository is just a commit away.

func NewRepo

func NewRepo(baseDir, name string) (*Repo, error)

NewRepo initialises an empty working copy for repo name under baseDir.

func (*Repo) Commit

func (r *Repo) Commit(files map[string]string, message string) (string, error)

Commit writes files (path relative to the repository root) and commits them.

func (*Repo) CommitPush

func (r *Repo) CommitPush(files map[string]string, message string) (string, error)

CommitPush is the workhorse: commit files, push, return the new SHA.

func (*Repo) Head

func (r *Repo) Head() string

Head is the SHA of the most recent commit this working copy pushed.

func (*Repo) Push

func (r *Repo) Push(force bool) error

Push publishes the local branch, retrying through port-forward hiccups.

func (*Repo) PushFile

func (r *Repo) PushFile(path, content, message string) (string, error)

PushFile is CommitPush for a single file (the brief's pushCommit).

func (*Repo) Rewrite

func (r *Repo) Rewrite(files map[string]string, message string) (string, error)

Rewrite discards the local history, commits files onto a fresh root commit and force-pushes it — a real history rewrite over whatever is pinned (DESIGN §10).

Jump to

Keyboard shortcuts

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