@@ -41,14 +41,14 @@ func TestNewNode(t *testing.T) {
4141 if node != nil {
4242 t .Error ("node not returned correctly: node is nul or incorrect name" )
4343 }
44- proto := newProto (testNode , nil , nil , nil )
44+ proto := newProto (testNode , nil , nil )
4545 node = NewNode (proto )
4646 if node == nil || node .NodeID != testNode {
4747 t .Error ("node not returned correctly: node is nul or incorrect name" )
4848 }
4949
5050 totalRes := resources .NewResourceFromMap (map [string ]resources.Quantity {"first" : 100 , "second" : 100 })
51- proto = newProto (testNode , totalRes , nil , map [string ]string {})
51+ proto = newProto (testNode , totalRes , map [string ]string {})
5252 node = NewNode (proto )
5353 if node == nil || node .NodeID != testNode {
5454 t .Fatal ("node not returned correctly: node is nul or incorrect name" )
@@ -74,25 +74,20 @@ func TestNewNode(t *testing.T) {
7474 assert .Equal (t , "rack1" , node .Rackname )
7575 assert .Equal (t , "partition1" , node .Partition )
7676
77- // test capacity/available/occupied resources
77+ // test capacity/available resources
7878 totalResources := resources .NewResourceFromMap (map [string ]resources.Quantity {"first" : 100 , "second" : 100 })
79- occupiedResources := resources .NewResourceFromMap (map [string ]resources.Quantity {"first" : 30 , "second" : 20 })
8079 availableResources := resources .NewResourceFromMap (map [string ]resources.Quantity {"first" : 70 , "second" : 80 })
81- proto = newProto (testNode , totalResources , occupiedResources , map [string ]string {})
80+ proto = newProto (testNode , totalResources , map [string ]string {})
8281 node = NewNode (proto )
8382 assert .Equal (t , node .NodeID , testNode , "node not returned correctly: node is nul or incorrect name" )
8483 if ! resources .Equals (node .GetCapacity (), totalResources ) {
8584 t .Errorf ("node total resources not set correctly: %v expected got %v" ,
8685 totalResources , node .GetCapacity ())
8786 }
88- if ! resources .Equals (node .GetAvailableResource (), availableResources ) {
87+ if ! resources .Equals (node .GetAvailableResource (), totalResources ) {
8988 t .Errorf ("node available resources not set correctly: %v expected got %v" ,
9089 availableResources , node .GetAvailableResource ())
9190 }
92- if ! resources .Equals (node .GetOccupiedResource (), occupiedResources ) {
93- t .Errorf ("node occupied resources not set correctly: %v expected got %v" ,
94- occupiedResources , node .GetOccupiedResource ())
95- }
9691}
9792
9893func TestCheckConditions (t * testing.T ) {
@@ -328,7 +323,7 @@ func TestAttributes(t *testing.T) {
328323 testname := fmt .Sprintf ("Attributes in the node %d" , index )
329324 t .Run (testname , func (t * testing.T ) {
330325 nodename := fmt .Sprintf ("%s-%d" , testNode , index )
331- node := NewNode (newProto (nodename , nil , nil , tt .inputs ))
326+ node := NewNode (newProto (nodename , nil , tt .inputs ))
332327 if node == nil || node .NodeID != nodename {
333328 t .Error ("node not returned correctly: node is nul or incorrect name" )
334329 }
@@ -363,7 +358,7 @@ func TestAttributes(t *testing.T) {
363358}
364359
365360func TestGetInstanceType (t * testing.T ) {
366- proto := newProto (testNode , nil , nil , map [string ]string {
361+ proto := newProto (testNode , nil , map [string ]string {
367362 common .NodePartition : "partition1" ,
368363 "label1" : "key1" ,
369364 "label2" : "key2" ,
@@ -789,8 +784,7 @@ func TestAddRemoveListener(t *testing.T) {
789784func TestNodeEvents (t * testing.T ) {
790785 mockEvents := evtMock .NewEventSystem ()
791786 total := resources .NewResourceFromMap (map [string ]resources.Quantity {"cpu" : 100 , "memory" : 100 })
792- occupied := resources .NewResourceFromMap (map [string ]resources.Quantity {"cpu" : 10 , "memory" : 10 })
793- proto := newProto (testNode , total , occupied , map [string ]string {
787+ proto := newProto (testNode , total , map [string ]string {
794788 "ready" : "true" ,
795789 })
796790 node := NewNode (proto )
@@ -905,8 +899,7 @@ func TestPreconditions(t *testing.T) {
905899
906900 plugins .RegisterSchedulerPlugin (mock .NewPredicatePlugin (true , map [string ]int {}))
907901 total := resources .NewResourceFromMap (map [string ]resources.Quantity {"cpu" : 100 , "memory" : 100 })
908- occupied := resources .NewResourceFromMap (map [string ]resources.Quantity {"cpu" : 10 , "memory" : 10 })
909- proto := newProto (testNode , total , occupied , map [string ]string {
902+ proto := newProto (testNode , total , map [string ]string {
910903 "ready" : "true" ,
911904 })
912905 res := resources .NewResourceFromMap (map [string ]resources.Quantity {"first" : 1 })
0 commit comments