-
Notifications
You must be signed in to change notification settings - Fork 146
Trt 2709 jobrunid mapping csr post backfill #3965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package integration | ||
|
|
||
| import ( | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| "gorm.io/gorm" | ||
|
|
||
| v1 "github.com/openshift/sippy/pkg/apis/sippyprocessing/v1" | ||
| "github.com/openshift/sippy/pkg/db/query" | ||
| intutil "github.com/openshift/sippy/test/integration/util" | ||
| ) | ||
|
|
||
| func TestLookupProwJobRunPartitionKeys(t *testing.T) { | ||
| dbc := intutil.NewTestDB(t, pgContainer) | ||
| job := intutil.CreateProwJob(t, dbc, "periodic-e2e-aws", "4.18", nil) | ||
| ts := time.Date(2026, 7, 15, 10, 0, 0, 0, time.UTC) | ||
| run := intutil.CreateProwJobRun(t, dbc, job.ID, "4.18", ts, true, v1.JobSucceeded) | ||
|
|
||
| keys, err := query.LookupProwJobRunPartitionKeys(dbc.DB, int64(run.ID)) | ||
| require.NoError(t, err) | ||
| assert.Equal(t, "4.18", keys.ProwJobRelease) | ||
| assert.True(t, ts.Equal(keys.Timestamp)) | ||
|
|
||
| _, err = query.LookupProwJobRunPartitionKeys(dbc.DB, 999999) | ||
| require.ErrorIs(t, err, gorm.ErrRecordNotFound) | ||
| } | ||
|
Comment on lines
+16
to
+29
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Test that the ID map is the lookup source. This fixture creates both the job-run row and the ID-map row. An implementation that still queries As per coding guidelines, “bug fixes need regression tests”. 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Add regression coverage for partitioned job-run associations.
Add fixtures that reuse one job-run ID across different release or timestamp partitions. Assert that each report selects only the matching association.
pkg/api/componentreadiness/dataprovider/postgres/provider.go#L398-L399: test that test-details output excludes the same ID from another partition.pkg/api/recent_test_failures.go#L250-L252: test that failure output uses the matching run URL and timestamp.pkg/db/functions.go#L89-L90: test that retest counts exclude a pull-request association from another partition.pkg/db/functions.go#L173-L174: test that organization and repository values use the matching partition.pkg/db/query/pull_request_queries.go#L29-L29: test that pull-request report rows do not cross partitions.pkg/db/query/pull_request_queries.go#L52-L52: test that pre-merge failure averages exclude cross-partition associations.As per coding guidelines, “new or modified functionality should include test coverage”.
📍 Affects 4 files
pkg/api/componentreadiness/dataprovider/postgres/provider.go#L398-L399(this comment)pkg/api/recent_test_failures.go#L250-L252pkg/db/functions.go#L89-L90pkg/db/functions.go#L173-L174pkg/db/query/pull_request_queries.go#L29-L29pkg/db/query/pull_request_queries.go#L52-L52🤖 Prompt for AI Agents
Source: Coding guidelines