@@ -439,6 +439,7 @@ WHERE status = 'FETCHING'
|
||||
AND updated_at < @stale_threshold
|
||||
FOR UPDATE SKIP LOCKED
|
||||
`
|
||||
|
||||
rows, err := conn.Query(ctx, q, pgx.StrictNamedArgs{"stale_threshold": staleThreshold})
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("cannot query stale fetch attempts: %w", err)
|
||||
|
||||
@@ -80,12 +80,14 @@ func TestAccessReviewSourceDeletion_PreservesSnapshotAndEntries(t *testing.T) {
|
||||
}))
|
||||
|
||||
loadedEntry := &coredata.AccessReviewEntry{}
|
||||
|
||||
require.NoError(t, client.WithConn(ctx, func(ctx context.Context, conn pg.Querier) error {
|
||||
return loadedEntry.LoadByID(ctx, conn, fx.scope, entryID)
|
||||
}))
|
||||
assert.Equal(t, "preserve-me@example.com", loadedEntry.Email, "entry must survive source deletion")
|
||||
|
||||
loadedSource := &coredata.AccessReviewCampaignSource{}
|
||||
|
||||
require.NoError(t, client.WithConn(ctx, func(ctx context.Context, conn pg.Querier) error {
|
||||
return loadedSource.LoadByID(ctx, conn, fx.scope, fx.campaignSourceID)
|
||||
}))
|
||||
@@ -137,6 +139,7 @@ func TestSourceFetchAttempts_AppendOnly(t *testing.T) {
|
||||
}))
|
||||
|
||||
var history coredata.AccessReviewCampaignSourceFetchAttempts
|
||||
|
||||
require.NoError(t, client.WithConn(ctx, func(ctx context.Context, conn pg.Querier) error {
|
||||
return history.LoadAllByCampaignSourceID(ctx, conn, fx.scope, fx.campaignSourceID)
|
||||
}))
|
||||
@@ -147,6 +150,7 @@ func TestSourceFetchAttempts_AppendOnly(t *testing.T) {
|
||||
assert.Equal(t, failureMsg, *history[1].Error, "the failed attempt's error is retained")
|
||||
|
||||
var latest coredata.AccessReviewCampaignSourceFetchAttempts
|
||||
|
||||
require.NoError(t, client.WithConn(ctx, func(ctx context.Context, conn pg.Querier) error {
|
||||
return latest.LoadLatestByCampaignID(ctx, conn, fx.scope, fx.campaignID)
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user