|
8 | 8 | "testing"
|
9 | 9 | "time"
|
10 | 10 |
|
| 11 | + "github.com/coder/coder/coderd/database/dbgen" |
| 12 | + |
11 | 13 | "github.com/google/uuid"
|
12 | 14 | "github.com/stretchr/testify/assert"
|
13 | 15 | "github.com/stretchr/testify/require"
|
@@ -555,6 +557,56 @@ func TestWorkspaceByOwnerAndName(t *testing.T) {
|
555 | 557 | })
|
556 | 558 | }
|
557 | 559 |
|
| 560 | +func TestWorkspaceFilterAllStatus(t *testing.T) { |
| 561 | + client, _, api := coderdtest.NewWithAPI(t, &coderdtest.Options{}) |
| 562 | + |
| 563 | + owner := coderdtest.CreateFirstUser(t, client) |
| 564 | + |
| 565 | + file := dbgen.File(t, api.Database, database.File{ |
| 566 | + CreatedBy: owner.UserID, |
| 567 | + }) |
| 568 | + versionJob := dbgen.ProvisionerJob(t, api.Database, database.ProvisionerJob{ |
| 569 | + OrganizationID: owner.OrganizationID, |
| 570 | + InitiatorID: owner.UserID, |
| 571 | + WorkerID: uuid.NullUUID{}, |
| 572 | + FileID: file.ID, |
| 573 | + }) |
| 574 | + version := dbgen.TemplateVersion(t, api.Database, database.TemplateVersion{ |
| 575 | + OrganizationID: owner.OrganizationID, |
| 576 | + JobID: versionJob.ID, |
| 577 | + CreatedBy: owner.UserID, |
| 578 | + }) |
| 579 | + template := dbgen.Template(t, api.Database, database.Template{ |
| 580 | + OrganizationID: owner.OrganizationID, |
| 581 | + ActiveVersionID: version.ID, |
| 582 | + CreatedBy: owner.UserID, |
| 583 | + }) |
| 584 | + |
| 585 | + makeWorkspace := func(workspace database.Workspace) database.Workspace { |
| 586 | + workspace.OwnerID = owner.UserID |
| 587 | + workspace.OrganizationID = owner.OrganizationID |
| 588 | + workspace.TemplateID = template.ID |
| 589 | + workspace = dbgen.Workspace(t, api.Database, workspace) |
| 590 | + |
| 591 | + return workspace |
| 592 | + } |
| 593 | + var _ = makeWorkspace |
| 594 | + //makeWorkspace(database.Workspace{ |
| 595 | + //}) |
| 596 | + |
| 597 | + // pending |
| 598 | + // starting |
| 599 | + // running |
| 600 | + // stopping |
| 601 | + // stopped |
| 602 | + // failed |
| 603 | + // canceling |
| 604 | + // canceled |
| 605 | + // deleted |
| 606 | + // deleting |
| 607 | + |
| 608 | +} |
| 609 | + |
558 | 610 | // TestWorkspaceFilter creates a set of workspaces, users, and organizations
|
559 | 611 | // to run various filters against for testing.
|
560 | 612 | func TestWorkspaceFilter(t *testing.T) {
|
|
0 commit comments