open-nomad/scheduler/reconcile_util_test.go
Alex Dadgar 2453f13fc5 fixes
2017-08-15 12:27:05 -07:00

32 lines
724 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
// alligned.
// 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)
}
}