Documentation
¶
Overview ¶
It is not a faithful simulator: only the endpoints gitea-mq calls are implemented, with just enough state to drive the adapter and integration tests deterministically without network access.
Index ¶
- type CheckRun
- type HookConfig
- type Installation
- type PR
- type Repo
- type Ruleset
- type RulesetRule
- type Server
- func (s *Server) AddInstallation(id int64, fullNames ...string) *Installation
- func (s *Server) AddPR(owner, name string, pr PR) *PR
- func (s *Server) AddRepo(owner, name string) *Repo
- func (s *Server) Client() *gh.Client
- func (s *Server) HookConfig() HookConfig
- func (s *Server) Repo(owner, name string) *Repo
- type Stack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HookConfig ¶
type HookConfig struct {
URL string `json:"url,omitempty"`
Secret string `json:"secret,omitempty"`
ContentType string `json:"content_type,omitempty"`
}
HookConfig mirrors the App-level webhook config (PATCH /app/hook/config).
type Installation ¶
type Repo ¶
type Repo struct {
Owner, Name string
DefaultBranch string
PRs map[int64]*PR
Refs map[string]string // branch -> sha
// Parents[sha] lists a commit's parent SHAs. hMerge records the merge
// commit's parents here so hUpdateRef can do a real ancestry walk for
// its fast-forward check.
Parents map[string][]string
CheckRuns map[string][]*CheckRun
Rulesets []*Ruleset
// BehindBy["base...head"] feeds GET /compare/{base}...{head}.behind_by.
// Missing entries default to 0 (head up to date with base).
BehindBy map[string]int
// ConflictOn[head] makes POST /merges with that head return 409.
ConflictOn map[string]bool
// Settings tracks PATCH /repos/{o}/{r} keys.
Settings map[string]any
// ProtectedRefs[branch]=true makes a non-force PATCH on that ref return
// 403, simulating a ruleset/branch-protection rejection.
ProtectedRefs map[string]bool
// RequiredChecks[branch] feeds /rules/branches/{b} as a synthetic
// required_status_checks rule, decoupled from Rulesets so tests can
// stub rule evaluation directly.
RequiredChecks map[string][]string
// ProtectionChecks[branch] feeds classic branch protection; absent
// branches answer 404 like unprotected ones.
ProtectionChecks map[string][]string
// Stacks feeds GET /stacks; nil answers 404 (feature disabled).
Stacks []Stack
// AsyncMerges records PUT /pulls/{n}/merge-async calls.
AsyncMerges []int64
// AsyncMergeStatus is the reported status (default "pending").
AsyncMergeStatus string
// AsyncMergeConflict makes merge-async return 409.
AsyncMergeConflict bool
}
type Ruleset ¶
type Ruleset struct {
ID int64 `json:"id"`
Name string `json:"name"`
Target string `json:"target"`
Enforcement string `json:"enforcement"`
Conditions json.RawMessage `json:"conditions,omitempty"`
Rules []RulesetRule `json:"rules"`
}
type RulesetRule ¶
type RulesetRule struct {
Type string `json:"type"`
Parameters json.RawMessage `json:"parameters,omitempty"`
}
type Server ¶
func (*Server) AddInstallation ¶
func (s *Server) AddInstallation(id int64, fullNames ...string) *Installation
func (*Server) HookConfig ¶
func (s *Server) HookConfig() HookConfig
Click to show internal directories.
Click to hide internal directories.