e2e

package
v0.0.717 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2020 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCollaborator

func AddCollaborator(approver string, repo *scm.Repository, botClient *scm.Client, approverClient *scm.Client) error

AddCollaborator adds the approver user to the repo

func AddHoldLabelToPullRequestWithChatOpsCommand

func AddHoldLabelToPullRequestWithChatOpsCommand(lhClient scmprovider.SCMClient, pr *scm.PullRequest) error

AddHoldLabelToPullRequestWithChatOpsCommand returns an error of the command fails to add the do-not-merge/hold label

func AddReviewerToPullRequestWithChatOpsCommand

func AddReviewerToPullRequestWithChatOpsCommand(lhClient scmprovider.SCMClient, pr *scm.PullRequest, reviewer string) error

AddReviewerToPullRequestWithChatOpsCommand returns an error of the command fails to add the reviewer to either the reviewers list or the assignees list

func AddWIPLabelToPullRequestByUpdatingTitle

func AddWIPLabelToPullRequestByUpdatingTitle(lhClient scmprovider.SCMClient, scmClient *scm.Client, pr *scm.PullRequest) error

AddWIPLabelToPullRequestByUpdatingTitle adds the WIP label by adding WIP to a pull request's title

func ApplyConfigAndPluginsConfigMaps

func ApplyConfigAndPluginsConfigMaps(cfg *config.Config, pluginsCfg *plugins.Configuration) error

ApplyConfigAndPluginsConfigMaps takes the config and plugins and creates/applies the config maps in the cluster using kubectl

func ApprovePullRequest

func ApprovePullRequest(lhClient scmprovider.SCMClient, approverclient scmprovider.SCMClient, pr *scm.PullRequest) error

ApprovePullRequest attempts to /approve a PR with the given approver git provider, then verify the label is there with the default provider

func AttemptToLGTMOwnPullRequest

func AttemptToLGTMOwnPullRequest(lhClient scmprovider.SCMClient, pr *scm.PullRequest) error

AttemptToLGTMOwnPullRequest return an error if the /lgtm fails to add the lgtm label to PR

func CreateBaseRepository

func CreateBaseRepository(botUser, approver string, botClient *scm.Client, gitClient git.Client) (*scm.Repository, *git.Repo, error)

CreateBaseRepository creates the repository that will be used for tests

func CreateGitClient

func CreateGitClient(gitServerURL string, userFunc func() string, tokenFunc func() (string, error)) (git.Client, error)

CreateGitClient creates the git client used for cloning and making changes to the test repository

func CreateHMACToken

func CreateHMACToken() (string, error)

CreateHMACToken creates an HMAC token for use in webhooks, defaulting to the E2E_HMAC_TOKEN env var if set

func CreateSCMClient

func CreateSCMClient(userFunc func() string, tokenFunc func() (string, error)) (*scm.Client, scmprovider.SCMClient, string, error)

CreateSCMClient takes functions that return the username and token to use, and creates the scm.Client and Lighthouse SCM client

func CreateWebHook

func CreateWebHook(scmClient *scm.Client, repo *scm.Repository, hmacToken string) error

CreateWebHook creates a webhook on the SCM provider for the repository

func ExpectCommandExecution

func ExpectCommandExecution(dir string, commandTimeout time.Duration, exitCode int, c string, args ...string)

ExpectCommandExecution performs the given command in the current work directory and asserts that it completes successfully

func ExpectThatPullRequestDoesNotHaveLabel

func ExpectThatPullRequestDoesNotHaveLabel(lhClient scmprovider.SCMClient, pullRequestNumber int, owner, repo, label string) error

ExpectThatPullRequestDoesNotHaveLabel returns an error if the PR does have the specified label

func ExpectThatPullRequestHasCommentMatching

func ExpectThatPullRequestHasCommentMatching(lhClient scmprovider.SCMClient, pr *scm.PullRequest, matchFunc func(comments []*scm.Comment) error) error

ExpectThatPullRequestHasCommentMatching returns an error if the PR does not have a comment matching the provided function

func ExpectThatPullRequestHasLabel

func ExpectThatPullRequestHasLabel(lhClient scmprovider.SCMClient, pullRequestNumber int, owner, repo, label string) error

ExpectThatPullRequestHasLabel returns an error if the PR does not have the specified label

func ExpectThatPullRequestMatches

func ExpectThatPullRequestMatches(lhClient scmprovider.SCMClient, pullRequestNumber int, owner, repo string, matchFunc func(request *scm.PullRequest) error) error

ExpectThatPullRequestMatches returns an error if the PR does not satisfy the provided funciton

func GetApproverName

func GetApproverName() string

GetApproverName gets the approver user's username

func GetApproverSCMToken

func GetApproverSCMToken() (string, error)

GetApproverSCMToken gets the token used by the approver

func GetBotName

func GetBotName() string

GetBotName gets the bot user name

func GetPrimarySCMToken

func GetPrimarySCMToken() (string, error)

GetPrimarySCMToken gets the token used by the bot/primary user

func GitKind

func GitKind() string

GitKind returns the git provider flavor being used

func ProcessConfigAndPlugins

func ProcessConfigAndPlugins(owner, repo, namespace, agent string) (*config.Config, *plugins.Configuration, error)

ProcessConfigAndPlugins reads the templates for the config and plugins config maps and replaces the owner, repo, and namespace in them

func RunWithReporters

func RunWithReporters(t *testing.T, suiteID string)

RunWithReporters runs a suite with better logging and gathering of test results

func WaitForPullRequestCommitStatus

func WaitForPullRequestCommitStatus(lhClient scmprovider.SCMClient, pr *scm.PullRequest, contexts []string, desiredStatuses ...string)

WaitForPullRequestCommitStatus checks a pull request until either it reaches a given status in all the contexts supplied or a timeout is reached.

func WaitForPullRequestToMerge

func WaitForPullRequestToMerge(lhClient scmprovider.SCMClient, pr *scm.PullRequest)

WaitForPullRequestToMerge checks the PR's status until it's merged or timed out.

Types

This section is empty.

Jump to

Keyboard shortcuts

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