open-nomad/scheduler/reconcile_util_test.go
2017-09-26 15:26:33 -07:00

32 lines
723 B
Go

package scheduler
import (
"testing"
"github.com/hashicorp/nomad/nomad/structs"
)
// Test that we properly create the bitmap even when the alloc set includes an
// allocation with a higher count than the current min count and it is byte
// aligned.
// Ensure no regerssion from: https://github.com/hashicorp/nomad/issues/3008
func TestBitmapFrom(t *testing.T) {
input := map[string]*structs.Allocation{
"8": {
JobID: "foo",
TaskGroup: "bar",
Name: "foo.bar[8]",
},
}
b := bitmapFrom(input, 1)
exp := uint(16)
if act := b.Size(); act != exp {
t.Fatalf("got %d; want %d", act, exp)
}
b = bitmapFrom(input, 8)
if act := b.Size(); act != exp {
t.Fatalf("got %d; want %d", act, exp)
}
}