github

package
v0.51.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ControllerConfigMapName added in v0.51.0

func ControllerConfigMapName(onGHE bool) string

ControllerConfigMapName returns the ConfigMap the controller under test reads its settings from.

The GHE tests talk to the second controller, which hack/second-controller.py deploys with a ConfigMap of its own, so a test tuning a controller wide setting has to target that one: patching the default ConfigMap would tune the controller the test is not talking to.

func CreateCRD

func CreateCRD(ctx context.Context, t *testing.T, repoinfo *github.Repository, run *params.Run, opts options.E2E, provider *ghprovider.Provider, targetNS string) error

func CreateCRDIncoming added in v0.17.0

func CreateCRDIncoming(ctx context.Context, t *testing.T, repoinfo *github.Repository, run *params.Run, incomings *[]v1alpha1.Incoming, opts options.E2E, provider *ghprovider.Provider, targetNS string) error

func CreateGHERepo added in v0.43.0

func CreateGHERepo(ctx context.Context, client *github.Client, org, name, hookURL, webhookSecret string, logger *zap.SugaredLogger) (*github.Repository, error)

CreateGHERepo creates a new GitHub repository inside an organization and adds a webhook pointing to the given hookURL (for example, a smee channel URL used to forward events to the controller). The repository is initialized with a README on the "main" branch.

func CreateTag added in v0.38.0

func CreateTag(ctx context.Context, t *testing.T, runcnx *params.Run, ghcnx *pacgithub.Provider, opts options.E2E, sha, tagName string) (*github.Tag, error)

func DeleteGHERepo added in v0.43.0

func DeleteGHERepo(ctx context.Context, client *github.Client, org, name string, logger *zap.SugaredLogger) error

func DeleteTag added in v0.39.0

func DeleteTag(ctx context.Context, ghcnx *pacgithub.Provider, opts options.E2E, tagName string) error

func PRCreate

func PRCreate(ctx context.Context, cs *params.Run, ghcnx *ghprovider.Provider, owner, repo, targetRef, defaultBranch, title string) (int, error)

func PushFilesToRef

func PushFilesToRef(ctx context.Context, client *github.Client, commitMessage, baseBranch, targetRef, owner, repo string, files map[string]string) (string, *github.Reference, error)

func Setup

func Setup(ctx context.Context, onGHE, viaDirectWebhook bool) (context.Context, *params.Run, options.E2E, *github.Provider, error)

func UpdateFilesInRef added in v0.42.0

func UpdateFilesInRef(ctx context.Context, client *github.Client, owner, repo, branch, commitMessage string, files map[string]string) (string, error)

Types

type InstrumentationAPICall added in v0.37.0

type InstrumentationAPICall struct {
	Operation          string `json:"operation"`
	DurationMs         int64  `json:"duration_ms"`
	URLPath            string `json:"url_path"`
	RateLimitRemaining string `json:"rate_limit_remaining"`
	StatusCode         int    `json:"status_code"`
	Provider           string `json:"provider"`
	Repo               string `json:"repo"`
}

InstrumentationAPICall represents a single GitHub API call with its metadata.

type PRTest added in v0.25.0

type PRTest struct {
	Label         string
	YamlFiles     []string
	GHE           bool
	Webhook       bool
	NoStatusCheck bool

	Cnx             *params.Run
	Options         options.E2E
	Provider        *ghprovider.Provider
	TargetNamespace string
	TargetRefName   string
	PRNumber        int
	SHA             string
	Logger          *zap.SugaredLogger
	CommitTitle     string
	DynamicRepoName string
}

func (*PRTest) RunPullRequest added in v0.25.0

func (g *PRTest) RunPullRequest(ctx context.Context, t *testing.T)

func (*PRTest) RunPushRequest added in v0.25.0

func (g *PRTest) RunPushRequest(ctx context.Context, t *testing.T)

func (*PRTest) TearDown added in v0.25.0

func (g *PRTest) TearDown(ctx context.Context, t *testing.T)

type TestResult added in v0.37.0

type TestResult struct {
	TestName         string                   `json:"test_name"`
	Timestamp        string                   `json:"timestamp"`
	Controller       string                   `json:"controller"`
	PRNumber         int                      `json:"pr_number"`
	SHA              string                   `json:"sha"`
	TargetNamespace  string                   `json:"target_namespace"`
	GitHubAPICalls   []InstrumentationAPICall `json:"github_api_calls"`
	TotalCalls       int                      `json:"total_calls"`
	OAuth2MarkerLine int                      `json:"oauth2_marker_line"`
}

TestResult represents the complete test result with GitHub API calls.

Jump to

Keyboard shortcuts

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