Skip to content

feat: update workspace deadline when workspace ttl updated #2165

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jun 9, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
hopefully fix unit tests
  • Loading branch information
johnstcn committed Jun 9, 2022
commit 85da57bdc4753821b11adc762e1d66f72462510c
7 changes: 4 additions & 3 deletions coderd/workspaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ func TestWorkspaceUpdateTTL(t *testing.T) {
name: "update ttl",
ttlMillis: ptr.Ref(12 * time.Hour.Milliseconds()),
expectedError: "",
expectedDeadline: ptr.Ref(time.Now().Add(12 * time.Hour)),
expectedDeadline: ptr.Ref(time.Now().Add(12*time.Hour + time.Minute)),
},
{
name: "below minimum ttl",
Expand All @@ -635,13 +635,13 @@ func TestWorkspaceUpdateTTL(t *testing.T) {
name: "minimum ttl",
ttlMillis: ptr.Ref(time.Minute.Milliseconds()),
expectedError: "",
expectedDeadline: ptr.Ref(time.Now().Add(time.Minute)),
expectedDeadline: ptr.Ref(time.Now().Add(2 * time.Minute)),
},
{
name: "maximum ttl",
ttlMillis: ptr.Ref((24 * 7 * time.Hour).Milliseconds()),
expectedError: "",
expectedDeadline: ptr.Ref(time.Now().Add(24 * 7 * time.Hour)),
expectedDeadline: ptr.Ref(time.Now().Add(24*7*time.Hour + time.Minute)),
},
{
name: "above maximum ttl",
Expand Down Expand Up @@ -676,6 +676,7 @@ func TestWorkspaceUpdateTTL(t *testing.T) {
cwr.AutostartSchedule = nil
cwr.TTLMillis = nil
})
_ = coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)
)

err := client.UpdateWorkspaceTTL(ctx, workspace.ID, codersdk.UpdateWorkspaceTTLRequest{
Expand Down