Skip to content

Commit b93321e

Browse files
committed
more tests
1 parent 07c65a9 commit b93321e

File tree

1 file changed

+44
-5
lines changed

1 file changed

+44
-5
lines changed

enterprise/coderd/workspacequota_test.go

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,10 @@ func TestWorkspaceQuota(t *testing.T) {
223223
verifyQuota(ctx, t, client, user.OrganizationID.String(), 0, 4)
224224

225225
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
226-
Parse: echo.ParseComplete,
226+
Parse: echo.ParseComplete,
227+
ProvisionInit: echo.InitComplete,
228+
ProvisionPlan: echo.PlanComplete,
229+
ProvisionApply: echo.ApplyComplete,
227230
ProvisionPlanMap: map[proto.WorkspaceTransition][]*proto.Response{
228231
proto.WorkspaceTransition_START: planWithCost(2),
229232
proto.WorkspaceTransition_STOP: planWithCost(1),
@@ -429,7 +432,16 @@ func TestWorkspaceQuota(t *testing.T) {
429432
// Create a template with a workspace that costs 1 credit
430433
authToken := uuid.NewString()
431434
version := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
432-
Parse: echo.ParseComplete,
435+
Parse: echo.ParseComplete,
436+
ProvisionInit: echo.InitComplete,
437+
ProvisionPlan: []*proto.Response{{
438+
Type: &proto.Response_Plan{
439+
Plan: &proto.PlanComplete{
440+
DailyCost: 1,
441+
},
442+
},
443+
}},
444+
ProvisionApply: echo.ApplyComplete,
433445
ProvisionGraph: []*proto.Response{{
434446
Type: &proto.Response_Graph{
435447
Graph: &proto.GraphComplete{
@@ -465,7 +477,16 @@ func TestWorkspaceQuota(t *testing.T) {
465477

466478
// Test with a template that has zero cost - should pass
467479
versionZeroCost := coderdtest.CreateTemplateVersion(t, client, user.OrganizationID, &echo.Responses{
468-
Parse: echo.ParseComplete,
480+
Parse: echo.ParseComplete,
481+
ProvisionInit: echo.InitComplete,
482+
ProvisionPlan: []*proto.Response{{
483+
Type: &proto.Response_Plan{
484+
Plan: &proto.PlanComplete{
485+
DailyCost: 0,
486+
},
487+
},
488+
}},
489+
ProvisionApply: echo.ApplyComplete,
469490
ProvisionGraph: []*proto.Response{{
470491
Type: &proto.Response_Graph{
471492
Graph: &proto.GraphComplete{
@@ -549,7 +570,16 @@ func TestWorkspaceQuota(t *testing.T) {
549570
// Create templates for both organizations
550571
authToken := uuid.NewString()
551572
version1 := coderdtest.CreateTemplateVersion(t, owner, first.OrganizationID, &echo.Responses{
552-
Parse: echo.ParseComplete,
573+
Parse: echo.ParseComplete,
574+
ProvisionInit: echo.InitComplete,
575+
ProvisionPlan: []*proto.Response{{
576+
Type: &proto.Response_Plan{
577+
Plan: &proto.PlanComplete{
578+
DailyCost: 1,
579+
},
580+
},
581+
}},
582+
ProvisionApply: echo.ApplyComplete,
553583
ProvisionGraph: []*proto.Response{{
554584
Type: &proto.Response_Graph{
555585
Graph: &proto.GraphComplete{
@@ -573,7 +603,16 @@ func TestWorkspaceQuota(t *testing.T) {
573603
template1 := coderdtest.CreateTemplate(t, owner, first.OrganizationID, version1.ID)
574604

575605
version2 := coderdtest.CreateTemplateVersion(t, owner, second.ID, &echo.Responses{
576-
Parse: echo.ParseComplete,
606+
Parse: echo.ParseComplete,
607+
ProvisionInit: echo.InitComplete,
608+
ProvisionPlan: []*proto.Response{{
609+
Type: &proto.Response_Plan{
610+
Plan: &proto.PlanComplete{
611+
DailyCost: 1,
612+
},
613+
},
614+
}},
615+
ProvisionApply: echo.ApplyComplete,
577616
ProvisionGraph: []*proto.Response{{
578617
Type: &proto.Response_Graph{
579618
Graph: &proto.GraphComplete{

0 commit comments

Comments
 (0)