Skip to content
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

chore: change survey prompt frequency #7912

Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion pkg/skaffold/survey/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type config struct {
// startsAt mentions the date after the users survey should be prompted. This will ensure, Skaffold team can finalize the survey
// even after release date.
startsAt time.Time
// expiresAt places a time limit of the user survey. As users are only prompted every two weeks
// expiresAt places a time limit of the user survey. As users are only prompted every 5 days
// by design, this time limit should be at least 4 weeks after the upcoming release date to account
// for release propagation lag to Cloud SDK and Cloud Shell.
expiresAt time.Time
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/survey/survey.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ func (s *Runner) recentlyPromptedOrTaken(cfg *sConfig.GlobalConfig) string {
return s.selectSurvey(surveysTaken(cfg.Global.Survey))
}

// recentlyPrompted returns true if the user has been recently prompted for a survey.
// recentlyPrompted returns true if the user has been prompted for a survey in last 5 days.
func recentlyPrompted(gc *sConfig.SurveyConfig) bool {
return timeutil.LessThan(gc.LastPrompted, 10*24*time.Hour)
return timeutil.LessThan(gc.LastPrompted, 5*24*time.Hour)
}

func (s *Runner) DisplaySurveyPrompt(out io.Writer, id string) error {
Expand Down
10 changes: 5 additions & 5 deletions pkg/skaffold/survey/survey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func TestDisplaySurveyForm(t *testing.T) {
}

func TestShouldDisplayPrompt(t *testing.T) {
tenDaysAgo := time.Now().AddDate(0, 0, -10).Format(time.RFC3339)
fiveDaysAgo := time.Now().AddDate(0, 0, -5).Format(time.RFC3339)
threeDaysAgo := time.Now().AddDate(0, 0, -3).Format(time.RFC3339)
// less than 90 days ago
twoMonthsAgo := time.Now().AddDate(0, -2, -5).Format(time.RFC3339)
// at least 90 days ago
Expand All @@ -86,12 +86,12 @@ func TestShouldDisplayPrompt(t *testing.T) {
}},
},
{
description: "should not display prompt when last prompted is less than 2 weeks",
description: "should not display prompt when last prompted is less than 5 days",
cfg: &sConfig.GlobalConfig{
Global: &sConfig.ContextConfig{
Survey: &sConfig.SurveyConfig{
DisablePrompt: util.BoolPtr(false),
LastPrompted: fiveDaysAgo,
LastPrompted: threeDaysAgo,
}},
},
},
Expand All @@ -106,12 +106,12 @@ func TestShouldDisplayPrompt(t *testing.T) {
},
},
{
description: "should display prompt when last prompted is before 2 weeks",
description: "should display prompt when last prompted is before 5 days",
cfg: &sConfig.GlobalConfig{
Global: &sConfig.ContextConfig{
Survey: &sConfig.SurveyConfig{
DisablePrompt: util.BoolPtr(false),
LastPrompted: tenDaysAgo,
LastPrompted: fiveDaysAgo,
}},
},
expected: true,
Expand Down