ghfake

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 6 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 ghfake is an in-memory implementation of the ghclient store interfaces for controller tests: deterministic, mutation-recording, and just faithful enough (label filters, search-by-label queries) to exercise the controllers' GitHub interactions without a server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	Mu sync.Mutex
	// Issues by number.
	Issues map[int]*ghclient.Issue
	// Comments by issue number, in posting order.
	Comments map[int][]string
	// Closed issue numbers, in closing order.
	Closed []int
	// Assigned logins by issue number.
	Assigned map[int][]string
	// Now stamps CreatedAt on created issues.
	Now func() time.Time
	// contains filtered or unexported fields
}

Store is the in-memory fake. Fields are exported for test assertions; take Mu when reading them from concurrent tests.

func New

func New() *Store

New builds an empty Store; issue numbers start at 101.

func (*Store) AddLabels

func (s *Store) AddLabels(_ context.Context, _ ghclient.Repo, number int, add []string) error

AddLabels implements ghclient.IssueStore.

func (*Store) Assign

func (s *Store) Assign(_ context.Context, _ ghclient.Repo, number int, logins []string) error

Assign implements ghclient.IssueStore.

func (*Store) Close

func (s *Store) Close(_ context.Context, _ ghclient.Repo, number int) error

Close implements ghclient.IssueStore.

func (*Store) Comment

func (s *Store) Comment(_ context.Context, _ ghclient.Repo, number int, body string) error

Comment implements ghclient.IssueStore.

func (*Store) Create

func (s *Store) Create(_ context.Context, repo ghclient.Repo, req ghclient.IssueRequest) (*ghclient.Issue, error)

Create implements ghclient.IssueStore.

func (*Store) EditBody

func (s *Store) EditBody(_ context.Context, _ ghclient.Repo, number int, body string) error

EditBody implements ghclient.IssueStore.

func (*Store) ListComments

func (s *Store) ListComments(_ context.Context, _ ghclient.Repo, number int) ([]*ghclient.Comment, error)

ListComments implements ghclient.IssueStore.

func (*Store) ListOpen

func (s *Store) ListOpen(_ context.Context, repo ghclient.Repo, labels []string) ([]*ghclient.Issue, error)

ListOpen implements ghclient.IssueStore.

func (*Store) RemoveLabel

func (s *Store) RemoveLabel(_ context.Context, _ ghclient.Repo, number int, name string) error

RemoveLabel implements ghclient.IssueStore; removing an absent label is not an error, matching the real client.

func (*Store) SearchIssues

func (s *Store) SearchIssues(_ context.Context, query string) ([]*ghclient.Issue, error)

SearchIssues supports the controllers' reconcile queries: every label:"..." qualifier must match; is:open is honored; everything else in the query is ignored.

Jump to

Keyboard shortcuts

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