testutil

package
v1.8.0-8f47e0df94b6be9... Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2018 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmd added in v1.6.4

func Cmd(name string, args ...string) *exec.Cmd

Cmd is a convenience function that replaces exec.Command. It's both shorter and it uses the current process's stderr as output for the command, which makes debugging failures much easier (i.e. you get an error message rather than "exit status 1")

func GetACSAddress added in v1.7.11

func GetACSAddress(t *testing.T, pachdAddress string) string

GetACSAddress takes a pachd address, assumed to be of the form

(host):(650|30650)

and converts it to

(host):(654|30654)

and returns that

func GetKubeClient added in v1.7.11

func GetKubeClient(t testing.TB) *kube.Clientset

GetKubeClient connects to the Kubernetes API server either from inside the cluster or from a test binary running on a machine with kubectl (it will connect to the same cluster as kubectl)

func GetTestEnterpriseCode

func GetTestEnterpriseCode() string

GetTestEnterpriseCode gets a Pachyderm Enterprise activation code from a private S3 bucket, and provides it to tests that use Pachyderm Enterprise features

func MustMarshalEl added in v1.7.11

func MustMarshalEl(t testing.TB, el *etree.Element) []byte

MustMarshalEl marshals 'el' to []byte, or fails the current test

func MustMarshalXML added in v1.7.11

func MustMarshalXML(t testing.TB, m xml.Marshaler) []byte

MustMarshalXML marshals 'm' to []byte, or fails the current test

func MustParseURL added in v1.7.11

func MustParseURL(t testing.TB, u string) *url.URL

MustParseURL marshals 'u' to a *url.URL, or fails the current test

func PrettyPrintEl added in v1.7.11

func PrettyPrintEl(t testing.TB, el *etree.Element) string

PrettyPrintEl returns 'el' indented and marshalled to a string

func UniqueString added in v1.6.4

func UniqueString(prefix string) string

UniqueString adds a UUID suffix to 'prefix'. This helps avoid name conflicts between tests that share the same Pachyderm cluster

Types

type MockServiceProviderProvider added in v1.7.11

type MockServiceProviderProvider func(*http.Request, string) (*saml.EntityDescriptor, error)

MockServiceProviderProvider gives tests the opportunity to inject their own SAML service provider metadata into an ID provider

func ConstServiceProviderProvider added in v1.7.11

func ConstServiceProviderProvider(md *saml.EntityDescriptor) MockServiceProviderProvider

ConstServiceProviderProvider returns a ServiceProviderProvider that always returns 'md'

func (MockServiceProviderProvider) GetServiceProvider added in v1.7.11

func (f MockServiceProviderProvider) GetServiceProvider(r *http.Request, serviceProviderID string) (*saml.EntityDescriptor, error)

GetServiceProvider implements the corresponding method in the ServiceProviderProvider interface for MockServiceProviderProvider

type MockSessionProvider

type MockSessionProvider func(http.ResponseWriter, *http.Request, *saml.IdpAuthnRequest) *saml.Session

MockSessionProvider gives tests the opportunity to inject their own SAML service provider metadata into an ID provider

func ConstSessionProvider

func ConstSessionProvider(s *saml.Session) MockSessionProvider

ConstSessionProvider gets a SessionProvider that always returns 'md'

func (MockSessionProvider) GetSession

GetSession implements the corresponding method in the saml.SessionProvider interface for MockSessionProvider

type TestCmd added in v1.6.4

type TestCmd exec.Cmd

TestCmd aliases 'exec.Cmd' so that we can add func (c *TestCmd) Run(t *testing.T)

func BashCmd added in v1.6.4

func BashCmd(cmd string, subs ...string) *TestCmd

BashCmd is a convenience function that: 1. Performs a Go template substitution on 'cmd' using the strings in 'subs' 2. Ruturns a command that runs the result string from 1 as a Bash script

func (*TestCmd) Run added in v1.6.4

func (c *TestCmd) Run() error

Run wraps (*exec.Cmd).Run(), though in the particular case that the command is run on Linux and fails with a SIGPIPE error (which often happens because TestCmd is created by BashCmd() above, which also sets -o pipefail), this throws away the error. See "The Infamous SIGPIPE Signal" http://www.tldp.org/LDP/lpg/node20.html

Jump to

Keyboard shortcuts

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