Remove duration from prometheus label

This commit is contained in:
Ming Deng
2020-12-26 21:11:04 +08:00
parent b0406f107a
commit 73d81bafd9
8 changed files with 18 additions and 12 deletions

View File

@@ -157,6 +157,9 @@ func (t *Task) GetSpec(context.Context) string {
func (t *Task) GetStatus(context.Context) string {
var str string
for _, v := range t.Errlist {
if v == nil {
continue
}
str += v.t.String() + ":" + v.errinfo + "<br>"
}
return str

View File

@@ -36,9 +36,11 @@ func TestParse(t *testing.T) {
if err != nil {
t.Fatal(err)
}
assert.Equal(t, "0/30 * * * * *", tk.GetSpec(context.Background()))
m.AddTask("taska", tk)
m.StartTask()
time.Sleep(3 * time.Second)
assert.True(t, len(tk.GetStatus(context.Background())) == 0)
m.StopTask()
}