(t *testing.T)
| 308 | } |
| 309 | |
| 310 | func TestWorker_NoPR_BoundaryExactWindow_Skips(t *testing.T) { |
| 311 | t.Parallel() |
| 312 | ctx := testutil.Context(t, testutil.WaitShort) |
| 313 | |
| 314 | chatID := uuid.New() |
| 315 | ownerID := uuid.New() |
| 316 | |
| 317 | // When updated_at is exactly NoPRRetryWindow ago, the strict |
| 318 | // "<" comparison means the row should be skipped (no backoff). |
| 319 | // This pins the boundary so an accidental change to "<=" is |
| 320 | // caught. |
| 321 | tickDone := make(chan struct{}) |
| 322 | |
| 323 | ctrl := gomock.NewController(t) |
| 324 | store := dbmock.NewMockStore(ctrl) |
| 325 | |
| 326 | mClock := quartz.NewMock(t) |
| 327 | |
| 328 | row := makeAcquiredRowWithBranch(chatID, ownerID, "feature") |
| 329 | row.UpdatedAt = mClock.Now().Add(-gitsync.NoPRRetryWindow) // exactly at boundary |
| 330 | |
| 331 | store.EXPECT().AcquireStaleChatDiffStatuses(gomock.Any(), gomock.Any()). |
| 332 | Return([]database.AcquireStaleChatDiffStatusesRow{row}, nil) |
| 333 | // BackoffChatDiffStatus should NOT be called. |
| 334 | |
| 335 | logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true}) |
| 336 | |
| 337 | refresher := newTestRefresher(t, mClock, withResolveBranchPR( |
| 338 | func(context.Context, string, gitprovider.BranchRef) (*gitprovider.PRRef, error) { |
| 339 | close(tickDone) |
| 340 | return nil, nil |
| 341 | }, |
| 342 | )) |
| 343 | |
| 344 | worker := gitsync.NewWorker(store, refresher, nil, mClock, logger) |
| 345 | |
| 346 | tickOnce(ctx, t, mClock, worker, tickDone) |
| 347 | } |
| 348 | |
| 349 | func TestWorker_NoPR_BackoffError_ContinuesNextRow(t *testing.T) { |
| 350 | t.Parallel() |
nothing calls this directly
no test coverage detected