Documentation
¶
Index ¶
- func CreateBug(t *testing.T, dbc *db.DB, key, status, summary string, ...) models.Bug
- func CreateBugForTests(t *testing.T, dbc *db.DB, key, status, summary string, ...) models.Bug
- func CreateCumulativeSummary(t *testing.T, dbc *db.DB, date civil.Date, release string, ...) models.TestCumulativeSummary
- func CreateJiraComponent(t *testing.T, dbc *db.DB, name string) models.JiraComponent
- func CreateProwJob(t *testing.T, dbc *db.DB, name, release string, variants []string) models.ProwJob
- func CreateProwJobRun(t *testing.T, dbc *db.DB, prowJobID uint, release string, timestamp time.Time, ...) models.ProwJobRun
- func CreateProwJobRunTest(t *testing.T, dbc *db.DB, prowJobRunID, prowJobID, testID uint, release string, ...) models.ProwJobRunTest
- func CreateProwJobRunTestOutput(t *testing.T, dbc *db.DB, pjrt models.ProwJobRunTest, output string) models.ProwJobRunTestOutput
- func CreateProwJobWithOptions(t *testing.T, dbc *db.DB, name, release string, variants []string, ...) models.ProwJob
- func CreateReleaseDefinition(t *testing.T, dbc *db.DB, release string, major, minor int) models.ReleaseDefinition
- func CreateReleaseJobRun(t *testing.T, dbc *db.DB, releaseTagID, prowJobRunID uint, ...) models.ReleaseJobRun
- func CreateReleasePullRequest(t *testing.T, dbc *db.DB, url, name, description string, ...) models.ReleasePullRequest
- func CreateReleaseTag(t *testing.T, dbc *db.DB, releaseTag, release, stream, arch string, ...) models.ReleaseTag
- func CreateSuite(t *testing.T, dbc *db.DB, name string) models.Suite
- func CreateTest(t *testing.T, dbc *db.DB, name string) models.Test
- func CreateTestOwnership(t *testing.T, dbc *db.DB, testID uint, suiteID *uint, ...) models.TestOwnership
- func CreateVariantCombination(t *testing.T, dbc *db.DB, variants []string) models.VariantCombination
- func LinkReleaseTagPullRequests(t *testing.T, dbc *db.DB, tag *models.ReleaseTag, ...)
- func NewTestDB(t *testing.T, pc *PostgresContainer) *db.DB
- func SetupIntegrationSchema(dbc *db.DB) error
- type CumulativeSummaryOption
- func WithCumulativeSummaryFailures(failures int64) CumulativeSummaryOption
- func WithCumulativeSummaryLastFailure(t time.Time) CumulativeSummaryOption
- func WithCumulativeSummaryLastSuccess(t time.Time) CumulativeSummaryOption
- func WithCumulativeSummaryLifecycle(lifecycle string) CumulativeSummaryOption
- type PostgresContainer
- type ProwJobOption
- type ProwJobRunOption
- type ProwJobRunTestOption
- type ReleasePullRequestOption
- type ReleaseTagOption
- type TestOwnershipOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBugForTests ¶
func CreateBugForTests(t *testing.T, dbc *db.DB, key, status, summary string, lastChangeTime time.Time, tests []models.Test) models.Bug
CreateBugForTests creates a bug associated with tests via the bug_tests join table (as opposed to CreateBug, which associates via bug_jobs). Test report queries (openBugsSubquery) count open bugs through this association.
func CreateCumulativeSummary ¶
func CreateCumulativeSummary(t *testing.T, dbc *db.DB, date civil.Date, release string, testID, prowJobID, suiteID uint, runs, successes, flakes int64, opts ...CumulativeSummaryOption) models.TestCumulativeSummary
CreateCumulativeSummary creates a test_cumulative_summaries row directly with the given prefix sums, rather than deriving them from raw run data. Prefix sums are cumulative totals as of Date: callers computing a period count from two rows (e.g. for dates end and boundary) get period_count = end.PrefixSumX - boundary.PrefixSumX. Lifecycle defaults to "blocking" (matching the column's DB default) unless overridden.
func CreateJiraComponent ¶
CreateJiraComponent creates a jira_components row. Test report queries resolve TestOwnership.JiraComponent (a plain string) against JiraComponent.Name to populate jira_component_id, so the two must match for that join to succeed.
func CreateProwJob ¶
func CreateProwJobRun ¶
func CreateProwJobRun(t *testing.T, dbc *db.DB, prowJobID uint, release string, timestamp time.Time, succeeded bool, overallResult v1.JobOverallResult, opts ...ProwJobRunOption) models.ProwJobRun
func CreateProwJobRunTest ¶
func CreateProwJobRunTestOutput ¶
func CreateProwJobRunTestOutput(t *testing.T, dbc *db.DB, pjrt models.ProwJobRunTest, output string) models.ProwJobRunTestOutput
CreateProwJobRunTestOutput creates the prow_job_run_test_outputs row for a given ProwJobRunTest. It wires the composite (id, timestamp, release) key that the read-time TestOutputs query joins on, denormalizing the timestamp and release from the parent test result.
func CreateReleaseDefinition ¶
func CreateReleaseJobRun ¶
func CreateReleasePullRequest ¶
func CreateReleasePullRequest(t *testing.T, dbc *db.DB, url, name, description string, opts ...ReleasePullRequestOption) models.ReleasePullRequest
func CreateReleaseTag ¶
func CreateReleaseTag(t *testing.T, dbc *db.DB, releaseTag, release, stream, arch string, releaseTime time.Time, opts ...ReleaseTagOption) models.ReleaseTag
func CreateTestOwnership ¶
func CreateTestOwnership(t *testing.T, dbc *db.DB, testID uint, suiteID *uint, uniqueID, component string, opts ...TestOwnershipOption) models.TestOwnership
CreateTestOwnership creates a test_ownerships row scoped to a specific suite. Pass suiteID as nil for a suite-agnostic ownership row.
func CreateVariantCombination ¶
func CreateVariantCombination(t *testing.T, dbc *db.DB, variants []string) models.VariantCombination
CreateVariantCombination creates a variant_combinations row. Pass the result to WithVariantCombination when creating a ProwJob so cumulative-summary-based reports (which join through prow_jobs.variant_combination_id) can find it.
func LinkReleaseTagPullRequests ¶
func LinkReleaseTagPullRequests(t *testing.T, dbc *db.DB, tag *models.ReleaseTag, prs ...models.ReleasePullRequest)
func NewTestDB ¶
func NewTestDB(t *testing.T, pc *PostgresContainer) *db.DB
NewTestDB creates a fresh database cloned from the template and returns a *db.DB connected to it. The database is dropped when the test finishes.
func SetupIntegrationSchema ¶
SetupIntegrationSchema creates all tables (non-partitioned) and SQL functions needed by API query methods. It intentionally skips materialized views, partitioning, triggers, and GIN indexes.
Types ¶
type CumulativeSummaryOption ¶
type CumulativeSummaryOption func(*models.TestCumulativeSummary)
func WithCumulativeSummaryFailures ¶
func WithCumulativeSummaryFailures(failures int64) CumulativeSummaryOption
func WithCumulativeSummaryLastFailure ¶
func WithCumulativeSummaryLastFailure(t time.Time) CumulativeSummaryOption
func WithCumulativeSummaryLastSuccess ¶
func WithCumulativeSummaryLastSuccess(t time.Time) CumulativeSummaryOption
func WithCumulativeSummaryLifecycle ¶
func WithCumulativeSummaryLifecycle(lifecycle string) CumulativeSummaryOption
type PostgresContainer ¶
type PostgresContainer struct {
// contains filtered or unexported fields
}
PostgresContainer holds a running testcontainers Postgres instance and provides helpers to create per-test database clones.
func StartPostgresContainer ¶
func StartPostgresContainer(ctx context.Context) (*PostgresContainer, error)
StartPostgresContainer launches a Postgres container, creates a template database with the integration schema applied, and returns a handle for creating per-test clones. Call cleanup() (or use the returned container's Terminate) when done.
type ProwJobOption ¶
func WithKind ¶
func WithKind(kind models.ProwKind) ProwJobOption
func WithVariantCombination ¶
func WithVariantCombination(vc models.VariantCombination) ProwJobOption
WithVariantCombination sets both Variants and VariantCombinationID from an existing VariantCombination. In production, VariantCombinationID is populated by a database trigger; the integration schema intentionally skips triggers (see SetupIntegrationSchema), so tests must set it explicitly via this option.
type ProwJobRunOption ¶
type ProwJobRunOption func(*models.ProwJobRun)
func WithLabels ¶
func WithLabels(labels ...string) ProwJobRunOption
WithLabels sets the job run's Labels array (e.g. infrafailure.LabelInfraFailure). Read-time summary queries exclude runs carrying the InfraFailure label.
func WithURL ¶
func WithURL(url string) ProwJobRunOption
type ProwJobRunTestOption ¶
type ProwJobRunTestOption func(*models.ProwJobRunTest)
func WithDuration ¶
func WithDuration(duration float64) ProwJobRunTestOption
WithDuration sets the test result's duration (seconds). TestDurations averages this column per day.
func WithLifecycle ¶
func WithLifecycle(lifecycle string) ProwJobRunTestOption
func WithSuiteID ¶
func WithSuiteID(suiteID uint) ProwJobRunTestOption
type ReleasePullRequestOption ¶
type ReleasePullRequestOption func(*models.ReleasePullRequest)
func WithBugURL ¶
func WithBugURL(url string) ReleasePullRequestOption
func WithPullRequestID ¶
func WithPullRequestID(id string) ReleasePullRequestOption
type ReleaseTagOption ¶
type ReleaseTagOption func(*models.ReleaseTag)
ReleaseTagOption customizes a ReleaseTag before creation.
func WithCurrentOSVersion ¶
func WithCurrentOSVersion(version string) ReleaseTagOption
func WithForced ¶
func WithForced(forced bool) ReleaseTagOption
func WithPhase ¶
func WithPhase(phase string) ReleaseTagOption
func WithPreviousOSVersion ¶
func WithPreviousOSVersion(version string) ReleaseTagOption
func WithPreviousReleaseTag ¶
func WithPreviousReleaseTag(prev string) ReleaseTagOption
type TestOwnershipOption ¶
type TestOwnershipOption func(*models.TestOwnership)
func WithTestOwnershipCapabilities ¶
func WithTestOwnershipCapabilities(caps []string) TestOwnershipOption
func WithTestOwnershipJiraComponent ¶
func WithTestOwnershipJiraComponent(name string) TestOwnershipOption
WithTestOwnershipJiraComponent sets the string joined against JiraComponent.Name. Note this is distinct from TestOwnership.JiraComponentID, which test report queries don't use for the jira_components join.
func WithTestOwnershipJiraComponentID ¶
func WithTestOwnershipJiraComponentID(id *uint) TestOwnershipOption