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

Function setupTestDBTemplateWithinOrg

enterprise/coderd/prebuilds/reconcile_test.go:3053–3077  ·  view source on GitHub ↗

nolint:revive // It's a control flag, but this is a test.

(
	t *testing.T,
	db database.Store,
	userID uuid.UUID,
	templateDeleted bool,
	templateName string,
	org database.Organization,
)

Source from the content-addressed store, hash-verified

3051
3052// nolint:revive // It's a control flag, but this is a test.
3053func setupTestDBTemplateWithinOrg(
3054 t *testing.T,
3055 db database.Store,
3056 userID uuid.UUID,
3057 templateDeleted bool,
3058 templateName string,
3059 org database.Organization,
3060) database.Template {
3061 t.Helper()
3062
3063 template := dbgen.Template(t, db, database.Template{
3064 Name: templateName,
3065 CreatedBy: userID,
3066 OrganizationID: org.ID,
3067 CreatedAt: time.Now().Add(muchEarlier),
3068 })
3069 if templateDeleted {
3070 ctx := testutil.Context(t, testutil.WaitShort)
3071 require.NoError(t, db.UpdateTemplateDeletedByID(ctx, database.UpdateTemplateDeletedByIDParams{
3072 ID: template.ID,
3073 Deleted: true,
3074 }))
3075 }
3076 return template
3077}
3078
3079const (
3080 earlier = -time.Hour

Calls 5

TemplateFunction · 0.92
ContextFunction · 0.92
HelperMethod · 0.65
AddMethod · 0.65

Tested by

no test coverage detected