testutil

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package testutil provides shared test utilities for roborev tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertStatusCode

func AssertStatusCode(t *testing.T, w *httptest.ResponseRecorder, expected int)

AssertStatusCode checks that the response has the expected HTTP status code. On failure, it reports the response body for debugging.

func CreateTestJobWithSHA

func CreateTestJobWithSHA(t *testing.T, db *storage.DB, repo *storage.Repo, sha, agent string) *storage.ReviewJob

CreateTestJobWithSHA creates a single test job with a specific SHA.

func CreateTestJobs

func CreateTestJobs(t *testing.T, db *storage.DB, repo *storage.Repo, count int, agent string) []*storage.ReviewJob

CreateTestJobs creates the specified number of test jobs in a repository. Each job is created with a unique SHA (sha0, sha1, etc.) and the specified agent. Returns the created jobs in order.

func CreateTestRepo

func CreateTestRepo(t *testing.T, db *storage.DB) *storage.Repo

CreateTestRepo creates a test repository in the database. Uses the test's temp directory as the repo path.

func OpenTestDB

func OpenTestDB(t *testing.T) *storage.DB

OpenTestDB creates a test database in a temporary directory. The database is automatically closed when the test completes.

func OpenTestDBWithDir

func OpenTestDBWithDir(t *testing.T) (*storage.DB, string)

OpenTestDBWithDir creates a test database and returns both the DB and the temporary directory path. Useful when tests need to create repos or other files in the same directory. The database is automatically closed when the test completes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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