Documentation ¶
Index ¶
- Constants
- func NewAuth(server *httptest.Server) voucher.Auth
- func NewBadTestReference(t *testing.T) reference.Canonical
- func NewNobodyBadTestReference(t *testing.T) reference.Canonical
- func NewPGPSigner(t *testing.T) signer.AttestationSigner
- func NewPrivateKey() libtrust.PrivateKey
- 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 NewTestManifest() *schema2.DeserializedManifest
- func NewTestNobodyImageConfig() interface{}
- func NewTestReference(t *testing.T) reference.Canonical
- func NewTestRootImageConfig() interface{}
- func NewTestRootManifest() *schema2.DeserializedManifest
- func NewTestSchema1Manifest() schema1.Manifest
- func NewTestSchema1Reference(t *testing.T) reference.Canonical
- func NewTestSchema1SignedManifest(pk libtrust.PrivateKey) *schema1.SignedManifest
- func NewTestSchema1SignedReference(t *testing.T) reference.Canonical
- func PrepareDockerTest(t *testing.T, ref reference.Named) (*http.Client, *httptest.Server)
- 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 NewNobodyBadTestReference ¶
NewNobodyBadTestReference creates a new reference to be used for the nobody check. The returned reference is assumed to not, and does not have valid configuration or layers.
func NewPGPSigner ¶
func NewPGPSigner(t *testing.T) signer.AttestationSigner
NewPGPSigner creates a new signer using the test key in the testdata directory.
func NewPrivateKey ¶
func NewPrivateKey() libtrust.PrivateKey
NewPrivateKey creates a private key that can be used to sign Docker manifests.
func NewRateLimitedTestReference ¶
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 ¶
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 NewTestManifest ¶
func NewTestManifest() *schema2.DeserializedManifest
NewTestManifest creates a test schema2 manifest for our mock Docker API.
func NewTestNobodyImageConfig ¶
func NewTestNobodyImageConfig() interface{}
NewTestNobodyImageConfig creates a test Image Config with user as nobodoy 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 NewTestRootImageConfig ¶
func NewTestRootImageConfig() interface{}
NewTestRootImageConfig creates a test Image Config with user as root for our mock Docker API.
func NewTestRootManifest ¶
func NewTestRootManifest() *schema2.DeserializedManifest
NewTestRootManifest creates a test schema2 manifest for our mock Docker API, which points to an image whose user is configured to be root
func NewTestSchema1Manifest ¶
NewTestSchema1Manifest creates a test schema1 manifest for our mock Docker API.
func NewTestSchema1Reference ¶
NewTestSchema1Reference creates a new schema version 1 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 NewTestSchema1SignedManifest ¶
func NewTestSchema1SignedManifest(pk libtrust.PrivateKey) *schema1.SignedManifest
NewTestSchema1SignedManifest creates a test schema1 manifest, and signs it with the passed private key, for use with our mock Docker API.
func NewTestSchema1SignedReference ¶
NewTestSchema1SignedReference creates a new schema version 1 reference to be used throughout the docker tests. The returned reference is assumed to exist, be signed, and to have valid configuration and layers.
func PrepareDockerTest ¶
PrepareDockerTest creates a new http.Client and httptest.Server for testing with. The new client is created using the voucher tests specific Auth.
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.