Documentation
¶
Overview ¶
Package testutil provides shared test utilities for roborev tests.
Index ¶
- func AssertStatusCode(t *testing.T, w *httptest.ResponseRecorder, expected int)
- func CreateTestJobWithSHA(t *testing.T, db *storage.DB, repo *storage.Repo, sha, agent string) *storage.ReviewJob
- func CreateTestJobs(t *testing.T, db *storage.DB, repo *storage.Repo, count int, agent string) []*storage.ReviewJob
- func CreateTestRepo(t *testing.T, db *storage.DB) *storage.Repo
- func OpenTestDB(t *testing.T) *storage.DB
- func OpenTestDBWithDir(t *testing.T) (*storage.DB, string)
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 ¶
CreateTestRepo creates a test repository in the database. Uses the test's temp directory as the repo path.
func OpenTestDB ¶
OpenTestDB creates a test database in a temporary directory. The database is automatically closed when the test completes.
func OpenTestDBWithDir ¶
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.