From 50df107ace5d4f3f4c819d3b3c5cc89fc69709a7 Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Mon, 22 Jun 2020 05:55:04 -0700 Subject: [PATCH] Clean up processor test --- processor_test.go | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/processor_test.go b/processor_test.go index 7a7c8a0..0b7183b 100644 --- a/processor_test.go +++ b/processor_test.go @@ -215,19 +215,6 @@ func TestProcessorRetry(t *testing.T) { m4 := h.NewTaskMessage("sync", nil) errMsg := "something went wrong" - // r* is m* after retry - r1 := *m1 - r1.ErrorMsg = errMsg - r2 := *m2 - r2.ErrorMsg = errMsg - r2.Retried = m2.Retried + 1 - r3 := *m3 - r3.ErrorMsg = errMsg - r3.Retried = m3.Retried + 1 - r4 := *m4 - r4.ErrorMsg = errMsg - r4.Retried = m4.Retried + 1 - now := time.Now() tests := []struct { @@ -249,11 +236,11 @@ func TestProcessorRetry(t *testing.T) { }), wait: 2 * time.Second, wantRetry: []h.ZSetEntry{ - {Msg: &r2, Score: float64(now.Add(time.Minute).Unix())}, - {Msg: &r3, Score: float64(now.Add(time.Minute).Unix())}, - {Msg: &r4, Score: float64(now.Add(time.Minute).Unix())}, + {Msg: h.TaskMessageAfterRetry(*m2, errMsg), Score: float64(now.Add(time.Minute).Unix())}, + {Msg: h.TaskMessageAfterRetry(*m3, errMsg), Score: float64(now.Add(time.Minute).Unix())}, + {Msg: h.TaskMessageAfterRetry(*m4, errMsg), Score: float64(now.Add(time.Minute).Unix())}, }, - wantDead: []*base.TaskMessage{&r1}, + wantDead: []*base.TaskMessage{h.TaskMessageWithError(*m1, errMsg)}, wantErrCount: 4, }, }