Skip to content

feat: allow bumping workspace deadline #1828

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 14 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
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
Apply suggestions from code review
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
  • Loading branch information
johnstcn and mafredri authored May 27, 2022
commit 9a45186d5ea79095f66a2ee74b3b7877d94d3135
4 changes: 2 additions & 2 deletions cli/bump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ func TestBump(t *testing.T) {

// When: we execute `coder bump workspace``
err = cmd.ExecuteContext(ctx)
require.NoError(t, err)

// Then: nothing happens and the deadline remains unset
require.NoError(t, err)
updated, err := client.Workspace(ctx, workspace.ID)
require.NoError(t, err)
require.Zero(t, updated.LatestBuild.Deadline)
Expand Down Expand Up @@ -208,9 +208,9 @@ func TestBump(t *testing.T) {

// When: we execute `coder bump workspace 59s`
err = cmd.ExecuteContext(ctx)
require.ErrorContains(t, err, "minimum bump duration is 1 minute")

// Then: an error is reported and the deadline remains as before
require.ErrorContains(t, err, "minimum bump duration is 1 minute")
updated, err := client.Workspace(ctx, workspace.ID)
require.NoError(t, err)
require.WithinDuration(t, workspace.LatestBuild.Deadline, updated.LatestBuild.Deadline, time.Minute)
Expand Down
2 changes: 1 addition & 1 deletion coderd/workspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ func (api *API) putExtendWorkspace(rw http.ResponseWriter, r *http.Request) {
return xerrors.Errorf("new deadline %q must be after existing deadline %q", newDeadline.Format(time.RFC3339), build.Deadline.Format(time.RFC3339))
}

// Disallow updates within than one minute
// Disallow updates within less than one minute
if withinDuration(newDeadline, build.Deadline, time.Minute) {
code = http.StatusNotModified
return nil
Expand Down