tests

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tests provides test utilities for creating test sessions and other test helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTestHTTPSClient

func GetTestHTTPSClient(t *testing.T) *https.Client

GetTestHTTPSClient creates an HTTPS client for integration tests. It reads BRAINTRUST_API_KEY and BRAINTRUST_API_URL from environment variables. Uses the fail logger to report errors immediately. Skips the test if running in short mode (-short flag). Fails the test if BRAINTRUST_API_KEY is not set.

func Name added in v0.1.0

func Name(t *testing.T, suffixes ...string) string

Name generates a test-specific name by combining t.Name() with optional suffixes.

Example usage:

tests.Name(t)                    // "TestFoo"
tests.Name(t, "slug")            // "TestFoo-slug"
tests.Name(t, "task", "v2")      // "TestFoo-task-v2"

func NewSession

func NewSession(t *testing.T) *auth.Session

NewSession creates a static test session with hardcoded data. This session does not make any network calls or start goroutines. Uses the fail logger if t is provided.

func RandomName

func RandomName(t *testing.T, suffixes ...string) string

RandomName generates a unique name for tests using the test name and a random suffix. This ensures test resources don't collide when running tests in parallel.

func RandomString

func RandomString(length int) string

RandomString generates a random string of the specified length

Types

This section is empty.

Jump to

Keyboard shortcuts

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