{"modulePath":"github.com/uber/submitqueue","version":"v0.2.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package testutil\n\n## Functions\n\n```go\nfunc ApplySchema(t *testing.T, log *TestLogger, db *sql.DB, schemaDirectory string)\n```\nApplySchema reads all .sql files from the schema directory and executes them on the database.\n\n```go\nfunc FindRepoRoot(t *testing.T) string\n```\nFindRepoRoot finds the repository root. Checks REPO\\_ROOT env var, then git, then walks up to find marker files.\n\n```go\nfunc SchemaDir(relativePath string) string\n```\nSchemaDir returns the path to a schema directory. It checks for both Bazel runfiles and direct go test paths. relativePath should be like \"submitqueue/extension/storage/mysql/schema\" or \"platform/extension/messagequeue/mysql/schema\"\n\n## Types\n\n```go\ntype ComposeStack struct {\n\t// contains filtered or unexported fields\n}\n```\nComposeStack manages a docker-compose stack for testing.\n\n```go\nfunc NewComposeStack(t *testing.T, log *TestLogger, ctx context.Context, composeFile, testContext string) *ComposeStack\n```\nNewComposeStack creates a new compose stack from the given docker-compose file. Automatically registers cleanup to tear down the stack. testContext should describe what's being tested (e.g., \"gateway\", \"storage\", \"e2e-submitqueue\").\n\n```go\nfunc (s *ComposeStack) ConnectGRPC(serviceName string, containerPort int) (*grpc.ClientConn, error)\n```\nConnectGRPC creates a gRPC client connection to a service.\n\n```go\nfunc (s *ComposeStack) ConnectMySQLService(serviceName string) (*sql.DB, error)\n```\nConnectMySQLService connects to a MySQL service by name in the compose stack. Requires that Up() has been called first — the TCP-based healthcheck in docker-compose ensures MySQL is accepting TCP connections before Up() returns.\n\n```go\nfunc (s *ComposeStack) MySQLServiceDSN(serviceName string) (string, error)\n```\nMySQLServiceDSN returns the DSN string for a MySQL service. Useful when the implementation manages its own database connection.\n\n```go\nfunc (s *ComposeStack) ServiceExitCode(serviceName string) (int, error)\n```\nServiceExitCode returns the exit code of a stopped service container. Must be called after the service has exited.\n\n```go\nfunc (s *ComposeStack) ServiceHost(serviceName string, containerPort int) (string, error)\n```\nServiceHost returns the host:port address for a service.\n\n```go\nfunc (s *ComposeStack) ServicePort(serviceName string, containerPort int) (int, error)\n```\nServicePort returns the mapped host port for a service's container port.\n\n```go\nfunc (s *ComposeStack) StopService(serviceName string, timeoutSec int) error\n```\nStopService sends SIGTERM to a service and waits for it to stop. timeoutSec is the maximum time to wait before Docker sends SIGKILL.\n\n```go\nfunc (s *ComposeStack) Up() error\n```\nUp starts all services in the compose stack. Uses --wait to block until all services with healthcheck directives are healthy.\n\n```go\ntype TestLogger struct {\n\t// contains filtered or unexported fields\n}\n```\nTestLogger is a simple test-aware logger that records elapsed time between logs.\n\n```go\nfunc NewTestLogger(t *testing.T) *TestLogger\n```\nNewTestLogger creates a TestLogger for the current test.\n\n```go\nfunc (l *TestLogger) Logf(format string, args ...any)\n```\nLogf prints a formatted log message with timestamp and elapsed time since last log.\n\n","path":"github.com/uber/submitqueue/test/testutil","name":"testutil","synopsis":"","isRedistributable":true}
