tests

package
v0.0.0-...-02c6b06 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitHubCtxPrefix = "TM/"
)

Variables

Functions

func FormatInitStatus

func FormatInitStatus(tr *tmv1beta1.Testrun) string

func FormatStatus

func FormatStatus(tr *tmv1beta1.Testrun, dashboardUrl string) string

Types

type Run

type Run struct {
	Testrun *v1beta1.Testrun
	Event   *github.GenericRequestEvent
}

func GetAllRunning

func GetAllRunning() []*Run

GetAllRunning returns all running tests

func GetRunning

func GetRunning(event *github.GenericRequestEvent) (*Run, bool)

GetRunning returns the currently running Testrun for a Event (org, repo, pr)

type Runs

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

func NewRuns

func NewRuns(w watch.Watch) *Runs

func (*Runs) Add

func (r *Runs) Add(event *github.GenericRequestEvent, tr *v1beta1.Testrun) error

func (*Runs) CreateTestrun

func (r *Runs) CreateTestrun(ctx context.Context, log logr.Logger, statusUpdater *StatusUpdater, event *github.GenericRequestEvent, tr *tmv1beta1.Testrun) error

func (*Runs) GetClient

func (r *Runs) GetClient() client.Client

GetClient returns the controller runtime kubernetes client

func (*Runs) GetRunning

func (r *Runs) GetRunning(event *github.GenericRequestEvent) (*Run, bool)

GetRunning returns the currently running Testrun for a Event (org, repo, pr)

func (*Runs) IsRunning

func (r *Runs) IsRunning(event *github.GenericRequestEvent) bool

IsRunning indicates if a test is running for a Event (org, repo, pr)

func (*Runs) Remove

func (r *Runs) Remove(event *github.GenericRequestEvent)

func (*Runs) Watch

func (r *Runs) Watch(log logr.Logger, ctx context.Context, statusUpdater *StatusUpdater, event *github.GenericRequestEvent, tr *tmv1beta1.Testrun, pollInterval, maxWaitTime time.Duration) (*tmv1beta1.Testrun, error)

type StatusUpdater

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

func NewStatusUpdater

func NewStatusUpdater(log logr.Logger, ghClient github.Client, event *github.GenericRequestEvent) *StatusUpdater

func NewStatusUpdaterFromCommentID

func NewStatusUpdaterFromCommentID(log logr.Logger, ghClient github.Client, event *github.GenericRequestEvent, commentID int64) *StatusUpdater

func (*StatusUpdater) GetCommentID

func (u *StatusUpdater) GetCommentID() int64

func (*StatusUpdater) Init

func (u *StatusUpdater) Init(ctx context.Context, tr *tmv1beta1.Testrun) error

func (*StatusUpdater) SetGitHubContext

func (u *StatusUpdater) SetGitHubContext(ctx string)

SetGitHubContext overwrites the default github context that is used as identifier in the github's status.

func (*StatusUpdater) Update

func (u *StatusUpdater) Update(ctx context.Context, tr *tmv1beta1.Testrun, dashboardUrl string) error

Update updates the comment and the github state of the current PR

func (*StatusUpdater) UpdateComment

func (u *StatusUpdater) UpdateComment(comment string) error

UpdateComment updates the current comment of the status updater

func (*StatusUpdater) UpdateStatus

func (u *StatusUpdater) UpdateStatus(ctx context.Context, state github.State, description string) error

UpdateStatus updates the GitHub status of the current PR

type TestConfig

type TestConfig struct {
	// FilePath is the path to the testrun file that is executed.
	FilePath string `json:"testrunPath"`
	// Template configures the test to template the given file before execution.
	Template bool `json:"template"`
	// SetValues are the additional values that are used to template a testrun.
	SetValues []string
}

SubTestConfig configures a specific test when called with the test command and the defined sub command

Jump to

Keyboard shortcuts

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