Skip to content

Commit d573c67

Browse files
test: get tests compiling
1 parent d54f6c3 commit d573c67

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

agent/agenttest/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@ func (f *FakeAgentAPI) BatchCreateLogs(ctx context.Context, req *agentproto.Batc
301301
return &agentproto.BatchCreateLogsResponse{}, nil
302302
}
303303

304+
func (f *FakeAgentAPI) ScriptCompleted(ctx context.Context, req *agentproto.WorkspaceAgentScriptCompletedRequest) (*agentproto.WorkspaceAgentScriptCompletedResponse, error) {
305+
return &agentproto.WorkspaceAgentScriptCompletedResponse{}, nil
306+
}
307+
304308
func NewFakeAgentAPI(t testing.TB, logger slog.Logger, manifest *agentproto.Manifest, statsCh chan *agentproto.Stats) *FakeAgentAPI {
305309
return &FakeAgentAPI{
306310
t: t,

coderd/database/dbauthz/dbauthz.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3028,8 +3028,9 @@ func (q *querier) InsertWorkspaceAgentMetadata(ctx context.Context, arg database
30283028
}
30293029

30303030
func (q *querier) InsertWorkspaceAgentScriptTimings(ctx context.Context, arg database.InsertWorkspaceAgentScriptTimingsParams) (database.WorkspaceAgentScriptTiming, error) {
3031-
// TODO: I have no idea what to add here.
3032-
3031+
// if err := q.authorizeContext(ctx, policy.ActionCreate, rbac.ResourceSystem); err != nil {
3032+
// return nil, err
3033+
// }
30333034
return q.db.InsertWorkspaceAgentScriptTimings(ctx, arg)
30343035
}
30353036

coderd/database/dbauthz/dbauthz_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,6 +2632,12 @@ func (s *MethodTestSuite) TestSystemFunctions() {
26322632
s.Run("InsertWorkspaceAppStats", s.Subtest(func(db database.Store, check *expects) {
26332633
check.Args(database.InsertWorkspaceAppStatsParams{}).Asserts(rbac.ResourceSystem, policy.ActionCreate)
26342634
}))
2635+
s.Run("InsertWorkspaceAgentScriptTimings", s.Subtest(func(db database.Store, check *expects) {
2636+
j := dbgen.ProvisionerJob(s.T(), db, nil, database.ProvisionerJob{})
2637+
check.Args(database.InsertWorkspaceAgentScriptTimingsParams{
2638+
JobID: j.ID,
2639+
}).Asserts( /* rbac.ResourceSystem, policy.ActionCreate */ )
2640+
}))
26352641
s.Run("InsertWorkspaceAgentScripts", s.Subtest(func(db database.Store, check *expects) {
26362642
check.Args(database.InsertWorkspaceAgentScriptsParams{}).Asserts(rbac.ResourceSystem, policy.ActionCreate)
26372643
}))

0 commit comments

Comments
 (0)