Documentation ¶
Index ¶
- Constants
- func NewAuth(server *httptest.Server) voucher.Auth
- func NewBadTestReference(t *testing.T) reference.Canonical
- func NewRateLimitedTestReference(t *testing.T) reference.Canonical
- func NewScanner(t *testing.T, vulnerabilities ...voucher.Vulnerability) voucher.VulnerabilityScanner
- func NewTestClairServer(t *testing.T, vulns map[string][]v1.Vulnerability) *httptest.Server
- func NewTestDockerServer(t *testing.T) *httptest.Server
- func NewTestImageConfig() interface{}
- func NewTestManifest() schema2.Manifest
- func NewTestReference(t *testing.T) reference.Canonical
- func UpdateClient(client *http.Client, server *httptest.Server) error
- type Transport
Constants ¶
const RateLimitOutput = "<html><body>Rate Limited</body></html>"
RateLimitOutput is the data that is returned when we similuate a Docker registry call that has been rate limited.
Variables ¶
This section is empty.
Functions ¶
func NewBadTestReference ¶
NewBadTestReference creates a new reference to be used throughout the docker tests. The returned reference is assumed to not, and does not have valid configuration or layers.
func NewRateLimitedTestReference ¶ added in v1.2.1
NewRateLimitedTestReference creates a new reference to be used to test the handling of Rate Limited docker calls. The returned response from calling this reference cannot be parsed by a JSON decoder and should result in an error.
func NewScanner ¶
func NewScanner(t *testing.T, vulnerabilities ...voucher.Vulnerability) voucher.VulnerabilityScanner
NewScanner creates a new Scanner suitable for testing with. The scanner will return all of the vulnerabilities that were passed in, regardless of what FailOn is set to. If the scanner is created with 0 vulnerabilities, Checks that use it will always pass.
func NewTestClairServer ¶ added in v1.1.1
NewTestClairServer creates a mock of Clair with a list of pre-defined clair vulnerabilities
func NewTestDockerServer ¶
NewTestDockerServer creates a new mock of the Docker registry
func NewTestImageConfig ¶
func NewTestImageConfig() interface{}
NewTestImageConfig creates a test image Config for our mock Docker API.
func NewTestManifest ¶
NewTestManifest creates a test manifest for our mock Docker API.
func NewTestReference ¶
NewTestReference creates a new reference to be used throughout the docker tests. The returned reference is assumed to exist, and is assumed to have valid configuration and layers.
func UpdateClient ¶
UpdateClient updates the passed http.Client's Transport to support the passed httptest.Server's server certificate, and to set a new Transport which will override the request's hostname with the testing server's hostname.
Types ¶
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport wraps the http.Transport, but overwrites the URL of all requests to point to the same path on the passed hostname. This is to enable us to test connections to httptest.Server without changing the client code to allow us to add ports to registry URLs (illegal in the reference.Reference types in the docker registry library).
func NewTransport ¶
NewTransport creates a new Transport which wraps the http.Transport. The purpose of this is to allow us to rewrite URLs to connect to our test server.