pachyderm: Index | Files

package testutil

import ""


Package Files

cmds.go enterprise.go kubeclient.go naming.go pach_client.go ports.go random.go saml.go sql_data.go


const TestPGDump = "" /* 1234 byte string literal not displayed */

TestPGDump is a simple example pgdump file for a table containing a few cars

const TestPGDumpNewHeader = "" /* 1026 byte string literal not displayed */

TestPGDumpNewHeader has no rows, but has a new header

const TestPGDumpNewRows = "" /* 1221 byte string literal not displayed */

TestPGDumpNewRows is the same as TestPGDump, except that it has two new rows

func ActivateEnterprise Uses

func ActivateEnterprise(t testing.TB, c *client.APIClient) error

ActivateEnterprise activates enterprise in Pachyderm (if it's not on already.)

func AuthenticateWithSAMLResponse Uses

func AuthenticateWithSAMLResponse(t testing.TB, c *client.APIClient, samlResponse []byte)

AuthenticateWithSAMLResponse sends 'response' to Pachd's ACS, extracts the OTP from the response, converts it to a Pachyderm token, and automatically assigns it to the client 'c'

func BashCmd Uses

func BashCmd(cmd string, subs ...string) *exec.Cmd

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

func Cmd Uses

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 DeletePachdPod Uses

func DeletePachdPod(t testing.TB)

DeletePachdPod deletes the pachd pod in a test cluster (restarting it, e.g. to retart the PPS master)

func DeletePipelineRC Uses

func DeletePipelineRC(t testing.TB, pipeline string)

DeletePipelineRC deletes the RC belonging to the pipeline 'pipeline'. This can be used to test PPS's robustness

func GetACSAddress Uses

func GetACSAddress(t testing.TB, pachdAddress string) string

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


and converts it to


and returns that

func GetKubeClient Uses

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 GetPachClient Uses

func GetPachClient(t testing.TB) *client.APIClient

GetPachClient gets a pachyderm client for use in tests. It works for tests running both inside and outside the cluster. Note that multiple calls to GetPachClient will return the same instance.

func GetTestEnterpriseCode Uses

func GetTestEnterpriseCode(t testing.TB) string

GetTestEnterpriseCode Pulls the enterprise code out of the env var stored in travis

func MustMarshalEl Uses

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

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

func MustMarshalXML Uses

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

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

func MustParseURL Uses

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

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

func PrettyPrintEl Uses

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

PrettyPrintEl returns 'el' indented and marshalled to a string

func SeedRand Uses

func SeedRand(customSeed ...int64) string

SeedRand seeds the rand package with a seed based on the time and returns a string with the seed embedded in it.

func UniquePort Uses

func UniquePort() uint16

UniquePort generates a likely unique port, so that multiple servers can run concurrently. Note that it does not actually check that the port is free, but uses atomics and a fairly highly port range to maximize the likelihood that the port is available.

func UniqueString Uses

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

type MockServiceProviderProvider Uses

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 Uses

func ConstServiceProviderProvider(md *saml.EntityDescriptor) MockServiceProviderProvider

ConstServiceProviderProvider returns a ServiceProviderProvider that always returns 'md'

func (MockServiceProviderProvider) GetServiceProvider Uses

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

GetServiceProvider implements the corresponding method in the ServiceProviderProvider interface for MockServiceProviderProvider

type TestIDP Uses

type TestIDP struct {
    // contains filtered or unexported fields

TestIDP is a simple SAML ID provider for testing. It can generate SAML metadata (for configs) or SAMLResponses containing signed auth assertions and group memberships (for authentication)

func NewTestIDP Uses

func NewTestIDP(t testing.TB, pachdACSURL, pachdMetadataURL string) *TestIDP

NewTestIDP generates a new x509 cert and new test SAML ID provider

func (*TestIDP) Metadata Uses

func (t *TestIDP) Metadata() []byte

Metadata returns serialized IDP metadata for 't'

func (*TestIDP) NewSAMLResponse Uses

func (t *TestIDP) NewSAMLResponse(subject string, groups ...string) []byte

NewSAMLResponse generates a new signed SAMLResponse asserting that the bearer is 'subject' and is a member of the groups in 'groups'

Package testutil imports 37 packages (graph). Updated 2020-08-09. Refresh now. Tools for package owners.

The go get command cannot install this package because of the following issues: