MCPcopy Index your code
hub / github.com/coder/coder / TestAcquirer_Single

Function TestAcquirer_Single

coderd/provisionerdserver/acquirer_test.go:43–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func TestAcquirer_Single(t *testing.T) {
44 t.Parallel()
45 fs := newFakeOrderedStore()
46 ps := pubsub.NewInMemory()
47 ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitShort)
48 defer cancel()
49 logger := testutil.Logger(t)
50 uut := provisionerdserver.NewAcquirer(ctx, logger.Named("acquirer"), fs, ps)
51
52 orgID := uuid.New()
53 workerID := uuid.New()
54 pt := []database.ProvisionerType{database.ProvisionerTypeEcho}
55 tags := provisionerdserver.Tags{
56 "environment": "on-prem",
57 }
58 acquiree := newTestAcquiree(t, orgID, workerID, pt, tags)
59 jobID := uuid.New()
60 err := fs.sendCtx(ctx, database.ProvisionerJob{ID: jobID}, nil)
61 require.NoError(t, err)
62 acquiree.startAcquire(ctx, uut)
63 job := acquiree.success(ctx)
64 require.Equal(t, jobID, job.ID)
65 require.Len(t, fs.params, 1)
66 require.Equal(t, workerID, fs.params[0].WorkerID.UUID)
67}
68
69// TestAcquirer_MultipleSameDomain tests multiple acquirees with the same provisioners and tags
70func TestAcquirer_MultipleSameDomain(t *testing.T) {

Callers

nothing calls this directly

Calls 12

NewInMemoryFunction · 0.92
LoggerFunction · 0.92
NewAcquirerFunction · 0.92
newFakeOrderedStoreFunction · 0.85
newTestAcquireeFunction · 0.85
NamedMethod · 0.80
sendCtxMethod · 0.80
startAcquireMethod · 0.80
successMethod · 0.80
NewMethod · 0.65
EqualMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected