Documentation
¶
Overview ¶
Package testutil needs to be documented.
TODO: document
Index ¶
- Constants
- func ActivateAuthClient(tb testing.TB, c *client.APIClient, port ...string)
- func AuthenticateClient(tb testing.TB, c *client.APIClient, subject string) *client.APIClient
- func AuthenticatedPachClient(tb testing.TB, c *client.APIClient, subject string, port ...string) *client.APIClient
- func BuildBindings(s ...string) *auth.RoleBinding
- func BuildClusterBindings(s ...string) *auth.RoleBinding
- func CleanupEphemeralDB(ctx context.Context, db *pachsql.DB, dbName string) error
- func CommitCnt(t *testing.T, c *client.APIClient, repo *pfs.Repo) int
- func ConfigureOIDCProvider(t *testing.T, c *client.APIClient, unitTest bool) error
- func CreateEphemeralDB(t testing.TB, db *pachsql.DB, dbName string)
- func CreateEphemeralDBNontest(ctx context.Context, db *pachsql.DB, dbName string) error
- func DebugFiles(t testing.TB, projectName, repoName string) (map[string]*globlib.Glob, []string)
- func DeletePipelineRC(t testing.TB, pipeline, namespace string)
- func DexHost(c *client.APIClient) string
- func DoOAuthExchange(t testing.TB, pachClient, enterpriseClient *client.APIClient, loginURL string)
- func DoOAuthExchangeOnce(t testing.TB, pachClient, enterpriseClient *client.APIClient, loginURL string) error
- func GenerateEphemeralDBName() string
- func GetKubeClient(t testing.TB) *kube.Clientset
- func GetOIDCTokenForTrustedApp(t testing.TB, testClient *client.APIClient, unitTest bool) string
- func GetProjectRoleBinding(ctx context.Context, t *testing.T, c *client.APIClient, project string) *auth.RoleBinding
- func GetRepoRoleBinding(ctx context.Context, t *testing.T, c *client.APIClient, ...) *auth.RoleBinding
- func Group(group string) string
- func Listen(t testing.TB) net.Listener
- func LogHttpResponse(t testing.TB, response *http.Response, msg string)
- func NewLoggingHTTPClient(t testing.TB) *http.Client
- func OIDCOIDCConfig(host, issuerPort, redirectPort string, local bool) *auth.OIDCConfig
- func OpenDB(t testing.TB, opts ...dbutil.Option) *pachsql.DB
- func OpenDBURL(t testing.TB, u pachsql.URL, password string) *pachsql.DB
- func PipelineNames(t *testing.T, c *client.APIClient, project string) []string
- func Pl(projectName, pipelineName string) string
- func RandomRobot(t *testing.T, c *client.APIClient, name string) (string, *client.APIClient)
- func RepoInfoToName(repoInfo interface{}) interface{}
- func RewriteRedirect(t testing.TB, resp *http.Response, host string) string
- func RewriteURL(t testing.TB, urlStr, host string) string
- func Robot(robot string) string
- func TSProtoOrDie(t testing.TB, ts time.Time) *timestamppb.Timestamp
- func UnauthenticatedPachClient(tb testing.TB, c *client.APIClient) *client.APIClient
- func User(email string) string
Constants ¶
const DefaultTransformImage = "ubuntu:20.04"
const DexMockConnectorEmail = `[email protected]`
DexMockConnectorEmail is the identity returned for all requests to the mock Dex connector (see https://github.com/dexidp/dex/blob/c113df2730052e20881dd68561289f8ae121300b/connector/mock/connectortest.go#L21) Kilgore Trout is a recurring character of Kurt Vonnegut's
const (
// RootToken is the hard-coded admin token used on all activated test clusters
RootToken = "iamroot"
)
Variables ¶
This section is empty.
Functions ¶
func ActivateAuthClient ¶
ActivateAuthClient activates the auth service in the test cluster, if it isn't already enabled
func AuthenticateClient ¶
AuthenticateClient creates a new authenticated pach client, without re-activating.
func AuthenticatedPachClient ¶
func BuildBindings ¶
func BuildBindings(s ...string) *auth.RoleBinding
func BuildClusterBindings ¶
func BuildClusterBindings(s ...string) *auth.RoleBinding
func CleanupEphemeralDB ¶ added in v2.10.0
CleanupEphemeralDB cleans up a database.
func ConfigureOIDCProvider ¶
ConfigureOIDCProvider configures the identity service and the auth service to use a mock connector.
func CreateEphemeralDB ¶
CreateEphemeralDB creates a new database using db with a lifetime scoped to the test t.
func CreateEphemeralDBNontest ¶ added in v2.10.0
CreateEphemeralDBNontest creates a new database outside of a test.
func DebugFiles ¶
func DeletePipelineRC ¶
DeletePipelineRC deletes the RC belonging to the pipeline 'pipeline'. This can be used to test PPS's robustness
func DoOAuthExchange ¶
DoOAuthExchange does the OAuth dance to log in to the mock provider, given a login URL
func DoOAuthExchangeOnce ¶ added in v2.8.0
func GenerateEphemeralDBName ¶
func GenerateEphemeralDBName() string
GenerateEphemeralDBName generates a random name suitable for use as a Postgres identifier
func GetKubeClient ¶
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 GetProjectRoleBinding ¶
func GetRepoRoleBinding ¶
func Listen ¶ added in v2.8.0
Listen creates a new net.Listener on localhost and ensures the listener is closed when the test exits
func OIDCOIDCConfig ¶
func OIDCOIDCConfig(host, issuerPort, redirectPort string, local bool) *auth.OIDCConfig
OIDCOIDCConfig is an auth config which can be used to connect to the identity service in tests
func OpenDB ¶
OpenDB connects to a database using opts and returns it. The database will be closed at the end of the test.
func OpenDBURL ¶
OpenDBURL connects to a database using u and returns it. The database will be closed at the end of the test.
func PipelineNames ¶
PipelineNames returns the names of all pipelines that 'c' gets from ListPipeline in the specified project.
func RandomRobot ¶
func RepoInfoToName ¶
func RepoInfoToName(repoInfo interface{}) interface{}
func RewriteRedirect ¶
RewriteRedirect rewrites the Location header to point to the returned path at `host`
func RewriteURL ¶
RewriteURL rewrites the host and scheme in urlStr
func TSProtoOrDie ¶
func UnauthenticatedPachClient ¶
UnauthenticatedPachClient returns a copy of the testing pach client with no auth token.
Types ¶
This section is empty.