MCPcopy Create free account
hub / github.com/coder/coder / TestNoPrebuilds

Function TestNoPrebuilds

coderd/prebuilds/preset_snapshot_test.go:78–97  ·  view source on GitHub ↗

A new template version with a preset without prebuilds configured should result in no prebuilds being created.

(t *testing.T)

Source from the content-addressed store, hash-verified

76
77// A new template version with a preset without prebuilds configured should result in no prebuilds being created.
78func TestNoPrebuilds(t *testing.T) {
79 t.Parallel()
80 current := opts[optionSet0]
81 clock := quartz.NewMock(t)
82
83 presets := []database.GetTemplatePresetsWithPrebuildsRow{
84 preset(true, 0, current),
85 }
86
87 snapshot := prebuilds.NewGlobalSnapshot(presets, nil, nil, nil, nil, nil, nil, clock, testutil.Logger(t))
88 ps, err := snapshot.FilterByPreset(current.presetID)
89 require.NoError(t, err)
90
91 state := ps.CalculateState()
92 actions, err := ps.CalculateActions(backoffInterval)
93 require.NoError(t, err)
94
95 validateState(t, prebuilds.ReconciliationState{ /*all zero values*/ }, *state)
96 validateActions(t, nil, actions)
97}
98
99// A new template version with a preset with prebuilds configured should result in a new prebuild being created.
100func TestNetNew(t *testing.T) {

Callers

nothing calls this directly

Calls 8

FilterByPresetMethod · 0.95
NewGlobalSnapshotFunction · 0.92
LoggerFunction · 0.92
presetFunction · 0.85
validateStateFunction · 0.85
validateActionsFunction · 0.85
CalculateStateMethod · 0.80
CalculateActionsMethod · 0.45

Tested by

no test coverage detected