harmonytask lints

This commit is contained in:
Andrew Jackson (Ajax) 2023-08-21 18:02:04 -05:00
parent 6fd468dfc0
commit c7aaa16e03
2 changed files with 4 additions and 9 deletions

View File

@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"sort"
"strings"
"sync"
"testing"
"time"
@ -82,14 +81,9 @@ func TestHarmonyTasks(t *testing.T) {
require.NoError(t, err)
time.Sleep(3 * time.Second) // do the work. FLAKYNESS RISK HERE.
e.GracefullyTerminate(time.Minute)
require.Equal(t, t1.WorkCompleted, 2, "wrong amount of work complete: expected 2 got:")
expected := []string{"taskResult56", "taskResult73"}
sort.Strings(t1.WorkCompleted)
got := strings.Join(t1.WorkCompleted, ",")
expected := "taskResult56,taskResult73"
if got != expected {
t.Fatal("Unexpected results! Wanted " + expected + " got " + got)
}
// TODO test history table looks right.
require.Equal(t, len(t1.WorkCompleted), expected, "unexpected results")
})
}

View File

@ -317,7 +317,8 @@ func (e *TaskEngine) GetHttpHandlers() http.Handler {
s := root.PathPrefix("/scheduler")
f := s.PathPrefix("/follows")
b := s.PathPrefix("/bump")
for name, vs := range e.follows {
for name, vsTmp := range e.follows {
vs := vsTmp
f.Path("/" + name + "/{tID}").Methods("GET").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
tIDString := mux.Vars(r)["tID"]
tID, err := strconv.Atoi(tIDString)