testutil

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QualifiedImage    = "gcr.io/image/digest@sha256:0000000000000000000000000000000000000000000000000000000000000000"
	IntTestImage      = "gcr.io/kritis-int-test/test-image@sha256:3e2e946cb834c4538b789312d566eb16f4a27734fc6b140a3b3f85baafce965f"
	PgpKeyFingerprint = "D283A5F5F5F5ECAA9EF185C5AE8B6994116315A3"
)

Variables

View Source
var PrivateTestKey = "" /* 6928-byte string literal not displayed */

PrivateTestKey is base64 encoded private key for above generated public private gpg keys. created using: gpg --export-secret-keys --armor D283A5F5F5F5ECAA9EF185C5AE8B6994116315A3 | base64

View Source
var PublicTestKey = "" /* 3284-byte string literal not displayed */

PublicTestKey is base64 encoded sig for image gcr.io/kritis-project/kritis-server@sha256:b3f3eccfd27c9864312af3796067e7db28007a1566e1e042c5862eed3ff1b2c8 created using: gpg --quick-generate-key --yes test@kritis.org && gpg --armor --export test@kritis.org | base64

Functions

func Base64PublicTestKey

func Base64PublicTestKey(t *testing.T) string

func CheckError

func CheckError(t *testing.T, shouldErr bool, err error)

func CheckErrorAndDeepEqual

func CheckErrorAndDeepEqual(t *testing.T, shouldErr bool, err error, expected, actual interface{})

func CreateKeyPair

func CreateKeyPair(t *testing.T, name string) (string, string)

func CreateSecret

func CreateSecret(t *testing.T, name string) (*secrets.PGPSigningSecret, string)

func DeepEqual

func DeepEqual(t *testing.T, expected, actual interface{})

func NilReadOnlyClient added in v0.2.1

func NilReadOnlyClient() func() (metadata.ReadOnlyClient, error)

func NilReadWriteClient added in v0.2.1

func NilReadWriteClient() func() (metadata.ReadWriteClient, error)

Types

type MockMetadataClient

type MockMetadataClient struct {
	Vulnz           []metadata.Vulnerability
	PGPAttestations []metadata.PGPAttestation
	AAs             []kritisv1beta1.AttestationAuthority
	Occ             map[string]string
	Err             error
}

Implements ReadWriteClient and ReadOnlyClient interfaces.

func (*MockMetadataClient) AttestationNote

func (*MockMetadataClient) Attestations

func (m *MockMetadataClient) Attestations(containerImage string, aa *kritisv1beta1.AttestationAuthority) ([]metadata.PGPAttestation, error)

func (*MockMetadataClient) Close added in v0.1.1

func (m *MockMetadataClient) Close()

Close does not do anything for MockMetadataClient

func (*MockMetadataClient) CreateAttestationNote

func (m *MockMetadataClient) CreateAttestationNote(aa *kritisv1beta1.AttestationAuthority) (*grafeas.Note, error)

func (*MockMetadataClient) CreateAttestationOccurrence added in v0.2.0

func (m *MockMetadataClient) CreateAttestationOccurrence(n *grafeas.Note, image string,
	s *secrets.PGPSigningSecret, proj string) (*grafeas.Occurrence, error)

func (*MockMetadataClient) SetError added in v0.2.0

func (m *MockMetadataClient) SetError(err error)

func (*MockMetadataClient) Vulnerabilities

func (m *MockMetadataClient) Vulnerabilities(containerImage string) ([]metadata.Vulnerability, error)

type ReviewerMock

type ReviewerMock struct {
	// contains filtered or unexported fields
}

func NewReviewer

func NewReviewer(gapErr, ispErr bool, s string) *ReviewerMock

func (*ReviewerMock) ReviewGAP

func (r *ReviewerMock) ReviewGAP(images []string, isps []v1beta1.GenericAttestationPolicy, pod *v1.Pod, c metadata.ReadOnlyClient) error

func (*ReviewerMock) ReviewISP

func (r *ReviewerMock) ReviewISP(images []string, isps []v1beta1.ImageSecurityPolicy, pod *v1.Pod, c metadata.ReadWriteClient) error

Jump to

Keyboard shortcuts

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