Introduce 'Count' type to avoid abusing 'Offset'

This commit is contained in:
Bryan Boreham authored and Matthias Radestock committed 2016-03-19 11:47:34 +00:00
1 parent 7b6364696c
commit f11314ed3e
9 files changed
+45 -38

No files matched your search

+2 -2
View File
@@ -84,7 +84,7 @@ func TestAllocFree(t *testing.T) {
// Move the clock forward and clear out the dead container
alloc.actionChan <- func() { alloc.now = func() time.Time { return time.Now().Add(containerDiedTimeout * 2) } }
alloc.actionChan <- func() { alloc.removeDeadContainers() }
require.Equal(t, address.Offset(spaceSize+1), alloc.NumFreeAddresses(subnet.Range()))
require.Equal(t, address.Count(spaceSize+1), alloc.NumFreeAddresses(subnet.Range()))
}
func TestBootstrap(t *testing.T) {
@@ -345,7 +345,7 @@ func TestTransfer(t *testing.T) {
require.NoError(t, alloc1.AdminTakeoverRanges(alloc3.ourName.String()))
router.Flush()
require.Equal(t, address.Offset(1024), alloc1.NumFreeAddresses(subnet.Range()))
require.Equal(t, address.Count(1024), alloc1.NumFreeAddresses(subnet.Range()))
_, err = alloc1.Allocate("foo", subnet, returnFalse)
require.True(t, err == nil, "Failed to get address")