Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArtifactoryMockServer ¶ added in v1.205.1
type ArtifactoryMockServer struct {
Server *httptest.Server
// contains filtered or unexported fields
}
ArtifactoryMockServer provides a mock HTTP server that implements enough of the JFrog Artifactory Generic repository API to test the Atmos Artifactory store integration.
func NewArtifactoryMockServer ¶ added in v1.205.1
func NewArtifactoryMockServer(t *testing.T) *ArtifactoryMockServer
NewArtifactoryMockServer creates a mock Artifactory server. The server is automatically cleaned up when the test completes.
func (*ArtifactoryMockServer) Clear ¶ added in v1.205.1
func (m *ArtifactoryMockServer) Clear()
Clear removes all files from the mock store.
func (*ArtifactoryMockServer) GetFile ¶ added in v1.205.1
func (m *ArtifactoryMockServer) GetFile(path string) ([]byte, bool)
GetFile retrieves a file from the mock store (useful for test assertions).
func (*ArtifactoryMockServer) ListFiles ¶ added in v1.205.1
func (m *ArtifactoryMockServer) ListFiles() map[string][]byte
ListFiles returns all files currently stored in the mock.
func (*ArtifactoryMockServer) SetFile ¶ added in v1.205.1
func (m *ArtifactoryMockServer) SetFile(path string, content []byte)
SetFile directly sets a file in the mock store (useful for test setup).
func (*ArtifactoryMockServer) URL ¶ added in v1.205.1
func (m *ArtifactoryMockServer) URL() string
URL returns the mock server URL.
type GitHubMockServer ¶
GitHubMockServer intercepts GitHub requests and serves mock content. It provides a mock HTTP server that can be used to replace real GitHub raw content requests in tests, avoiding network dependencies and rate limits.
func NewGitHubMockServer ¶
func NewGitHubMockServer(t *testing.T) *GitHubMockServer
NewGitHubMockServer creates a mock server that intercepts GitHub requests. The server is automatically cleaned up when the test completes.
func (*GitHubMockServer) HTTPClient ¶
func (m *GitHubMockServer) HTTPClient() *http.Client
HTTPClient returns an http.Client that intercepts GitHub URLs. Use this with go-getter's HttpGetter or any HTTP client that needs to have GitHub requests redirected to the mock server.
func (*GitHubMockServer) HttpGetter ¶
func (m *GitHubMockServer) HttpGetter() *getter.HttpGetter
HttpGetter returns a go-getter HttpGetter configured to use the mock. Use this when you need to inject a custom getter into go-getter's client.
func (*GitHubMockServer) RegisterFile ¶
func (m *GitHubMockServer) RegisterFile(pathSuffix, content string)
RegisterFile registers content to be served for a given path suffix. The path suffix is matched against the end of incoming request paths. For example, RegisterFile("stacks/deploy/nonprod.yaml", content) will match requests to /cloudposse/atmos/main/tests/fixtures/scenarios/stack-templates-2/stacks/deploy/nonprod.yaml.
func (*GitHubMockServer) Transport ¶
func (m *GitHubMockServer) Transport() http.RoundTripper
Transport returns an http.RoundTripper that intercepts GitHub URLs. Can be used to replace http.DefaultTransport in tests to intercept all HTTP requests to GitHub without modifying the code under test.
func (*GitHubMockServer) URL ¶
func (m *GitHubMockServer) URL() string
URL returns the mock server URL.