Documentation
¶
Index ¶
- Variables
- func AssertMaxConcurrency(t *testing.T, prs []v1.PipelineRun, limit int)
- func GoldenPodLog(ctx context.Context, t *testing.T, clients *params.Run, ...)
- func RegexpMatchingInControllerLog(ctx context.Context, clients *params.Run, reg regexp.Regexp, ...) error
- func RegexpMatchingInPodLog(ctx context.Context, clients *params.Run, ...) error
- func SortPipelineRunsByCompletionMillis(prs []v1.PipelineRun)
- func SortPipelineRunsByCreationMillis(prs []v1.PipelineRun)
- func Succeeded(ctx context.Context, t *testing.T, runcnx *params.Run, opts options.E2E, ...)
- func UntilMinPRAppeared(ctx context.Context, clients clients.Clients, opts Opts, minNumber int) error
- func UntilPipelineRunCreated(ctx context.Context, clients clients.Clients, opts Opts) ([]v1.PipelineRun, error)
- func UntilPipelineRunHasReason(ctx context.Context, clients clients.Clients, ...) ([]v1.PipelineRun, error)
- func UntilPipelineRunsFinished(ctx context.Context, clients clients.Clients, opts Opts) ([]v1.PipelineRun, error)
- type Counts
- type Interval
- type Opts
- type Overlap
- type SuccessOpt
Constants ¶
This section is empty.
Variables ¶
var DefaultTimeout = 10 * time.Minute
Functions ¶
func AssertMaxConcurrency ¶ added in v0.50.0
func AssertMaxConcurrency(t *testing.T, prs []v1.PipelineRun, limit int)
AssertMaxConcurrency fails the test if more than limit PipelineRuns were ever running at the same time.
Asserting that queued PipelineRuns all eventually succeed says nothing about whether the limit was honoured, since a queue that ignores the limit entirely also finishes every run. This is the assertion that actually tests the queue.
func GoldenPodLog ¶ added in v0.24.0
func GoldenPodLog(ctx context.Context, t *testing.T, clients *params.Run, ns, labelselector, containerName, goldenFile string, maxNumberOfLoop int, sinceSeconds *int64)
GoldenPodLog is a helper function to get the logs of a pod and compare it to a golden file.
func RegexpMatchingInControllerLog ¶ added in v0.18.0
func RegexpMatchingInPodLog ¶ added in v0.13.0
func SortPipelineRunsByCompletionMillis ¶ added in v0.50.0
func SortPipelineRunsByCompletionMillis(prs []v1.PipelineRun)
SortPipelineRunsByCompletion sorts the pipeline runs by completion time, then by creation time. Note that it converts time to milliseconds to avoid precision issues.
func SortPipelineRunsByCreationMillis ¶ added in v0.50.0
func SortPipelineRunsByCreationMillis(prs []v1.PipelineRun)
SortPipelineRunsByCreationMillis sorts the pipeline runs by creation time. Note that it converts time to milliseconds to avoid precision issues.
func UntilMinPRAppeared ¶ added in v0.13.0
func UntilPipelineRunCreated ¶ added in v0.22.5
func UntilPipelineRunHasReason ¶ added in v0.34.0
func UntilPipelineRunHasReason(ctx context.Context, clients clients.Clients, desiredReason v1.PipelineRunReason, opts Opts) ([]v1.PipelineRun, error)
UntilPipelineRunHasReason Checks for certain reason of PipelineRuns.
func UntilPipelineRunsFinished ¶ added in v0.50.0
func UntilPipelineRunsFinished(ctx context.Context, clients clients.Clients, opts Opts) ([]v1.PipelineRun, error)
UntilPipelineRunsFinished waits until at least MinNumberStatus PipelineRuns have reached a terminal state (Succeeded, Failed, or Cancelled) AND have been fully reported by the PaC watcher (state annotation set to completed or failed). The watcher patches the state annotation as its last action, after all status reporting and annotation patching (log-url, check-run-id, ...), so waiting on it guarantees those annotations are present — the same ordering the previous wait implementation provided. Results are sorted by completion time ascending (oldest first, newest last).
Types ¶
type Counts ¶ added in v0.50.0
Counts is a breakdown of PipelineRuns by how far along they are.
func CountPipelineRuns ¶ added in v0.50.0
func CountPipelineRuns(ctx context.Context, clients clients.Clients, ns string) (Counts, []v1.PipelineRun, error)
CountPipelineRuns groups the PipelineRuns of a namespace by state. Pending means the queue is still holding it back; running means it has started and has not finished.
func UntilCounts ¶ added in v0.50.0
func UntilCounts(ctx context.Context, t *testing.T, clients clients.Clients, ns, describe string, timeout time.Duration, cond func(Counts) bool) (Counts, []v1.PipelineRun)
UntilCounts polls a namespace until its PipelineRuns satisfy cond, and fails the test with the last counts seen if they never do. describe is used in that failure message to say what was being waited for.
type Interval ¶ added in v0.50.0
Interval is the window a single PipelineRun occupied a concurrency slot for.
type Overlap ¶ added in v0.50.0
Overlap is the busiest moment observed across a set of PipelineRuns: how many ran at once, when, and which ones they were.
func MaxConcurrency ¶ added in v0.50.0
func MaxConcurrency(prs []v1.PipelineRun) Overlap
MaxConcurrency computes the largest number of PipelineRuns that were running at the same instant, from their recorded start and completion times.
This is deliberately retrospective rather than a poll of the live cluster: a poller samples, and an overshoot that lasts less than the polling interval is invisible to it. Working from the recorded intervals cannot miss a window.
PipelineRuns that never started are ignored. One still running when the snapshot was taken is treated as running until the latest end seen, which is the least favourable reading and so cannot hide an overshoot. Kubernetes timestamps have second granularity, so an interval that ends in the same second it started is treated as a point and cannot overlap anything.