@@ -1541,9 +1541,7 @@ func TestGetQueue(t *testing.T) {
1541
1541
func TestTryAllocate (t * testing.T ) {
1542
1542
setupUGM ()
1543
1543
partition := createQueuesNodes (t )
1544
- if partition == nil {
1545
- t .Fatal ("partition create failed" )
1546
- }
1544
+ assert .Assert (t , partition != nil , "partition create failed" )
1547
1545
if result := partition .tryAllocate (); result != nil {
1548
1546
t .Fatalf ("empty cluster allocate returned allocation: %s" , result )
1549
1547
}
@@ -1620,12 +1618,7 @@ func TestTryAllocate(t *testing.T) {
1620
1618
func TestRequiredNodeReservation (t * testing.T ) {
1621
1619
setupUGM ()
1622
1620
partition := createQueuesNodes (t )
1623
- if partition == nil {
1624
- t .Fatal ("partition create failed" )
1625
- }
1626
- if result := partition .tryAllocate (); result != nil {
1627
- t .Fatalf ("empty cluster allocate returned allocation: %s" , result )
1628
- }
1621
+ assert .Assert (t , partition != nil , "partition create failed" )
1629
1622
node := partition .nodes .GetNode (nodeID1 )
1630
1623
if node == nil {
1631
1624
t .Fatal ("node-1 should have been created" )
@@ -1706,9 +1699,7 @@ func TestRequiredNodeReservation(t *testing.T) {
1706
1699
// allocate ask request with required node having non daemon set reservations
1707
1700
func TestRequiredNodeCancelOtherReservations (t * testing.T ) {
1708
1701
partition := createQueuesNodes (t )
1709
- if partition == nil {
1710
- t .Fatal ("partition create failed" )
1711
- }
1702
+ assert .Assert (t , partition != nil , "partition create failed" )
1712
1703
if result := partition .tryAllocate (); result != nil {
1713
1704
t .Fatalf ("empty cluster allocate returned allocation: %s" , result )
1714
1705
}
@@ -1786,9 +1777,7 @@ func TestRequiredNodeCancelOtherReservations(t *testing.T) {
1786
1777
// allocate ask request with required node having daemon set reservations
1787
1778
func TestRequiredNodeCancelDSReservations (t * testing.T ) {
1788
1779
partition := createQueuesNodes (t )
1789
- if partition == nil {
1790
- t .Fatal ("partition create failed" )
1791
- }
1780
+ assert .Assert (t , partition != nil , "partition create failed" )
1792
1781
if result := partition .tryAllocate (); result != nil {
1793
1782
t .Fatalf ("empty cluster allocate returned allocation: %s" , result )
1794
1783
}
@@ -1871,9 +1860,7 @@ func TestRequiredNodeCancelDSReservations(t *testing.T) {
1871
1860
func TestRequiredNodeNotExist (t * testing.T ) {
1872
1861
setupUGM ()
1873
1862
partition := createQueuesNodes (t )
1874
- if partition == nil {
1875
- t .Fatal ("partition create failed" )
1876
- }
1863
+ assert .Assert (t , partition != nil , "partition create failed" )
1877
1864
if result := partition .tryAllocate (); result != nil {
1878
1865
t .Fatalf ("empty cluster allocate returned allocation: %s" , result )
1879
1866
}
@@ -1908,9 +1895,7 @@ func TestRequiredNodeNotExist(t *testing.T) {
1908
1895
// basic ds scheduling on specific node in first allocate run itself (without any need for reservation)
1909
1896
func TestRequiredNodeAllocation (t * testing.T ) {
1910
1897
partition := createQueuesNodes (t )
1911
- if partition == nil {
1912
- t .Fatal ("partition create failed" )
1913
- }
1898
+ assert .Assert (t , partition != nil , "partition create failed" )
1914
1899
if result := partition .tryAllocate (); result != nil {
1915
1900
t .Fatalf ("empty cluster allocate returned allocation: %s" , result .Request .String ())
1916
1901
}
@@ -2076,9 +2061,7 @@ func TestPreemptionForRequiredNodeReservedAlloc(t *testing.T) {
2076
2061
2077
2062
func TestPreemptionForRequiredNodeMultipleAttemptsAvoided (t * testing.T ) {
2078
2063
partition := createQueuesNodes (t )
2079
- if partition == nil {
2080
- t .Fatal ("partition create failed" )
2081
- }
2064
+ assert .Assert (t , partition != nil , "partition create failed" )
2082
2065
2083
2066
app , testHandler := newApplicationWithHandler (appID1 , "default" , "root.parent.sub-leaf" )
2084
2067
res , err := resources .NewResourceFromConf (map [string ]string {"vcore" : "8" })
@@ -2158,9 +2141,7 @@ func getExpectedQueuesLimitsForPreemptionWithRequiredNode() map[string]map[strin
2158
2141
// setup the partition with existing allocations so we can test preemption
2159
2142
func setupPreemption (t * testing.T ) (* PartitionContext , * objects.Application , * objects.Application , * objects.Allocation , * objects.Allocation ) {
2160
2143
partition := createPreemptionQueuesNodes (t )
2161
- if partition == nil {
2162
- t .Fatal ("partition create failed" )
2163
- }
2144
+ assert .Assert (t , partition != nil , "partition create failed" )
2164
2145
if result := partition .tryAllocate (); result != nil {
2165
2146
t .Fatalf ("empty cluster allocate returned allocation: %s" , result )
2166
2147
}
@@ -2220,9 +2201,7 @@ func setupPreemption(t *testing.T) (*PartitionContext, *objects.Application, *ob
2220
2201
// setup the partition in a state that we need for multiple tests
2221
2202
func setupPreemptionForRequiredNode (t * testing.T ) (* PartitionContext , * objects.Application ) {
2222
2203
partition := createQueuesNodes (t )
2223
- if partition == nil {
2224
- t .Fatal ("partition create failed" )
2225
- }
2204
+ assert .Assert (t , partition != nil , "partition create failed" )
2226
2205
if result := partition .tryAllocate (); result != nil {
2227
2206
t .Fatalf ("empty cluster allocate returned allocation: %s" , result )
2228
2207
}
@@ -2300,9 +2279,7 @@ func setupPreemptionForRequiredNode(t *testing.T) (*PartitionContext, *objects.A
2300
2279
func TestTryAllocateLarge (t * testing.T ) {
2301
2280
setupUGM ()
2302
2281
partition := createQueuesNodes (t )
2303
- if partition == nil {
2304
- t .Fatal ("partition create failed" )
2305
- }
2282
+ assert .Assert (t , partition != nil , "partition create failed" )
2306
2283
if result := partition .tryAllocate (); result != nil {
2307
2284
t .Fatalf ("empty cluster allocate returned allocation: %s" , result )
2308
2285
}
@@ -2333,9 +2310,7 @@ func TestTryAllocateLarge(t *testing.T) {
2333
2310
func TestAllocReserveNewNode (t * testing.T ) {
2334
2311
setupUGM ()
2335
2312
partition := createQueuesNodes (t )
2336
- if partition == nil {
2337
- t .Fatal ("partition create failed" )
2338
- }
2313
+ assert .Assert (t , partition != nil , "partition create failed" )
2339
2314
if result := partition .tryAllocate (); result != nil {
2340
2315
t .Fatalf ("empty cluster allocate returned result: %s" , result )
2341
2316
}
@@ -2404,9 +2379,7 @@ func TestAllocReserveNewNode(t *testing.T) {
2404
2379
func TestTryAllocateReserve (t * testing.T ) {
2405
2380
setupUGM ()
2406
2381
partition := createQueuesNodes (t )
2407
- if partition == nil {
2408
- t .Fatal ("partition create failed" )
2409
- }
2382
+ assert .Assert (t , partition != nil , "partition create failed" )
2410
2383
if result := partition .tryReservedAllocate (); result != nil {
2411
2384
t .Fatalf ("empty cluster reserved allocate returned allocation: %s" , result )
2412
2385
}
@@ -2478,9 +2451,7 @@ func TestTryAllocateReserve(t *testing.T) {
2478
2451
func TestTryAllocateWithReserved (t * testing.T ) {
2479
2452
setupUGM ()
2480
2453
partition := createQueuesNodes (t )
2481
- if partition == nil {
2482
- t .Fatal ("partition create failed" )
2483
- }
2454
+ assert .Assert (t , partition != nil , "partition create failed" )
2484
2455
if alloc := partition .tryReservedAllocate (); alloc != nil {
2485
2456
t .Fatalf ("empty cluster reserved allocate returned allocation: %v" , alloc )
2486
2457
}
@@ -2502,9 +2473,7 @@ func TestTryAllocateWithReserved(t *testing.T) {
2502
2473
2503
2474
// reserve one node: scheduling should happen on the other
2504
2475
node2 := partition .GetNode (nodeID2 )
2505
- if node2 == nil {
2506
- t .Fatal ("expected node-2 to be returned got nil" )
2507
- }
2476
+ assert .Assert (t , node2 != nil , "expected node-2 to be returned got nil" )
2508
2477
partition .reserve (app , node2 , ask )
2509
2478
if app .NodeReservedForAsk (allocKey ) != nodeID2 {
2510
2479
t .Fatal ("reservation failure for alloc-1 and node-2" )
@@ -2533,9 +2502,7 @@ func TestTryAllocateWithReserved(t *testing.T) {
2533
2502
func TestScheduleRemoveReservedAsk (t * testing.T ) {
2534
2503
setupUGM ()
2535
2504
partition := createQueuesNodes (t )
2536
- if partition == nil {
2537
- t .Fatal ("partition create failed" )
2538
- }
2505
+ assert .Assert (t , partition != nil , "partition create failed" )
2539
2506
if result := partition .tryAllocate (); result != nil {
2540
2507
t .Fatalf ("empty cluster allocate returned allocation: %s" , result )
2541
2508
}
@@ -2623,9 +2590,7 @@ func TestScheduleRemoveReservedAsk(t *testing.T) {
2623
2590
// update the config with nodes registered and make sure that the root max and guaranteed are not changed
2624
2591
func TestUpdateRootQueue (t * testing.T ) {
2625
2592
partition := createQueuesNodes (t )
2626
- if partition == nil {
2627
- t .Fatal ("partition create failed" )
2628
- }
2593
+ assert .Assert (t , partition != nil , "partition create failed" )
2629
2594
res , err := resources .NewResourceFromConf (map [string ]string {"vcore" : "20" })
2630
2595
assert .NilError (t , err , "resource creation failed" )
2631
2596
assert .Assert (t , resources .Equals (res , partition .totalPartitionResource ), "partition resource not set as expected" )
@@ -3927,9 +3892,7 @@ func TestGetNodeSortingPolicyWhenNewPartitionFromConfig(t *testing.T) {
3927
3892
func TestTryAllocateMaxRunning (t * testing.T ) {
3928
3893
const resType = "vcore"
3929
3894
partition := createQueuesNodes (t )
3930
- if partition == nil {
3931
- t .Fatal ("partition create failed" )
3932
- }
3895
+ assert .Assert (t , partition != nil , "partition create failed" )
3933
3896
if result := partition .tryAllocate (); result != nil {
3934
3897
t .Fatalf ("empty cluster allocate returned allocation: %s" , result )
3935
3898
}
0 commit comments