mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
feat(site): increase TTL and max TTL validation to 30 days (#8258)
Co-authored-by: Dean Sheather <dean@deansheather.com>
This commit is contained in:
@ -1,2 +1,5 @@
|
||||
-- Set a cap of 7 days on template max_ttl
|
||||
--
|
||||
-- NOTE: this migration was added in August 2022, but the cap has been changed
|
||||
-- to 30 days in July 2023.
|
||||
UPDATE templates SET max_ttl = 604800000000000 WHERE max_ttl > 604800000000000;
|
||||
|
@ -32,10 +32,10 @@ import (
|
||||
|
||||
var (
|
||||
ttlMin = time.Minute //nolint:revive // min here means 'minimum' not 'minutes'
|
||||
ttlMax = 7 * 24 * time.Hour
|
||||
ttlMax = 30 * 24 * time.Hour
|
||||
|
||||
errTTLMin = xerrors.New("time until shutdown must be at least one minute")
|
||||
errTTLMax = xerrors.New("time until shutdown must be less than 7 days")
|
||||
errTTLMax = xerrors.New("time until shutdown must be less than 30 days")
|
||||
errDeadlineTooSoon = xerrors.New("new deadline must be at least 30 minutes in the future")
|
||||
errDeadlineBeforeStart = xerrors.New("new deadline must be before workspace start time")
|
||||
)
|
||||
|
@ -1837,13 +1837,13 @@ func TestWorkspaceUpdateTTL(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "maximum ttl",
|
||||
ttlMillis: ptr.Ref((24 * 7 * time.Hour).Milliseconds()),
|
||||
ttlMillis: ptr.Ref((24 * 30 * time.Hour).Milliseconds()),
|
||||
expectedError: "",
|
||||
},
|
||||
{
|
||||
name: "above maximum ttl",
|
||||
ttlMillis: ptr.Ref((24*7*time.Hour + time.Minute).Milliseconds()),
|
||||
expectedError: "time until shutdown must be less than 7 days",
|
||||
ttlMillis: ptr.Ref((24*30*time.Hour + time.Minute).Milliseconds()),
|
||||
expectedError: "time until shutdown must be less than 30 days",
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user