(t *testing.T)
| 257 | } |
| 258 | |
| 259 | func TestAcquirer_BackupPoll(t *testing.T) { |
| 260 | t.Parallel() |
| 261 | fs := newFakeOrderedStore() |
| 262 | ps := pubsub.NewInMemory() |
| 263 | ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitShort) |
| 264 | defer cancel() |
| 265 | logger := testutil.Logger(t) |
| 266 | uut := provisionerdserver.NewAcquirer( |
| 267 | ctx, logger.Named("acquirer"), fs, ps, |
| 268 | provisionerdserver.TestingBackupPollDuration(testutil.IntervalMedium), |
| 269 | ) |
| 270 | |
| 271 | workerID := uuid.New() |
| 272 | orgID := uuid.New() |
| 273 | pt := []database.ProvisionerType{database.ProvisionerTypeEcho} |
| 274 | tags := provisionerdserver.Tags{ |
| 275 | "environment": "on-prem", |
| 276 | } |
| 277 | acquiree := newTestAcquiree(t, orgID, workerID, pt, tags) |
| 278 | jobID := uuid.New() |
| 279 | err := fs.sendCtx(ctx, database.ProvisionerJob{}, sql.ErrNoRows) |
| 280 | require.NoError(t, err) |
| 281 | err = fs.sendCtx(ctx, database.ProvisionerJob{ID: jobID}, nil) |
| 282 | require.NoError(t, err) |
| 283 | acquiree.startAcquire(ctx, uut) |
| 284 | job := acquiree.success(ctx) |
| 285 | require.Equal(t, jobID, job.ID) |
| 286 | } |
| 287 | |
| 288 | // TestAcquirer_UnblockOnCancel tests that a canceled call doesn't block a call |
| 289 | // from the same domain. |
nothing calls this directly
no test coverage detected