Documentation
¶
Overview ¶
Package ghfake implements a fake GitHub REST API server for local e2e testing.
The server implements the subset of the GitHub API that ephemerd's pkg/github.Client uses: PollJobs, RegisterJITRunner, RemoveRunner, and FetchJobImage. It runs as an httptest.Server and returns a configured github.Client pointing at it.
Usage:
srv := ghfake.New("myorg")
defer srv.Close()
srv.QueueJob("myrepo", []string{"self-hosted", "linux", "x64"})
client := srv.Client()
events, _ := client.PollJobs(ctx) // returns the queued job
jit, _ := client.RegisterJITRunner(ctx, "myrepo", "runner-1", labels)
// ... runner runs and exits ...
client.RemoveRunner(ctx, "myrepo", jit.GetRunner().GetID())
// srv.Removed(runnerID) == true
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
Server is a fake GitHub REST API backed by httptest.Server.
func (*Server) Client ¶
Client returns an ephemerd github.Client configured to talk to this fake server.
Click to show internal directories.
Click to hide internal directories.