gittest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gittest provides an in-memory git.Host for tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

type Host struct {
	User     string
	Password string
	OrgNames []string
	// Repos maps "org/name" to its state; a repository that is not listed is missing.
	Repos map[string]git.RepoState
	// URLs maps "org/name" to the clone URL; unlisted repositories get an unreachable https URL.
	URLs map[string]string

	// Releases are the release tags of the kubriX source repository, newest first; ReleasesErr makes listing fail.
	Releases    []string
	ReleasesErr error

	// PRErr makes OpenPullRequest fail.
	PRErr error

	Created []string
	Deleted []string
	PRs     []PullRequest
}

Host is a git.Host that keeps repositories in memory. Set URLs to point clone URLs at local bare repositories.

func New

func New(login string, orgs ...string) *Host

func (*Host) CloneURL

func (h *Host) CloneURL(org, name string) string

func (*Host) CreatePrivateRepo

func (h *Host) CreatePrivateRepo(_ context.Context, org, name string) error

func (*Host) DeleteRepo

func (h *Host) DeleteRepo(_ context.Context, org, name string) error

func (*Host) OpenPullRequest

func (h *Host) OpenPullRequest(_ context.Context, owner, repo, head, base, title, body string) (string, error)

func (*Host) Orgs

func (h *Host) Orgs(context.Context) ([]string, error)

func (*Host) ReleaseTags

func (h *Host) ReleaseTags(context.Context, string, string) ([]string, error)

ReleaseTags lists Releases, standing in for the kubriX source repository's tags.

func (*Host) RepoState

func (h *Host) RepoState(_ context.Context, org, name string) (git.RepoState, error)

func (*Host) Token

func (h *Host) Token() string

func (*Host) Validate

func (h *Host) Validate(context.Context) (string, error)

type PullRequest

type PullRequest struct {
	Owner, Repo, Head, Base, Title, Body string
}

PullRequest is one call to OpenPullRequest.

Jump to

Keyboard shortcuts

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