testwick

package
v0.0.0-...-6989af0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// MaxGeneratedNameLength is the max length of the generated name
	MaxGeneratedNameLength = maxNameLength - randomLength
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MattermostRequester

type MattermostRequester interface {
	GetPing() (string, *mmodel.Response)
	Logout() (bool, *mmodel.Response)
	CreateTeam(team *mmodel.Team) (*mmodel.Team, *mmodel.Response)
	AddTeamMember(teamID, userID string) (*mmodel.TeamMember, *mmodel.Response)
	CreatePost(post *mmodel.Post) (*mmodel.Post, *mmodel.Response)
	CreateUser(user *mmodel.User) (*mmodel.User, *mmodel.Response)
	CreateChannel(channel *mmodel.Channel) (*mmodel.Channel, *mmodel.Response)
	CreateIncomingWebhook(webhoo *mmodel.IncomingWebhook) (*mmodel.IncomingWebhook, *mmodel.Response)
	Login(username, password string) (*mmodel.User, *mmodel.Response)
}

MattermostRequester the interface which describes mattermost API client

type NameGenerator

type NameGenerator interface {
	// GenerateName generates a valid name from the base name, adding a random suffix to the
	// the base. If base is valid, the returned name must also be valid. The generator is
	// responsible for knowing the maximum valid name length.
	GenerateName(base string) string
}

NameGenerator generates3 names for objects. Some backends may have more information available to guide selection of new names and this interface hides those details.

var SimpleNameGenerator NameGenerator = simpleNameGenerator{}

SimpleNameGenerator is a generator that returns the name plus a random suffix of five alphanumerics when a name is requested. The string is guaranteed to not exceed the length of a standard Kubernetes name (63 characters)

type ProvisionerRequester

type ProvisionerRequester interface {
	CreateInstallation(request *cmodel.CreateInstallationRequest) (*cmodel.InstallationDTO, error)
	GetInstallation(id string, request *cmodel.GetInstallationRequest) (*cmodel.InstallationDTO, error)
	DeleteInstallation(id string) error
}

ProvisionerRequester the interface which describes Provisioner API client

type Step

type Step struct {
	Name string
	Func StepFunc
}

Step is a single step in a workflow.

type StepFunc

type StepFunc func(*TestWicker, context.Context) error

StepFunc the func to run for a step

type TestWicker

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

TestWicker data struct for test wicker scenarios

func NewTestWicker

func NewTestWicker(provisionerRequester ProvisionerRequester, requester MattermostRequester, logger logrus.FieldLogger) *TestWicker

NewTestWicker creates a testwicker

func (*TestWicker) AddTeamMember

func (w *TestWicker) AddTeamMember() func(w *TestWicker, ctx context.Context) error

AddTeamMember add the newly created user to a team in the installation

func (*TestWicker) CreateChannel

func (w *TestWicker) CreateChannel(retries int) func(w *TestWicker, ctx context.Context) error

CreateChannel creates a channel so we can post couple of messages

func (*TestWicker) CreateIncomingWebhook

func (w *TestWicker) CreateIncomingWebhook() func(w *TestWicker, ctx context.Context) error

CreateIncomingWebhook creates an incoming webhook

func (*TestWicker) CreateInstallation

func (w *TestWicker) CreateInstallation(request *cmodel.CreateInstallationRequest) func(w *TestWicker, ctx context.Context) error

CreateInstallation interacts with provisioner and uses the provided request to create a new installation

func (*TestWicker) CreateTeam

func (w *TestWicker) CreateTeam() func(w *TestWicker, ctx context.Context) error

CreateTeam creates a team in the installation

func (*TestWicker) DeleteInstallation

func (w *TestWicker) DeleteInstallation() func(w *TestWicker, ctx context.Context) error

DeleteInstallation interacts with provisioner and uses the provided request to delete an installation

func (*TestWicker) IsUP

func (w *TestWicker) IsUP() func(w *TestWicker, ctx context.Context) error

IsUP cpings the installation till return statusCode=200 and status=OK

func (*TestWicker) PostMessage

func (w *TestWicker) PostMessage(samples int, sleepDuration time.Duration) func(w *TestWicker, ctx context.Context) error

PostMessage post messages to the different channels which are created automatically by the wicker

func (*TestWicker) SetupInstallation

func (w *TestWicker) SetupInstallation() func(w *TestWicker, ctx context.Context) error

SetupInstallation creates a user and login with this one

func (*TestWicker) WaitForInstallationStable

func (w *TestWicker) WaitForInstallationStable() func(w *TestWicker, ctx context.Context) error

WaitForInstallationStable waits for installation to become stable

type Workflow

type Workflow struct {
	Steps []Step
	// contains filtered or unexported fields
}

Workflow is steps based workflow.

func NewWorkflow

func NewWorkflow(logger *logrus.Logger) *Workflow

NewWorkflow factory method

func (*Workflow) AddStep

func (w *Workflow) AddStep(step ...Step) *Workflow

AddStep add step to the Workflow.

func (*Workflow) Run

func (w *Workflow) Run(ctx context.Context, testWicker *TestWicker) error

Run will execute the set of commands of a recipe

Directories

Path Synopsis
Package mock_testwick is a generated GoMock package.
Package mock_testwick is a generated GoMock package.

Jump to

Keyboard shortcuts

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