Skip to content

Commit

Permalink
[Disk Manager] fix expected/actual order in inflight_queue_test.go (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
SvartMetal authored May 14, 2024
1 parent ae7b9b0 commit 4ed8545
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cloud/disk_manager/internal/pkg/common/inflight_queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,36 +91,36 @@ func TestInflightQueueMilestone(t *testing.T) {
}
}

require.Equal(t, queue.Milestone(), Milestone{Value: 10, ProcessedValueCount: expectedProcessedValueCount})
require.Equal(t, Milestone{Value: 10, ProcessedValueCount: expectedProcessedValueCount}, queue.Milestone())

queue.Add(ctx, 10)
require.Equal(t, queue.Milestone(), Milestone{Value: 10, ProcessedValueCount: expectedProcessedValueCount})
require.Equal(t, Milestone{Value: 10, ProcessedValueCount: expectedProcessedValueCount}, queue.Milestone())
sendProcessedValue(10)
require.Equal(t, queue.Milestone(), Milestone{Value: 11, ProcessedValueCount: expectedProcessedValueCount})
require.Equal(t, Milestone{Value: 11, ProcessedValueCount: expectedProcessedValueCount}, queue.Milestone())

queue.Add(ctx, 13)
queue.Add(ctx, 15)
queue.Add(ctx, 16)
sendProcessedValue(13)
require.Equal(t, queue.Milestone(), Milestone{Value: 15, ProcessedValueCount: expectedProcessedValueCount})
require.Equal(t, Milestone{Value: 15, ProcessedValueCount: expectedProcessedValueCount}, queue.Milestone())
sendProcessedValue(15)
require.Equal(t, queue.Milestone(), Milestone{Value: 16, ProcessedValueCount: expectedProcessedValueCount})
require.Equal(t, Milestone{Value: 16, ProcessedValueCount: expectedProcessedValueCount}, queue.Milestone())
sendProcessedValue(16)
require.Equal(t, queue.Milestone(), Milestone{Value: 17, ProcessedValueCount: expectedProcessedValueCount})
require.Equal(t, Milestone{Value: 17, ProcessedValueCount: expectedProcessedValueCount}, queue.Milestone())

queue.UpdateMilestoneHint(20)
require.Equal(t, queue.Milestone(), Milestone{Value: 20, ProcessedValueCount: expectedProcessedValueCount})
require.Equal(t, Milestone{Value: 20, ProcessedValueCount: expectedProcessedValueCount}, queue.Milestone())

queue.Add(ctx, 22)
queue.Add(ctx, 25)
queue.UpdateMilestoneHint(30)

sendProcessedValue(22)
require.Equal(t, queue.Milestone(), Milestone{Value: 25, ProcessedValueCount: expectedProcessedValueCount})
require.Equal(t, Milestone{Value: 25, ProcessedValueCount: expectedProcessedValueCount}, queue.Milestone())
sendProcessedValue(25)
require.Equal(t, queue.Milestone(), Milestone{Value: 30, ProcessedValueCount: expectedProcessedValueCount})
require.Equal(t, Milestone{Value: 30, ProcessedValueCount: expectedProcessedValueCount}, queue.Milestone())

// Milestone value should not decrease
queue.UpdateMilestoneHint(0)
require.Equal(t, queue.Milestone(), Milestone{Value: 30, ProcessedValueCount: expectedProcessedValueCount})
require.Equal(t, Milestone{Value: 30, ProcessedValueCount: expectedProcessedValueCount}, queue.Milestone())
}

0 comments on commit 4ed8545

Please sign in to comment.