|
|
@ -94,3 +94,26 @@ func TestInflightMessageTracker2(t *testing.T) { |
|
|
|
assert.Equal(t, int64(2), tracker.GetOldestAckedTimestamp()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func TestInflightMessageTracker3(t *testing.T) { |
|
|
|
// Initialize an InflightMessageTracker with initial capacity 1
|
|
|
|
tracker := NewInflightMessageTracker(1) |
|
|
|
|
|
|
|
tracker.EnflightMessage([]byte("1"), int64(1)) |
|
|
|
tracker.EnflightMessage([]byte("2"), int64(2)) |
|
|
|
tracker.EnflightMessage([]byte("3"), int64(3)) |
|
|
|
assert.True(t, tracker.AcknowledgeMessage([]byte("1"), int64(1))) |
|
|
|
tracker.EnflightMessage([]byte("4"), int64(4)) |
|
|
|
tracker.EnflightMessage([]byte("5"), int64(5)) |
|
|
|
assert.True(t, tracker.AcknowledgeMessage([]byte("2"), int64(2))) |
|
|
|
assert.True(t, tracker.AcknowledgeMessage([]byte("3"), int64(3))) |
|
|
|
tracker.EnflightMessage([]byte("6"), int64(6)) |
|
|
|
tracker.EnflightMessage([]byte("7"), int64(7)) |
|
|
|
assert.True(t, tracker.AcknowledgeMessage([]byte("4"), int64(4))) |
|
|
|
assert.True(t, tracker.AcknowledgeMessage([]byte("5"), int64(5))) |
|
|
|
assert.True(t, tracker.AcknowledgeMessage([]byte("6"), int64(6))) |
|
|
|
assert.Equal(t, int64(6), tracker.GetOldestAckedTimestamp()) |
|
|
|
assert.True(t, tracker.AcknowledgeMessage([]byte("7"), int64(7))) |
|
|
|
assert.Equal(t, int64(7), tracker.GetOldestAckedTimestamp()) |
|
|
|
|
|
|
|
} |