Skip to content

Commit

Permalink
Fix atscfg gen to print date as UTC (apache#4163)
Browse files Browse the repository at this point in the history
Matches old Perl config file generation.
  • Loading branch information
rob05c authored and ocket8888 committed Dec 5, 2019
1 parent d153e8b commit af9a8d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/go-atscfg/atscfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (s *ServerInfo) IsTopLevelCache() bool {
}

func HeaderCommentWithTOVersionStr(name string, nameVersionStr string) string {
return "# DO NOT EDIT - Generated for " + name + " by " + nameVersionStr + " on " + time.Now().Format(HeaderCommentDateFormat) + "\n"
return "# DO NOT EDIT - Generated for " + name + " by " + nameVersionStr + " on " + time.Now().UTC().Format(HeaderCommentDateFormat) + "\n"
}

func GetNameVersionStringFromToolNameAndURL(toolName string, url string) string {
Expand Down
11 changes: 11 additions & 0 deletions lib/go-atscfg/atscfg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,14 @@ func TestGetConfigFile(t *testing.T) {
t.Errorf("Expected %s. Got %s", expected, cfgFile)
}
}

func TestHeaderCommentUTC(t *testing.T) {
objName := "foo"
toolName := "bar"
toURL := "url"

txt := GenericHeaderComment(objName, toolName, toURL)
if !strings.Contains(txt, " UTC ") {
t.Error("Expected header comment to print time in UTC, actual '" + txt + "'")
}
}

0 comments on commit af9a8d6

Please sign in to comment.