@@ -914,6 +914,7 @@ func TestAccessReviewCampaignSource_NameSurvivesSourceDeletion(t *testing.T) {
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
const snapshotName = "Archived Snapshot Source"
|
||||
|
||||
sourceID := factory.NewAccessReviewSource(owner, orgID).
|
||||
WithName(snapshotName).
|
||||
WithCsvData(testCsvData).
|
||||
|
||||
@@ -590,6 +590,7 @@ func (s *Service) CountFetchAttemptsForCampaignSourceID(
|
||||
var attempts coredata.AccessReviewCampaignSourceFetchAttempts
|
||||
|
||||
var err error
|
||||
|
||||
count, err = attempts.CountByCampaignSourceID(ctx, conn, scope, campaignSourceID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot count fetch attempts: %w", err)
|
||||
|
||||
@@ -133,6 +133,7 @@ func (s *Service) RecordDecisions(
|
||||
decidedByID, ok := decidedByCache[entry.OrganizationID]
|
||||
if !ok {
|
||||
decidedByID = nil
|
||||
|
||||
if d.DecidedByID != nil {
|
||||
profile := &coredata.MembershipProfile{}
|
||||
if err := profile.LoadByIdentityIDAndOrganizationID(ctx, conn, scope, *d.DecidedByID, entry.OrganizationID); err == nil {
|
||||
|
||||
@@ -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