test

package
v0.0.0-...-966d904 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Registry = "registry.datica.com"
	Image    = "hello-world"
	Tag      = "latest"
)

Testing constants

View Source
const (
	InvalidImageName             = "Invalid image name"
	IncorrectNamespace           = "Incorrect namespace for your environment"
	IncorrectRegistryOrNamespace = "Incorrect registry or namespace for your environment"
	MissingTrustData             = "does not have trust data for"
	ImageDoesNotExist            = "No such image"
)

Errors for image handling

View Source
const (
	Alias     = "1"
	EnvID     = "env1"
	EnvName   = "cli-tests1"
	Namespace = "namespace1"
	OrgID     = "org1"
	Pod       = "pod1"
	SvcID     = "svc1"
	SvcLabel  = "code1"
	JobID     = "00000000-0000-0000-0000-aaaaaaaaaaaa"
	Target    = "target1"

	AliasAlt     = "2"
	EnvIDAlt     = "env2"
	EnvNameAlt   = "cli-tests2"
	NamespaceAlt = "namespace2"
	OrgIDAlt     = "org2"
	PodAlt       = "pod2"
	SvcIDAlt     = "svc2"
	SvcLabelAlt  = "code2"
	JobIDAlt     = "abcdefgh"
	TargetAlt    = "target2"

	DownStream = "service_proxy"
	GoodDate   = "2017-09-24T17:23:04.999999999Z07:00"
	BadDate    = "2017-09-22T17:23:04.999999999Z07:00"
)
View Source
const (
	DefaultTag = "latest"
)

Constants for image handling

Variables

This section is empty.

Functions

func AddNotary

func AddNotary(pod, notary string)

AddNotary adds a notary server to the map

func AddRegistry

func AddRegistry(pod, registry string)

AddRegistry adds a registry to the map

func AssertEquals

func AssertEquals(t *testing.T, expected, actual string)

func DeleteLocalRepo

func DeleteLocalRepo(namespace, image, registry, notaryServer string) error

DeleteLocalRepo deletes the local trust repo created in testing

func GetSettings

func GetSettings(baseURL string) *models.Settings

func SetLocalImages

func SetLocalImages(images []string)

SetLocalImages sets the mock list of local images

func SetRemoteImages

func SetRemoteImages(images []string)

SetRemoteImages sets the mock list of remote images

func Setup

func Setup() (*http.ServeMux, *httptest.Server, *url.URL)

func Teardown

func Teardown(server *httptest.Server)

Types

type FakeImages

type FakeImages struct {
	Settings *models.Settings
}

FakeImages is a mock images struct

func (*FakeImages) AddTargetHash

func (d *FakeImages) AddTargetHash(repo notaryClient.Repository, digest *models.ContentDigest, tag string, publish bool) error

AddTargetHash adds the given content hash to a notary repo and sends a signing request to the server

func (*FakeImages) CheckChangelist

func (d *FakeImages) CheckChangelist(repo notaryClient.Repository, ip prompts.IPrompts) error

CheckChangelist prompts the user if they have unpublished changes to let them clear

undesired changes before publishing, or verify that the changes should be published

func (*FakeImages) DeleteTag

func (d *FakeImages) DeleteTag(imageName, tagName string) error

DeleteTag stub to make golinter happy

func (*FakeImages) DeleteTargets

func (d *FakeImages) DeleteTargets(repo notaryClient.Repository, tags []string, publish bool) error

DeleteTargets deletes the signed targets for a list of tags

func (*FakeImages) GetGloballyUniqueNamespace

func (d *FakeImages) GetGloballyUniqueNamespace(name string, env *models.Environment, includeRegistry bool) (string, string, error)

GetGloballyUniqueNamespace returns the fully formatted name for an image <registry>/<namespace>/<image> and a tag if present

func (*FakeImages) GetNotaryRepository

func (d *FakeImages) GetNotaryRepository(pod, imageName string, user *models.User) notaryClient.Repository

GetNotaryRepository returns a pointer to the notary repository for an image

func (*FakeImages) InitNotaryRepo

func (d *FakeImages) InitNotaryRepo(repo notaryClient.Repository, rootKeyPath string) error

InitNotaryRepo intializes a notary repository

func (*FakeImages) ListImages

func (d *FakeImages) ListImages() (*[]string, error)

ListImages stub to make golinter happy

func (*FakeImages) ListTags

func (d *FakeImages) ListTags(imageName string) (*[]string, error)

ListTags stub to make golinter happy

func (*FakeImages) ListTargets

func (d *FakeImages) ListTargets(repo notaryClient.Repository, roles ...string) ([]*images.Target, error)

ListTargets intializes a notary repository

func (*FakeImages) LookupTarget

func (d *FakeImages) LookupTarget(repo notaryClient.Repository, tag string) (*images.Target, error)

LookupTarget searches for a specific target in a repository by tag name

func (*FakeImages) PrintChangelist

func (d *FakeImages) PrintChangelist(changes []changelist.Change)

PrintChangelist prints out the users unpublished changes in a formatted table

func (*FakeImages) Publish

func (d *FakeImages) Publish(repo notaryClient.Repository) error

Publish pretends to publish changes. But actually just clear the changes

func (*FakeImages) Pull

func (d *FakeImages) Pull(name string, target *images.Target, user *models.User, env *models.Environment) error

Pull parses a name into registry/namespace/image:tag and attempts to retrieve it from the remote registry

func (*FakeImages) Push

func (d *FakeImages) Push(name string, user *models.User, env *models.Environment, ip prompts.IPrompts) (*models.Image, error)

Push parses a given name into registry/namespace/image:tag and attempts to push it to the remote registry

type FakePrompts

type FakePrompts struct{}

func (*FakePrompts) CaptureInput

func (f *FakePrompts) CaptureInput(msg string) string

func (*FakePrompts) EmailPassword

func (f *FakePrompts) EmailPassword(e, p string) (string, string, error)

func (*FakePrompts) GenericPrompt

func (f *FakePrompts) GenericPrompt(msg, prompt string, validOptions []string) string

func (*FakePrompts) KeyPassphrase

func (f *FakePrompts) KeyPassphrase(string) string

func (*FakePrompts) OTP

func (f *FakePrompts) OTP(string) string

func (*FakePrompts) PHI

func (f *FakePrompts) PHI() error

func (*FakePrompts) Password

func (f *FakePrompts) Password(msg string) string

func (*FakePrompts) YesNo

func (f *FakePrompts) YesNo(msg, prompt string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL