func CheckDelayMsgsWithMsgId()

in golang/utils/CheckUtils.go [55:68]


func CheckDelayMsgsWithMsgId(t *testing.T, sendMsgsCollector *SendMsgsCollector, recvMsgsCollector *RecvMsgsCollector, acceptableVariation float64) {
	CheckMsgsWithMsgId(t, sendMsgsCollector, recvMsgsCollector)
	for i, msg := range sendMsgsCollector.SendMsgs {
		var matchedMsgViews *rmq_client.MessageView
		for j, msgViews := range recvMsgsCollector.RecvMsgViews {
			if sendMsgsCollector.MsgIds[i] == msgViews.GetMessageId() {
				matchedMsgViews = recvMsgsCollector.RecvMsgViews[j]
				break
			}
		}
		assert.Equal(t, msg.GetDeliveryTimestamp(), matchedMsgViews.GetDeliveryTimestamp(), "they should be equal")
		assert.True(t, math.Abs(float64(time.Now().Unix())-float64(msg.GetDeliveryTimestamp().Unix())) < acceptableVariation, "they should be equal")
	}
}