@@ -482,8 +482,10 @@ func TestClientEndpoint_GetNode(t *testing.T) {
482
482
t .Fatalf ("bad ComputedClass: %#v" , resp2 .Node )
483
483
}
484
484
485
+ // Update the status updated at value
486
+ node .StatusUpdatedAt = resp2 .Node .StatusUpdatedAt
485
487
if ! reflect .DeepEqual (node , resp2 .Node ) {
486
- t .Fatalf ("bad: %#v %#v" , node , resp2 .Node )
488
+ t .Fatalf ("bad: %#v \n %#v" , node , resp2 .Node )
487
489
}
488
490
489
491
// Lookup non-existing node
@@ -625,6 +627,7 @@ func TestClientEndpoint_GetAllocs(t *testing.T) {
625
627
alloc := mock .Alloc ()
626
628
alloc .NodeID = node .ID
627
629
state := s1 .fsm .State ()
630
+ state .UpsertJobSummary (99 , mock .JobSummary (alloc .JobID ))
628
631
err := state .UpsertAllocs (100 , []* structs.Allocation {alloc })
629
632
if err != nil {
630
633
t .Fatalf ("err: %v" , err )
@@ -685,6 +688,7 @@ func TestClientEndpoint_GetClientAllocs(t *testing.T) {
685
688
alloc := mock .Alloc ()
686
689
alloc .NodeID = node .ID
687
690
state := s1 .fsm .State ()
691
+ state .UpsertJobSummary (99 , mock .JobSummary (alloc .JobID ))
688
692
err := state .UpsertAllocs (100 , []* structs.Allocation {alloc })
689
693
if err != nil {
690
694
t .Fatalf ("err: %v" , err )
@@ -746,6 +750,7 @@ func TestClientEndpoint_GetClientAllocs_Blocking(t *testing.T) {
746
750
alloc := mock .Alloc ()
747
751
alloc .NodeID = node .ID
748
752
state := s1 .fsm .State ()
753
+ state .UpsertJobSummary (99 , mock .JobSummary (alloc .JobID ))
749
754
start := time .Now ()
750
755
time .AfterFunc (100 * time .Millisecond , func () {
751
756
err := state .UpsertAllocs (100 , []* structs.Allocation {alloc })
@@ -787,6 +792,7 @@ func TestClientEndpoint_GetClientAllocs_Blocking(t *testing.T) {
787
792
allocUpdate .NodeID = alloc .NodeID
788
793
allocUpdate .ID = alloc .ID
789
794
allocUpdate .ClientStatus = structs .AllocClientStatusRunning
795
+ state .UpsertJobSummary (199 , mock .JobSummary (allocUpdate .JobID ))
790
796
err := state .UpsertAllocs (200 , []* structs.Allocation {allocUpdate })
791
797
if err != nil {
792
798
t .Fatalf ("err: %v" , err )
@@ -835,6 +841,7 @@ func TestClientEndpoint_GetAllocs_Blocking(t *testing.T) {
835
841
alloc := mock .Alloc ()
836
842
alloc .NodeID = node .ID
837
843
state := s1 .fsm .State ()
844
+ state .UpsertJobSummary (99 , mock .JobSummary (alloc .JobID ))
838
845
start := time .Now ()
839
846
time .AfterFunc (100 * time .Millisecond , func () {
840
847
err := state .UpsertAllocs (100 , []* structs.Allocation {alloc })
@@ -876,6 +883,7 @@ func TestClientEndpoint_GetAllocs_Blocking(t *testing.T) {
876
883
allocUpdate .NodeID = alloc .NodeID
877
884
allocUpdate .ID = alloc .ID
878
885
allocUpdate .ClientStatus = structs .AllocClientStatusRunning
886
+ state .UpsertJobSummary (199 , mock .JobSummary (allocUpdate .JobID ))
879
887
err := state .UpdateAllocsFromClient (200 , []* structs.Allocation {allocUpdate })
880
888
if err != nil {
881
889
t .Fatalf ("err: %v" , err )
@@ -922,6 +930,7 @@ func TestClientEndpoint_UpdateAlloc(t *testing.T) {
922
930
alloc := mock .Alloc ()
923
931
alloc .NodeID = node .ID
924
932
state := s1 .fsm .State ()
933
+ state .UpsertJobSummary (99 , mock .JobSummary (alloc .JobID ))
925
934
err := state .UpsertAllocs (100 , []* structs.Allocation {alloc })
926
935
if err != nil {
927
936
t .Fatalf ("err: %v" , err )
@@ -982,6 +991,7 @@ func TestClientEndpoint_BatchUpdate(t *testing.T) {
982
991
alloc := mock .Alloc ()
983
992
alloc .NodeID = node .ID
984
993
state := s1 .fsm .State ()
994
+ state .UpsertJobSummary (99 , mock .JobSummary (alloc .JobID ))
985
995
err := state .UpsertAllocs (100 , []* structs.Allocation {alloc })
986
996
if err != nil {
987
997
t .Fatalf ("err: %v" , err )
@@ -1021,13 +1031,14 @@ func TestClientEndpoint_CreateNodeEvals(t *testing.T) {
1021
1031
// Inject fake evaluations
1022
1032
alloc := mock .Alloc ()
1023
1033
state := s1 .fsm .State ()
1024
- if err := state .UpsertAllocs (1 , []* structs.Allocation {alloc }); err != nil {
1034
+ state .UpsertJobSummary (1 , mock .JobSummary (alloc .JobID ))
1035
+ if err := state .UpsertAllocs (2 , []* structs.Allocation {alloc }); err != nil {
1025
1036
t .Fatalf ("err: %v" , err )
1026
1037
}
1027
1038
1028
1039
// Inject a fake system job.
1029
1040
job := mock .SystemJob ()
1030
- if err := state .UpsertJob (1 , job ); err != nil {
1041
+ if err := state .UpsertJob (3 , job ); err != nil {
1031
1042
t .Fatalf ("err: %v" , err )
1032
1043
}
1033
1044
@@ -1115,7 +1126,8 @@ func TestClientEndpoint_Evaluate(t *testing.T) {
1115
1126
if err != nil {
1116
1127
t .Fatalf ("err: %v" , err )
1117
1128
}
1118
- err = state .UpsertAllocs (2 , []* structs.Allocation {alloc })
1129
+ state .UpsertJobSummary (2 , mock .JobSummary (alloc .JobID ))
1130
+ err = state .UpsertAllocs (3 , []* structs.Allocation {alloc })
1119
1131
if err != nil {
1120
1132
t .Fatalf ("err: %v" , err )
1121
1133
}
0 commit comments