Skip to content

Commit

Permalink
Increase the duration between survey prompts (#4626)
Browse files Browse the repository at this point in the history
* Increase survey times

* Use correct constant

* Update tests

* Use 2-digit month format

* Update pkg/skaffold/config/util_test.go

Co-authored-by: Brian de Alwis <bsd@acm.org>

Co-authored-by: Brian de Alwis <bsd@acm.org>
  • Loading branch information
tstromberg and briandealwis authored Sep 17, 2020
1 parent 24caea9 commit b938b5d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions pkg/skaffold/config/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ import (
const (
defaultConfigDir = ".skaffold"
defaultConfigFile = "config"
tenDays = time.Hour * 24 * 10
threeMonths = time.Hour * 24 * 90
)

var (
Expand Down Expand Up @@ -316,7 +314,7 @@ func recentlyPromptedOrTaken(cfg *ContextConfig) bool {
if cfg == nil || cfg.Survey == nil {
return false
}
return lessThan(cfg.Survey.LastTaken, threeMonths) || lessThan(cfg.Survey.LastPrompted, tenDays)
return lessThan(cfg.Survey.LastTaken, 365*24*time.Hour) || lessThan(cfg.Survey.LastPrompted, 60*24*time.Hour)
}

func lessThan(date string, duration time.Duration) bool {
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/config/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,11 @@ func TestShouldDisplayPrompt(t *testing.T) {
},
},
{
description: "should display prompt when last prompted is before 2 weeks",
description: "should display prompt when last prompted is older than 3 months",
cfg: &ContextConfig{
Survey: &SurveyConfig{
DisablePrompt: util.BoolPtr(false),
LastPrompted: "2019-01-10T00:00:00Z",
LastPrompted: "2018-09-10T00:00:00Z",
},
},
expected: true,
Expand Down

0 comments on commit b938b5d

Please sign in to comment.