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

Commitb030d47

Browse files
committed
Fix tests
1 parent2c61e81 commitb030d47

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed
File renamed without changes.

‎coderd/provisionerdserver/provisionerdserver.go‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,23 @@ func (server *Server) AcquireJob(ctx context.Context, _ *proto.Empty) (*proto.Ac
255255
}
256256

257257
func (server*Server)CommitQuota(ctx context.Context,request*proto.CommitQuotaRequest) (*proto.CommitQuotaResponse,error) {
258+
jobID,err:=uuid.Parse(request.JobId)
259+
iferr!=nil {
260+
returnnil,xerrors.Errorf("parse job id: %w",err)
261+
}
262+
263+
job,err:=server.Database.GetProvisionerJobByID(ctx,jobID)
264+
iferr!=nil {
265+
returnnil,xerrors.Errorf("get job: %w",err)
266+
}
267+
if!job.WorkerID.Valid {
268+
returnnil,xerrors.New("job isn't running yet")
269+
}
270+
271+
ifjob.WorkerID.UUID.String()!=server.ID.String() {
272+
returnnil,xerrors.New("you don't own this job")
273+
}
274+
258275
q:=server.QuotaCommitter.Load()
259276
ifq==nil {
260277
// We're probably in community edition or a test.
File renamed without changes.

‎enterprise/coderd/coderd.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ func (api *API) updateEntitlements(ctx context.Context) error {
264264

265265
ifchanged,enabled:=featureChanged(codersdk.FeatureTemplateRBAC);changed {
266266
ifenabled {
267-
committer:=Committer{Database:api.Database}
267+
committer:=committer{Database:api.Database}
268268
ptr:=proto.QuotaCommitter(&committer)
269269
api.AGPL.QuotaCommitter.Store(&ptr)
270270
}else {

‎enterprise/coderd/workspacequota.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import (
1616
"github.com/coder/coder/provisionerd/proto"
1717
)
1818

19-
typeCommitterstruct {
19+
typecommitterstruct {
2020
Database database.Store
2121
}
2222

23-
func (c*Committer)CommitQuota(
23+
func (c*committer)CommitQuota(
2424
ctx context.Context,request*proto.CommitQuotaRequest,
2525
) (*proto.CommitQuotaResponse,error) {
2626
jobID,err:=uuid.Parse(request.JobId)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp