@@ -88,7 +88,8 @@ func TestNoPrebuilds(t *testing.T) {
88
88
ps ,err := snapshot .FilterByPreset (current .presetID )
89
89
require .NoError (t ,err )
90
90
91
- state := ps .CalculateState ()
91
+ state ,err := ps .CalculateState ()
92
+ require .NoError (t ,err )
92
93
actions ,err := ps .CalculateActions (clock ,backoffInterval )
93
94
require .NoError (t ,err )
94
95
@@ -110,7 +111,8 @@ func TestNetNew(t *testing.T) {
110
111
ps ,err := snapshot .FilterByPreset (current .presetID )
111
112
require .NoError (t ,err )
112
113
113
- state := ps .CalculateState ()
114
+ state ,err := ps .CalculateState ()
115
+ require .NoError (t ,err )
114
116
actions ,err := ps .CalculateActions (clock ,backoffInterval )
115
117
require .NoError (t ,err )
116
118
@@ -153,7 +155,8 @@ func TestOutdatedPrebuilds(t *testing.T) {
153
155
require .NoError (t ,err )
154
156
155
157
// THEN: we should identify that this prebuild is outdated and needs to be deleted.
156
- state := ps .CalculateState ()
158
+ state ,err := ps .CalculateState ()
159
+ require .NoError (t ,err )
157
160
actions ,err := ps .CalculateActions (clock ,backoffInterval )
158
161
require .NoError (t ,err )
159
162
validateState (t , prebuilds.ReconciliationState {
@@ -171,7 +174,8 @@ func TestOutdatedPrebuilds(t *testing.T) {
171
174
require .NoError (t ,err )
172
175
173
176
// THEN: we should not be blocked from creating a new prebuild while the outdate one deletes.
174
- state = ps .CalculateState ()
177
+ state ,err = ps .CalculateState ()
178
+ require .NoError (t ,err )
175
179
actions ,err = ps .CalculateActions (clock ,backoffInterval )
176
180
require .NoError (t ,err )
177
181
validateState (t , prebuilds.ReconciliationState {Desired :1 },* state )
@@ -220,7 +224,8 @@ func TestDeleteOutdatedPrebuilds(t *testing.T) {
220
224
221
225
// THEN: we should identify that this prebuild is outdated and needs to be deleted.
222
226
// Despite the fact that deletion of another outdated prebuild is already in progress.
223
- state := ps .CalculateState ()
227
+ state ,err := ps .CalculateState ()
228
+ require .NoError (t ,err )
224
229
actions ,err := ps .CalculateActions (clock ,backoffInterval )
225
230
require .NoError (t ,err )
226
231
validateState (t , prebuilds.ReconciliationState {
@@ -464,7 +469,8 @@ func TestInProgressActions(t *testing.T) {
464
469
require .NoError (t ,err )
465
470
466
471
// THEN: we should identify that this prebuild is in progress.
467
- state := ps .CalculateState ()
472
+ state ,err := ps .CalculateState ()
473
+ require .NoError (t ,err )
468
474
actions ,err := ps .CalculateActions (clock ,backoffInterval )
469
475
require .NoError (t ,err )
470
476
tc .checkFn (* state ,actions )
@@ -507,7 +513,8 @@ func TestExtraneous(t *testing.T) {
507
513
require .NoError (t ,err )
508
514
509
515
// THEN: an extraneous prebuild is detected and marked for deletion.
510
- state := ps .CalculateState ()
516
+ state ,err := ps .CalculateState ()
517
+ require .NoError (t ,err )
511
518
actions ,err := ps .CalculateActions (clock ,backoffInterval )
512
519
require .NoError (t ,err )
513
520
validateState (t , prebuilds.ReconciliationState {
@@ -688,7 +695,8 @@ func TestExpiredPrebuilds(t *testing.T) {
688
695
require .NoError (t ,err )
689
696
690
697
// THEN: we should identify that this prebuild is expired.
691
- state := ps .CalculateState ()
698
+ state ,err := ps .CalculateState ()
699
+ require .NoError (t ,err )
692
700
actions ,err := ps .CalculateActions (clock ,backoffInterval )
693
701
require .NoError (t ,err )
694
702
tc .checkFn (running ,* state ,actions )
@@ -724,7 +732,8 @@ func TestDeprecated(t *testing.T) {
724
732
require .NoError (t ,err )
725
733
726
734
// THEN: all running prebuilds should be deleted because the template is deprecated.
727
- state := ps .CalculateState ()
735
+ state ,err := ps .CalculateState ()
736
+ require .NoError (t ,err )
728
737
actions ,err := ps .CalculateActions (clock ,backoffInterval )
729
738
require .NoError (t ,err )
730
739
validateState (t , prebuilds.ReconciliationState {
@@ -777,7 +786,8 @@ func TestLatestBuildFailed(t *testing.T) {
777
786
require .NoError (t ,err )
778
787
779
788
// THEN: reconciliation should backoff.
780
- state := psCurrent .CalculateState ()
789
+ state ,err := psCurrent .CalculateState ()
790
+ require .NoError (t ,err )
781
791
actions ,err := psCurrent .CalculateActions (clock ,backoffInterval )
782
792
require .NoError (t ,err )
783
793
validateState (t , prebuilds.ReconciliationState {
@@ -795,7 +805,8 @@ func TestLatestBuildFailed(t *testing.T) {
795
805
require .NoError (t ,err )
796
806
797
807
// THEN: it should NOT be in backoff because all is OK.
798
- state = psOther .CalculateState ()
808
+ state ,err = psOther .CalculateState ()
809
+ require .NoError (t ,err )
799
810
actions ,err = psOther .CalculateActions (clock ,backoffInterval )
800
811
require .NoError (t ,err )
801
812
validateState (t , prebuilds.ReconciliationState {
@@ -809,7 +820,8 @@ func TestLatestBuildFailed(t *testing.T) {
809
820
// THEN: a new prebuild should be created.
810
821
psCurrent ,err = snapshot .FilterByPreset (current .presetID )
811
822
require .NoError (t ,err )
812
- state = psCurrent .CalculateState ()
823
+ state ,err = psCurrent .CalculateState ()
824
+ require .NoError (t ,err )
813
825
actions ,err = psCurrent .CalculateActions (clock ,backoffInterval )
814
826
require .NoError (t ,err )
815
827
validateState (t , prebuilds.ReconciliationState {
@@ -872,7 +884,8 @@ func TestMultiplePresetsPerTemplateVersion(t *testing.T) {
872
884
ps ,err := snapshot .FilterByPreset (presetOpts1 .presetID )
873
885
require .NoError (t ,err )
874
886
875
- state := ps .CalculateState ()
887
+ state ,err := ps .CalculateState ()
888
+ require .NoError (t ,err )
876
889
actions ,err := ps .CalculateActions (clock ,backoffInterval )
877
890
require .NoError (t ,err )
878
891
@@ -888,7 +901,8 @@ func TestMultiplePresetsPerTemplateVersion(t *testing.T) {
888
901
ps ,err := snapshot .FilterByPreset (presetOpts2 .presetID )
889
902
require .NoError (t ,err )
890
903
891
- state := ps .CalculateState ()
904
+ state ,err := ps .CalculateState ()
905
+ require .NoError (t ,err )
892
906
actions ,err := ps .CalculateActions (clock ,backoffInterval )
893
907
require .NoError (t ,err )
894
908
@@ -992,7 +1006,8 @@ func TestPrebuildAutoscaling(t *testing.T) {
992
1006
ps ,err := snapshot .FilterByPreset (presetOpts1 .presetID )
993
1007
require .NoError (t ,err )
994
1008
995
- state := ps .CalculateState ()
1009
+ state ,err := ps .CalculateState ()
1010
+ require .NoError (t ,err )
996
1011
actions ,err := ps .CalculateActions (clock ,backoffInterval )
997
1012
require .NoError (t ,err )
998
1013
@@ -1013,7 +1028,8 @@ func TestPrebuildAutoscaling(t *testing.T) {
1013
1028
ps ,err := snapshot .FilterByPreset (presetOpts2 .presetID )
1014
1029
require .NoError (t ,err )
1015
1030
1016
- state := ps .CalculateState ()
1031
+ state ,err := ps .CalculateState ()
1032
+ require .NoError (t ,err )
1017
1033
actions ,err := ps .CalculateActions (clock ,backoffInterval )
1018
1034
require .NoError (t ,err )
1019
1035