Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit53a2263

Browse files
test: integration test in-progress
1 parentbcfbb04 commit53a2263

File tree

9 files changed

+180
-71
lines changed

9 files changed

+180
-71
lines changed

‎coderd/database/dbauthz/dbauthz.go

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -512,9 +512,9 @@ func As(ctx context.Context, actor rbac.Subject) context.Context {
512512
// running the insertFunc. The insertFunc is expected to return the object that
513513
// was inserted.
514514
funcinsert[
515-
ObjectTypeany,
516-
ArgumentTypeany,
517-
Insertfunc(ctx context.Context,argArgumentType) (ObjectType,error),
515+
ObjectTypeany,
516+
ArgumentTypeany,
517+
Insertfunc(ctx context.Context,argArgumentType) (ObjectType,error),
518518
](
519519
logger slog.Logger,
520520
authorizer rbac.Authorizer,
@@ -525,9 +525,9 @@ func insert[
525525
}
526526

527527
funcinsertWithAction[
528-
ObjectTypeany,
529-
ArgumentTypeany,
530-
Insertfunc(ctx context.Context,argArgumentType) (ObjectType,error),
528+
ObjectTypeany,
529+
ArgumentTypeany,
530+
Insertfunc(ctx context.Context,argArgumentType) (ObjectType,error),
531531
](
532532
logger slog.Logger,
533533
authorizer rbac.Authorizer,
@@ -554,10 +554,10 @@ func insertWithAction[
554554
}
555555

556556
funcdeleteQ[
557-
ObjectType rbac.Objecter,
558-
ArgumentTypeany,
559-
Fetchfunc(ctx context.Context,argArgumentType) (ObjectType,error),
560-
Deletefunc(ctx context.Context,argArgumentType)error,
557+
ObjectType rbac.Objecter,
558+
ArgumentTypeany,
559+
Fetchfunc(ctx context.Context,argArgumentType) (ObjectType,error),
560+
Deletefunc(ctx context.Context,argArgumentType)error,
561561
](
562562
logger slog.Logger,
563563
authorizer rbac.Authorizer,
@@ -569,10 +569,10 @@ func deleteQ[
569569
}
570570

571571
funcupdateWithReturn[
572-
ObjectType rbac.Objecter,
573-
ArgumentTypeany,
574-
Fetchfunc(ctx context.Context,argArgumentType) (ObjectType,error),
575-
UpdateQueryfunc(ctx context.Context,argArgumentType) (ObjectType,error),
572+
ObjectType rbac.Objecter,
573+
ArgumentTypeany,
574+
Fetchfunc(ctx context.Context,argArgumentType) (ObjectType,error),
575+
UpdateQueryfunc(ctx context.Context,argArgumentType) (ObjectType,error),
576576
](
577577
logger slog.Logger,
578578
authorizer rbac.Authorizer,
@@ -583,10 +583,10 @@ func updateWithReturn[
583583
}
584584

585585
funcupdate[
586-
ObjectType rbac.Objecter,
587-
ArgumentTypeany,
588-
Fetchfunc(ctx context.Context,argArgumentType) (ObjectType,error),
589-
Execfunc(ctx context.Context,argArgumentType)error,
586+
ObjectType rbac.Objecter,
587+
ArgumentTypeany,
588+
Fetchfunc(ctx context.Context,argArgumentType) (ObjectType,error),
589+
Execfunc(ctx context.Context,argArgumentType)error,
590590
](
591591
logger slog.Logger,
592592
authorizer rbac.Authorizer,
@@ -604,9 +604,9 @@ func update[
604604
// user cannot read the resource. This is because the resource details are
605605
// required to run a proper authorization check.
606606
funcfetchWithAction[
607-
ArgumentTypeany,
608-
ObjectType rbac.Objecter,
609-
DatabaseFuncfunc(ctx context.Context,argArgumentType) (ObjectType,error),
607+
ArgumentTypeany,
608+
ObjectType rbac.Objecter,
609+
DatabaseFuncfunc(ctx context.Context,argArgumentType) (ObjectType,error),
610610
](
611611
logger slog.Logger,
612612
authorizer rbac.Authorizer,
@@ -637,9 +637,9 @@ func fetchWithAction[
637637
}
638638

639639
funcfetch[
640-
ArgumentTypeany,
641-
ObjectType rbac.Objecter,
642-
DatabaseFuncfunc(ctx context.Context,argArgumentType) (ObjectType,error),
640+
ArgumentTypeany,
641+
ObjectType rbac.Objecter,
642+
DatabaseFuncfunc(ctx context.Context,argArgumentType) (ObjectType,error),
643643
](
644644
logger slog.Logger,
645645
authorizer rbac.Authorizer,
@@ -652,10 +652,10 @@ func fetch[
652652
// from SQL 'exec' functions which only return an error.
653653
// See fetchAndQuery for more information.
654654
funcfetchAndExec[
655-
ObjectType rbac.Objecter,
656-
ArgumentTypeany,
657-
Fetchfunc(ctx context.Context,argArgumentType) (ObjectType,error),
658-
Execfunc(ctx context.Context,argArgumentType)error,
655+
ObjectType rbac.Objecter,
656+
ArgumentTypeany,
657+
Fetchfunc(ctx context.Context,argArgumentType) (ObjectType,error),
658+
Execfunc(ctx context.Context,argArgumentType)error,
659659
](
660660
logger slog.Logger,
661661
authorizer rbac.Authorizer,
@@ -678,10 +678,10 @@ func fetchAndExec[
678678
// **before** the query runs. The returns from the fetch are only used to
679679
// assert rbac. The final return of this function comes from the Query function.
680680
funcfetchAndQuery[
681-
ObjectType rbac.Objecter,
682-
ArgumentTypeany,
683-
Fetchfunc(ctx context.Context,argArgumentType) (ObjectType,error),
684-
Queryfunc(ctx context.Context,argArgumentType) (ObjectType,error),
681+
ObjectType rbac.Objecter,
682+
ArgumentTypeany,
683+
Fetchfunc(ctx context.Context,argArgumentType) (ObjectType,error),
684+
Queryfunc(ctx context.Context,argArgumentType) (ObjectType,error),
685685
](
686686
logger slog.Logger,
687687
authorizer rbac.Authorizer,
@@ -715,9 +715,9 @@ func fetchAndQuery[
715715
// fetchWithPostFilter is like fetch, but works with lists of objects.
716716
// SQL filters are much more optimal.
717717
funcfetchWithPostFilter[
718-
ArgumentTypeany,
719-
ObjectType rbac.Objecter,
720-
DatabaseFuncfunc(ctx context.Context,argArgumentType) ([]ObjectType,error),
718+
ArgumentTypeany,
719+
ObjectType rbac.Objecter,
720+
DatabaseFuncfunc(ctx context.Context,argArgumentType) ([]ObjectType,error),
721721
](
722722
authorizer rbac.Authorizer,
723723
action policy.Action,
@@ -3625,10 +3625,10 @@ func (q *querier) InsertPresetParameters(ctx context.Context, arg database.Inser
36253625
returnq.db.InsertPresetParameters(ctx,arg)
36263626
}
36273627

3628-
func (q*querier)InsertPresetPrebuildSchedule(ctx context.Context,arg database.InsertPresetPrebuildScheduleParams) ([]database.TemplateVersionPresetPrebuildSchedule,error) {
3628+
func (q*querier)InsertPresetPrebuildSchedule(ctx context.Context,arg database.InsertPresetPrebuildScheduleParams) (database.TemplateVersionPresetPrebuildSchedule,error) {
36293629
err:=q.authorizeContext(ctx,policy.ActionUpdate,rbac.ResourceTemplate)
36303630
iferr!=nil {
3631-
returnnil,err
3631+
returndatabase.TemplateVersionPresetPrebuildSchedule{},err
36323632
}
36333633

36343634
returnq.db.InsertPresetPrebuildSchedule(ctx,arg)

‎coderd/database/dbgen/dbgen.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,11 +1259,23 @@ func Preset(t testing.TB, db database.Store, seed database.InsertPresetParams) d
12591259
CreatedAt:takeFirst(seed.CreatedAt,dbtime.Now()),
12601260
DesiredInstances:seed.DesiredInstances,
12611261
InvalidateAfterSecs:seed.InvalidateAfterSecs,
1262+
AutoscalingEnabled:seed.AutoscalingEnabled,
1263+
AutoscalingTimezone:seed.AutoscalingTimezone,
12621264
})
12631265
require.NoError(t,err,"insert preset")
12641266
returnpreset
12651267
}
12661268

1269+
funcPresetPrebuildSchedule(t testing.TB,db database.Store,seed database.InsertPresetPrebuildScheduleParams) database.TemplateVersionPresetPrebuildSchedule {
1270+
schedule,err:=db.InsertPresetPrebuildSchedule(genCtx, database.InsertPresetPrebuildScheduleParams{
1271+
PresetID:seed.PresetID,
1272+
CronExpression:seed.CronExpression,
1273+
Instances:seed.Instances,
1274+
})
1275+
require.NoError(t,err,"insert preset")
1276+
returnschedule
1277+
}
1278+
12671279
funcPresetParameter(t testing.TB,db database.Store,seed database.InsertPresetParametersParams) []database.TemplateVersionPresetParameter {
12681280
parameters,err:=db.InsertPresetParameters(genCtx, database.InsertPresetParametersParams{
12691281
TemplateVersionPresetID:takeFirst(seed.TemplateVersionPresetID,uuid.New()),

‎coderd/database/dbmem/dbmem.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9160,10 +9160,10 @@ func (q *FakeQuerier) InsertPresetParameters(_ context.Context, arg database.Ins
91609160
returnpresetParameters,nil
91619161
}
91629162

9163-
func (q*FakeQuerier)InsertPresetPrebuildSchedule(ctx context.Context,arg database.InsertPresetPrebuildScheduleParams) ([]database.TemplateVersionPresetPrebuildSchedule,error) {
9163+
func (q*FakeQuerier)InsertPresetPrebuildSchedule(ctx context.Context,arg database.InsertPresetPrebuildScheduleParams) (database.TemplateVersionPresetPrebuildSchedule,error) {
91649164
err:=validateDatabaseType(arg)
91659165
iferr!=nil {
9166-
returnnil,err
9166+
returndatabase.TemplateVersionPresetPrebuildSchedule{},err
91679167
}
91689168

91699169
panic("not implemented")

‎coderd/database/dbmetrics/querymetrics.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/dbmock/dbmock.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/querier.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries.sql.go

Lines changed: 11 additions & 27 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries/presets.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ SELECT
2929
unnest(@values ::TEXT[])
3030
RETURNING*;
3131

32-
-- name: InsertPresetPrebuildSchedule :many
32+
-- name: InsertPresetPrebuildSchedule :one
3333
INSERT INTO template_version_preset_prebuild_schedules (
3434
preset_id,
3535
cron_expression,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp