- Notifications
You must be signed in to change notification settings - Fork928
feat: show dormant workspaces by default#11053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
1295934
452f00c
dc9efe7
838569a
26280a6
f0e7b0b
2491d39
b15bcb7
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1503,43 +1503,50 @@ func TestWorkspaceFilterManual(t *testing.T) { | ||
}, testutil.IntervalMedium, "agent status timeout") | ||
}) | ||
t.Run("Dormant", func(t *testing.T) { | ||
// this test has a licensed counterpart in enterprise/coderd/workspaces_test.go: FilterQueryHasDeletingByAndLicensed | ||
t.Parallel() | ||
client, db := coderdtest.NewWithDatabase(t, nil) | ||
user := coderdtest.CreateFirstUser(t, client) | ||
template := dbfake.TemplateVersion(t, db).Seed(database.TemplateVersion{ | ||
OrganizationID: user.OrganizationID, | ||
CreatedBy: user.UserID, | ||
}).Do().Template | ||
// update template with inactivity ttl | ||
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong) | ||
defer cancel() | ||
dormantWorkspace := dbfake.WorkspaceBuild(t, db, database.Workspace{ | ||
TemplateID: template.ID, | ||
OwnerID: user.UserID, | ||
OrganizationID: user.OrganizationID, | ||
}).Do().Workspace | ||
// Create another workspace to validate that we do not return active workspaces. | ||
sreya marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
_ = dbfake.WorkspaceBuild(t, db, database.Workspace{ | ||
TemplateID: template.ID, | ||
OwnerID: user.UserID, | ||
OrganizationID: user.OrganizationID, | ||
}).Do() | ||
err := client.UpdateWorkspaceDormancy(ctx, dormantWorkspace.ID, codersdk.UpdateWorkspaceDormancy{ | ||
Dormant: true, | ||
}) | ||
require.NoError(t, err) | ||
// Test that no filter returns both workspaces. | ||
res, err := client.Workspaces(ctx, codersdk.WorkspaceFilter{}) | ||
require.NoError(t, err) | ||
require.Len(t, res.Workspaces, 2) | ||
// Test that filtering for dormant only returns our dormant workspace. | ||
res, err = client.Workspaces(ctx, codersdk.WorkspaceFilter{ | ||
FilterQuery: "dormant:true", | ||
}) | ||
require.NoError(t, err) | ||
require.Len(t, res.Workspaces, 1) | ||
require.Equal(t, dormantWorkspace.ID, res.Workspaces[0].ID) | ||
require.NotNil(t, res.Workspaces[0].DormantAt) | ||
}) | ||
Uh oh!
There was an error while loading.Please reload this page.