fix(task/executor): Use correct name for last success time extern (#19435)

* fix(task/executor): Use correct name for last success time extern.

* chore(tasks/executor): Don't reuse this constant in the tests. Test the name.
pull/19432/head
Brett Buddin 2020-08-25 17:32:36 -04:00 committed by GitHub
parent 1ae2541bf3
commit fde2129002
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -25,8 +25,7 @@ const (
maxPromises = 1000 maxPromises = 1000
defaultMaxWorkers = 100 defaultMaxWorkers = 100
latestSuccessOption = "tasks.latestSuccessTime" lastSuccessOption = "tasks.lastSuccessTime"
latestFailureOption = "tasks.latestFailureTime"
) )
var _ scheduler.Executor = (*Executor)(nil) var _ scheduler.Executor = (*Executor)(nil)
@ -90,7 +89,7 @@ func (ts CompilerBuilderTimestamps) Extern() *ast.File {
if !ts.LatestSuccess.IsZero() { if !ts.LatestSuccess.IsZero() {
body = append(body, &ast.OptionStatement{ body = append(body, &ast.OptionStatement{
Assignment: &ast.VariableAssignment{ Assignment: &ast.VariableAssignment{
ID: &ast.Identifier{Name: latestSuccessOption}, ID: &ast.Identifier{Name: lastSuccessOption},
Init: &ast.DateTimeLiteral{ Init: &ast.DateTimeLiteral{
Value: ts.LatestSuccess, Value: ts.LatestSuccess,
}, },

View File

@ -189,7 +189,7 @@ func TestTaskExecutor_QuerySuccessWithExternInjection(t *testing.T) {
extern := &ast.File{ extern := &ast.File{
Body: []ast.Statement{&ast.OptionStatement{ Body: []ast.Statement{&ast.OptionStatement{
Assignment: &ast.VariableAssignment{ Assignment: &ast.VariableAssignment{
ID: &ast.Identifier{Name: latestSuccessOption}, ID: &ast.Identifier{Name: "tasks.lastSuccessTime"},
Init: &ast.DateTimeLiteral{ Init: &ast.DateTimeLiteral{
Value: latestSuccess, Value: latestSuccess,
}, },