spiretest

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 22 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EC256Key, _ = pemutil.ParseSigner([]byte(`-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgcyW+Ne33t4e7HVxn
5aWdL02CcurRNixGgu1vVqQzq3+hRANCAASSQSfkTYd3+u8JEMJUw2Pd143QAOKP
24lWY34SXQInPaja544bc67U0dG0YCNozyAtZxIHFjV+t2HGThM8qNYg
-----END PRIVATE KEY-----
`))
	DefaultKey = EC256Key
)

Functions

func AssertErrorContains

func AssertErrorContains(tb testing.TB, err error, contains string) bool

func AssertGRPCStatus

func AssertGRPCStatus(tb testing.TB, err error, code codes.Code, message string) bool

func AssertGRPCStatusContains

func AssertGRPCStatusContains(tb testing.TB, err error, code codes.Code, contains string) bool

func AssertProtoEqual

func AssertProtoEqual(tb testing.TB, expected, actual proto.Message, msgAndArgs ...interface{}) bool

func AssertProtoListEqual

func AssertProtoListEqual(tb testing.TB, expected, actual interface{}) bool

func CreateCertificate

func CreateCertificate(tb testing.TB, tmpl, parent *x509.Certificate, pub, priv interface{}) *x509.Certificate

func LoadPlugin

func LoadPlugin(tb testing.TB, plugin catalog.Plugin, x interface{}, opts ...PluginOption) (done func())

func RequireErrorContains

func RequireErrorContains(tb testing.TB, err error, contains string)

func RequireGRPCStatus

func RequireGRPCStatus(tb testing.TB, err error, code codes.Code, message string)

func RequireGRPCStatusContains

func RequireGRPCStatusContains(tb testing.TB, err error, code codes.Code, contains string)

func RequireProtoEqual

func RequireProtoEqual(tb testing.TB, expected, actual proto.Message, msgAndArgs ...interface{})

func RequireProtoListEqual

func RequireProtoListEqual(tb testing.TB, expected, actual interface{})

func Run

func Run(t *testing.T, s suite.TestingSuite)

func SelfSignCertificate

func SelfSignCertificate(tb testing.TB, tmpl *x509.Certificate) (*x509.Certificate, crypto.Signer)

func SelfSignCertificateWithKey

func SelfSignCertificateWithKey(tb testing.TB, tmpl *x509.Certificate, key crypto.Signer) *x509.Certificate

func StartGRPCSocketServer

func StartGRPCSocketServer(t *testing.T, socketPath string, registerFn func(s *grpc.Server)) func()

func StartRegistrationAPIOnSocket

func StartRegistrationAPIOnSocket(t *testing.T, socketPath string, server registration.RegistrationServer) func()

func StartRegistrationAPIOnTempSocket

func StartRegistrationAPIOnTempSocket(t *testing.T, server registration.RegistrationServer) (string, func())

func StartWorkloadAPIOnSocket

func StartWorkloadAPIOnSocket(t *testing.T, socketPath string, server workload.SpiffeWorkloadAPIServer) func()

func StartWorkloadAPIOnTempSocket

func StartWorkloadAPIOnTempSocket(t *testing.T, server workload.SpiffeWorkloadAPIServer) (string, func())

Types

type PluginOption

type PluginOption interface {
	// contains filtered or unexported methods
}

func HostService

func HostService(hostService catalog.HostServiceServer) PluginOption

func Logger

func Logger(logger logrus.FieldLogger) PluginOption

type Suite

type Suite struct {
	suite.Suite
	// contains filtered or unexported fields
}

func (*Suite) AssertErrorContains

func (s *Suite) AssertErrorContains(err error, contains string) bool

func (*Suite) AssertGRPCStatus

func (s *Suite) AssertGRPCStatus(err error, code codes.Code, message string) bool

func (*Suite) AssertGRPCStatusContains

func (s *Suite) AssertGRPCStatusContains(err error, code codes.Code, contains string) bool

func (*Suite) AssertProtoEqual

func (s *Suite) AssertProtoEqual(expected, actual proto.Message) bool

func (*Suite) AssertProtoListEqual

func (s *Suite) AssertProtoListEqual(expected, actual interface{}) bool

func (*Suite) LoadPlugin

func (s *Suite) LoadPlugin(builtin catalog.Plugin, x interface{}, opts ...PluginOption)

func (*Suite) RequireErrorContains

func (s *Suite) RequireErrorContains(err error, contains string)

func (*Suite) RequireGRPCStatus

func (s *Suite) RequireGRPCStatus(err error, code codes.Code, message string)

func (*Suite) RequireGRPCStatusContains

func (s *Suite) RequireGRPCStatusContains(err error, code codes.Code, contains string)

func (*Suite) RequireProtoEqual

func (s *Suite) RequireProtoEqual(expected, actual proto.Message)

func (*Suite) RequireProtoListEqual

func (s *Suite) RequireProtoListEqual(expected, actual interface{})

func (*Suite) TempDir

func (s *Suite) TempDir() string

Jump to

Keyboard shortcuts

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