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

Commit2c87d09

Browse files
committed
remove unnecessaryily added query, it duplicated an existing query, and
fix testsSigned-off-by: Callum Styan <callumstyan@gmail.com>
1 parent25d7864 commit2c87d09

File tree

8 files changed

+11
-124
lines changed

8 files changed

+11
-124
lines changed

‎coderd/database/dbauthz/dbauthz.go‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3545,13 +3545,6 @@ func (q *querier) GetWorkspaceAgentsByWorkspaceAndBuildNumber(ctx context.Contex
35453545
returnq.db.GetWorkspaceAgentsByWorkspaceAndBuildNumber(ctx,arg)
35463546
}
35473547

3548-
func (q*querier)GetWorkspaceAgentsByWorkspaceIDAndBuildNumber(ctx context.Context,arg database.GetWorkspaceAgentsByWorkspaceIDAndBuildNumberParams) ([]database.WorkspaceAgent,error) {
3549-
iferr:=q.authorizeContext(ctx,policy.ActionRead,rbac.ResourceSystem);err!=nil {
3550-
returnnil,err
3551-
}
3552-
returnq.db.GetWorkspaceAgentsByWorkspaceIDAndBuildNumber(ctx,arg)
3553-
}
3554-
35553548
func (q*querier)GetWorkspaceAgentsCreatedAfter(ctx context.Context,createdAt time.Time) ([]database.WorkspaceAgent,error) {
35563549
iferr:=q.authorizeContext(ctx,policy.ActionRead,rbac.ResourceSystem);err!=nil {
35573550
returnnil,err

‎coderd/database/dbauthz/dbauthz_test.go‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,6 +1689,15 @@ func (s *MethodTestSuite) TestWorkspace() {
16891689
// No asserts here because SQLFilter.
16901690
check.Args(arg).Asserts()
16911691
}))
1692+
s.Run("GetWorkspacesForAgentMetrics",s.Mocked(func(dbm*dbmock.MockStore,faker*gofakeit.Faker,check*expects) {
1693+
row:=testutil.Fake(s.T(),faker, database.GetWorkspacesForAgentMetricsRow{})
1694+
dbm.EXPECT().GetWorkspacesForAgentMetrics(gomock.Any(),false).Return([]database.GetWorkspacesForAgentMetricsRow{row},nil).AnyTimes()
1695+
check.Args(false).Asserts(rbac.ResourceSystem,policy.ActionRead).Returns([]database.GetWorkspacesForAgentMetricsRow{row})
1696+
}))
1697+
s.Run("GetWorkspacesForWorkspaceMetrics",s.Mocked(func(dbm*dbmock.MockStore,_*gofakeit.Faker,check*expects) {
1698+
dbm.EXPECT().GetWorkspacesForWorkspaceMetrics(gomock.Any(),false).Return([]database.GetWorkspacesForWorkspaceMetricsRow{},nil).AnyTimes()
1699+
check.Args(false).Asserts(rbac.ResourceSystem,policy.ActionRead)
1700+
}))
16921701
s.Run("GetAuthorizedWorkspaces",s.Mocked(func(dbm*dbmock.MockStore,_*gofakeit.Faker,check*expects) {
16931702
arg:= database.GetWorkspacesParams{}
16941703
dbm.EXPECT().GetAuthorizedWorkspaces(gomock.Any(),arg,gomock.Any()).Return([]database.GetWorkspacesRow{},nil).AnyTimes()

‎coderd/database/dbmetrics/querymetrics.go‎

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

‎coderd/database/dbmock/dbmock.go‎

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

‎coderd/database/querier.go‎

Lines changed: 0 additions & 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: 0 additions & 78 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries/workspaceagents.sql‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -365,17 +365,3 @@ WHERE
365365
id= $1
366366
AND parent_idIS NOT NULL
367367
AND deleted= FALSE;
368-
369-
-- name: GetWorkspaceAgentsByWorkspaceIDAndBuildNumber :many
370-
SELECT
371-
workspace_agents.*
372-
FROM
373-
workspace_agents
374-
JOIN
375-
workspace_resourcesONworkspace_agents.resource_id=workspace_resources.id
376-
JOIN
377-
workspace_buildsONworkspace_resources.job_id=workspace_builds.job_id
378-
WHERE
379-
workspace_builds.workspace_id= @workspace_id :: uuid
380-
ANDworkspace_builds.build_number= @build_number ::integer
381-
ANDworkspace_agents.deleted= FALSE;

‎coderd/prometheusmetrics/prometheusmetrics.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ func Agents(ctx context.Context, logger slog.Logger, registerer prometheus.Regis
357357
templateVersionName="unknown"
358358
}
359359

360-
agents,err:=db.GetWorkspaceAgentsByWorkspaceIDAndBuildNumber(ctx,
361-
database.GetWorkspaceAgentsByWorkspaceIDAndBuildNumberParams{
360+
agents,err:=db.GetWorkspaceAgentsByWorkspaceAndBuildNumber(ctx,
361+
database.GetWorkspaceAgentsByWorkspaceAndBuildNumberParams{
362362
WorkspaceID:workspace.ID,
363363
BuildNumber:workspace.BuildNumber,
364364
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp