open-nomad/scheduler/reconcile_util_test.go

32 lines
723 B
Go
Raw Normal View History

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
2017-09-26 22:26:33 +00:00
// 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)
}
2017-08-15 19:27:05 +00:00
b = bitmapFrom(input, 8)
if act := b.Size(); act != exp {
t.Fatalf("got %d; want %d", act, exp)
}
}