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

Commit2974bfc

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

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
@@ -3433,13 +3433,6 @@ func (q *querier) GetWorkspaceAgentsByWorkspaceAndBuildNumber(ctx context.Contex
34333433
returnq.db.GetWorkspaceAgentsByWorkspaceAndBuildNumber(ctx,arg)
34343434
}
34353435

3436-
func (q*querier)GetWorkspaceAgentsByWorkspaceIDAndBuildNumber(ctx context.Context,arg database.GetWorkspaceAgentsByWorkspaceIDAndBuildNumberParams) ([]database.WorkspaceAgent,error) {
3437-
iferr:=q.authorizeContext(ctx,policy.ActionRead,rbac.ResourceSystem);err!=nil {
3438-
returnnil,err
3439-
}
3440-
returnq.db.GetWorkspaceAgentsByWorkspaceIDAndBuildNumber(ctx,arg)
3441-
}
3442-
34433436
func (q*querier)GetWorkspaceAgentsCreatedAfter(ctx context.Context,createdAt time.Time) ([]database.WorkspaceAgent,error) {
34443437
iferr:=q.authorizeContext(ctx,policy.ActionRead,rbac.ResourceSystem);err!=nil {
34453438
returnnil,err

‎coderd/database/dbauthz/dbauthz_test.go‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,6 +1656,15 @@ func (s *MethodTestSuite) TestWorkspace() {
16561656
// No asserts here because SQLFilter.
16571657
check.Args(arg).Asserts()
16581658
}))
1659+
s.Run("GetWorkspacesForAgentMetrics",s.Mocked(func(dbm*dbmock.MockStore,faker*gofakeit.Faker,check*expects) {
1660+
row:=testutil.Fake(s.T(),faker, database.GetWorkspacesForAgentMetricsRow{})
1661+
dbm.EXPECT().GetWorkspacesForAgentMetrics(gomock.Any(),false).Return([]database.GetWorkspacesForAgentMetricsRow{row},nil).AnyTimes()
1662+
check.Args(false).Asserts(rbac.ResourceSystem,policy.ActionRead).Returns([]database.GetWorkspacesForAgentMetricsRow{row})
1663+
}))
1664+
s.Run("GetWorkspacesForWorkspaceMetrics",s.Mocked(func(dbm*dbmock.MockStore,_*gofakeit.Faker,check*expects) {
1665+
dbm.EXPECT().GetWorkspacesForWorkspaceMetrics(gomock.Any(),false).Return([]database.GetWorkspacesForWorkspaceMetricsRow{},nil).AnyTimes()
1666+
check.Args(false).Asserts(rbac.ResourceSystem,policy.ActionRead)
1667+
}))
16591668
s.Run("GetAuthorizedWorkspaces",s.Mocked(func(dbm*dbmock.MockStore,_*gofakeit.Faker,check*expects) {
16601669
arg:= database.GetWorkspacesParams{}
16611670
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