Skip to content

Commit

Permalink
Migrate alloaction group search test
Browse files Browse the repository at this point in the history
  • Loading branch information
href committed Nov 26, 2014
1 parent 3a9ff5b commit 826591b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions libres/tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1557,3 +1557,22 @@ def is_allocation_exposed(self, allocation):
assert len(scheduler.search_allocations(*daterange, minspots=1)) == 0
assert len(scheduler.search_allocations(*daterange, minspots=2)) == 0
assert len(scheduler.search_allocations(*daterange, minspots=3)) == 0


def test_search_allocation_groups(scheduler):
s1, e1 = datetime(2014, 8, 3, 13, 0), datetime(2014, 8, 3, 15, 0)
s2, e2 = datetime(2014, 8, 4, 13, 0), datetime(2014, 8, 4, 15, 0)

scheduler.allocate([(s1, e1), (s2, e2)], grouped=True)
scheduler.commit()

assert len(scheduler.search_allocations(s1, e1, strict=True)) == 1
assert len(scheduler.search_allocations(s2, e2, strict=True)) == 1

assert len(scheduler.search_allocations(s1, e1, strict=False)) == 2
assert len(scheduler.search_allocations(s2, e2, strict=False)) == 2

assert len(scheduler.search_allocations(s1, e2)) == 2

assert len(scheduler.search_allocations(s1, e2, groups='yes')) == 2
assert len(scheduler.search_allocations(s1, e2, groups='no')) == 0

0 comments on commit 826591b

Please sign in to comment.