Skip to content

Commit

Permalink
revert not required
Browse files Browse the repository at this point in the history
  • Loading branch information
tejal29 committed Jul 11, 2021
1 parent 402753b commit ef9f309
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
11 changes: 2 additions & 9 deletions pkg/skaffold/config/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,7 @@ func lessThan(date string, duration time.Duration) bool {
return current().Sub(t) < duration
}

func UpdateGlobalSurveyTaken(configFile string, id string) error {
if id != constants.HaTS {
return fmt.Errorf("unexpected survey id %q. Please report an issue at "+constants.GithubIssueLink, id)
}

func UpdateGlobalSurveyTaken(configFile string) error {
// Today's date
today := current().Format(time.RFC3339)
ai := fmt.Sprintf(updateLastTaken, today)
Expand Down Expand Up @@ -404,10 +400,7 @@ func UpdateGlobalSurveyTaken(configFile string, id string) error {
return err
}

func UpdateGlobalSurveyPrompted(configFile string, id string) error {
if id != constants.HaTS {
return fmt.Errorf("unexpected survey id %q. Please report an issue at "+constants.GithubIssueLink, id)
}
func UpdateGlobalSurveyPrompted(configFile string) error {
// Today's date
today := current().Format(time.RFC3339)
ai := fmt.Sprintf(updateLastPrompted, today)
Expand Down
5 changes: 2 additions & 3 deletions pkg/skaffold/config/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"time"

"github.com/GoogleContainerTools/skaffold/pkg/skaffold/cluster"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/constants"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/util"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/yaml"
"github.com/GoogleContainerTools/skaffold/testutil"
Expand Down Expand Up @@ -694,7 +693,7 @@ kubeContexts: []`,
})

// update the time
err := UpdateGlobalSurveyTaken(cfg, constants.HaTS)
err := UpdateGlobalSurveyTaken(cfg)
t.CheckNoError(err)

actualConfig, cfgErr := ReadConfigFile(cfg)
Expand Down Expand Up @@ -754,7 +753,7 @@ kubeContexts: []`,
})

// update the time
err := UpdateGlobalSurveyPrompted(cfg, constants.HaTS)
err := UpdateGlobalSurveyPrompted(cfg)
t.CheckNoError(err)

actualConfig, cfgErr := ReadConfigFile(cfg)
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 @@ -60,7 +60,7 @@ func (s *Runner) DisplaySurveyPrompt(out io.Writer) error {
if isStdOut(out) {
output.Green.Fprintf(out, hats.prompt())
}
return updateConfig(s.configFile, hats.id)
return updateConfig(s.configFile)
}

func (s *Runner) OpenSurveyForm(_ context.Context, out io.Writer, id string) error {
Expand All @@ -78,5 +78,5 @@ func (s *Runner) OpenSurveyForm(_ context.Context, out io.Writer, id string) err
}
// Currently we will only update the global survey taken
// When prompting for the survey, we need to use the same field.
return sConfig.UpdateGlobalSurveyTaken(s.configFile, id)
return sConfig.UpdateGlobalSurveyTaken(s.configFile)
}
2 changes: 1 addition & 1 deletion pkg/skaffold/survey/survey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestDisplaySurveyForm(t *testing.T) {
t.Override(&isStdOut, mock)
mockOpen := func(string) error { return nil }
t.Override(&open, mockOpen)
t.Override(&updateConfig, func(_, _ string) error { return nil })
t.Override(&updateConfig, func(_ string) error { return nil })
var buf bytes.Buffer
New("test").DisplaySurveyPrompt(&buf)
t.CheckDeepEqual(test.expected, buf.String())
Expand Down

0 comments on commit ef9f309

Please sign in to comment.