From c7aaa16e03136f046242b81ac76090e233ee7ab1 Mon Sep 17 00:00:00 2001 From: "Andrew Jackson (Ajax)" Date: Mon, 21 Aug 2023 18:02:04 -0500 Subject: [PATCH] harmonytask lints --- itests/harmonytask_test.go | 10 ++-------- lib/harmony/harmonytask/harmonytask.go | 3 ++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/itests/harmonytask_test.go b/itests/harmonytask_test.go index cd8c09818..979d277d4 100644 --- a/itests/harmonytask_test.go +++ b/itests/harmonytask_test.go @@ -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") }) } diff --git a/lib/harmony/harmonytask/harmonytask.go b/lib/harmony/harmonytask/harmonytask.go index eefe5b8a0..8e5c89e26 100644 --- a/lib/harmony/harmonytask/harmonytask.go +++ b/lib/harmony/harmonytask/harmonytask.go @@ -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)