Documentation
¶
Index ¶
- type MockHTTPServer
- func (ms *MockHTTPServer) AddFile(path, content string) string
- func (ms *MockHTTPServer) AddFileWithHeaders(path, content string, headers map[string]string) string
- func (ms *MockHTTPServer) Close()
- func (ms *MockHTTPServer) HasRequest(pattern string) bool
- func (ms *MockHTTPServer) Requests() []string
- func (ms *MockHTTPServer) ResetRequests()
- func (ms *MockHTTPServer) URL() string
- type MockRegistry
- func (mr *MockRegistry) AddEmptyImage(repo, tag string) (string, error)
- func (mr *MockRegistry) AddImage(repo, tag string, imageID int64) (string, error)
- func (mr *MockRegistry) AddImageWithConfig(repo, tag string, config v1.Config) (string, error)
- func (mr *MockRegistry) Close()
- func (mr *MockRegistry) HasRequest(pattern string) bool
- func (mr *MockRegistry) Host() string
- func (mr *MockRegistry) RequestCount(pattern string) int
- func (mr *MockRegistry) Requests() []string
- func (mr *MockRegistry) ResetRequests()
- func (mr *MockRegistry) WriteRegistriesConf(dir string, registries ...string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockHTTPServer ¶
MockHTTPServer is a test HTTP server that serves files with deterministic content
func NewMockHTTPServer ¶
func NewMockHTTPServer() *MockHTTPServer
NewMockHTTPServer creates a new mock HTTP server
func (*MockHTTPServer) AddFile ¶
func (ms *MockHTTPServer) AddFile(path, content string) string
AddFile adds a file with deterministic content to the mock server Returns the sha256 checksum of the content
func (*MockHTTPServer) AddFileWithHeaders ¶
func (ms *MockHTTPServer) AddFileWithHeaders(path, content string, headers map[string]string) string
AddFileWithHeaders adds a file with deterministic content and custom HTTP headers Returns the sha256 checksum of the content
func (*MockHTTPServer) Close ¶
func (ms *MockHTTPServer) Close()
Close shuts down the mock HTTP server
func (*MockHTTPServer) HasRequest ¶
func (ms *MockHTTPServer) HasRequest(pattern string) bool
HasRequest checks if a request matching the pattern was made
func (*MockHTTPServer) Requests ¶
func (ms *MockHTTPServer) Requests() []string
Requests returns all requests made to the server since last reset
func (*MockHTTPServer) ResetRequests ¶
func (ms *MockHTTPServer) ResetRequests()
ResetRequests clears the tracked requests
func (*MockHTTPServer) URL ¶
func (ms *MockHTTPServer) URL() string
URL returns the base URL of the mock HTTP server
type MockRegistry ¶
MockRegistry is a test registry server that serves images with deterministic digests
func NewMockRegistry ¶
func NewMockRegistry() *MockRegistry
NewMockRegistry creates a new mock registry server
func (*MockRegistry) AddEmptyImage ¶
func (mr *MockRegistry) AddEmptyImage(repo, tag string) (string, error)
AddEmptyImage adds an empty (scratch-based) image to the mock registry
func (*MockRegistry) AddImage ¶
func (mr *MockRegistry) AddImage(repo, tag string, imageID int64) (string, error)
AddImage adds an image to the mock registry with a deterministic digest The imageID is used to generate unique but deterministic content
func (*MockRegistry) AddImageWithConfig ¶
AddImageWithConfig adds an image with specific config to make digests deterministic
func (*MockRegistry) Close ¶
func (mr *MockRegistry) Close()
Close shuts down the mock registry server
func (*MockRegistry) HasRequest ¶
func (mr *MockRegistry) HasRequest(pattern string) bool
HasRequest checks if a request matching the pattern was made Pattern can be a substring match (e.g., "GET /v2/library/alpine/manifests")
func (*MockRegistry) Host ¶
func (mr *MockRegistry) Host() string
Host returns the host:port of the mock registry
func (*MockRegistry) RequestCount ¶
func (mr *MockRegistry) RequestCount(pattern string) int
RequestCount returns the number of requests matching the pattern
func (*MockRegistry) Requests ¶
func (mr *MockRegistry) Requests() []string
Requests returns all requests made to the registry since last reset
func (*MockRegistry) ResetRequests ¶
func (mr *MockRegistry) ResetRequests()
ResetRequests clears the tracked requests
func (*MockRegistry) WriteRegistriesConf ¶
func (mr *MockRegistry) WriteRegistriesConf(dir string, registries ...string) (string, error)
WriteRegistriesConf creates a registries.conf file that redirects the specified registries to the mock registry server. Returns the path to the created file.