@@ -86,12 +86,12 @@ func TestNoPrebuilds(t *testing.T) {
86
86
preset (true ,0 ,current ),
87
87
}
88
88
89
- snapshot := prebuilds .NewGlobalSnapshot (presets ,nil ,nil ,nil ,nil ,nil ,quartz . NewMock ( t ) ,testutil .Logger (t ))
89
+ snapshot := prebuilds .NewGlobalSnapshot (presets ,nil ,nil ,nil ,nil ,nil ,clock ,testutil .Logger (t ))
90
90
ps ,err := snapshot .FilterByPreset (current .presetID )
91
91
require .NoError (t ,err )
92
92
93
93
state := ps .CalculateState ()
94
- actions ,err := ps .CalculateActions (clock , backoffInterval )
94
+ actions ,err := ps .CalculateActions (backoffInterval )
95
95
require .NoError (t ,err )
96
96
97
97
validateState (t , prebuilds.ReconciliationState {/*all zero values*/ },* state )
@@ -108,12 +108,12 @@ func TestNetNew(t *testing.T) {
108
108
preset (true ,1 ,current ),
109
109
}
110
110
111
- snapshot := prebuilds .NewGlobalSnapshot (presets ,nil ,nil ,nil ,nil ,nil ,quartz . NewMock ( t ) ,testutil .Logger (t ))
111
+ snapshot := prebuilds .NewGlobalSnapshot (presets ,nil ,nil ,nil ,nil ,nil ,clock ,testutil .Logger (t ))
112
112
ps ,err := snapshot .FilterByPreset (current .presetID )
113
113
require .NoError (t ,err )
114
114
115
115
state := ps .CalculateState ()
116
- actions ,err := ps .CalculateActions (clock , backoffInterval )
116
+ actions ,err := ps .CalculateActions (backoffInterval )
117
117
require .NoError (t ,err )
118
118
119
119
validateState (t , prebuilds.ReconciliationState {
@@ -156,7 +156,7 @@ func TestOutdatedPrebuilds(t *testing.T) {
156
156
157
157
// THEN: we should identify that this prebuild is outdated and needs to be deleted.
158
158
state := ps .CalculateState ()
159
- actions ,err := ps .CalculateActions (clock , backoffInterval )
159
+ actions ,err := ps .CalculateActions (backoffInterval )
160
160
require .NoError (t ,err )
161
161
validateState (t , prebuilds.ReconciliationState {
162
162
Actual :1 ,
@@ -174,7 +174,7 @@ func TestOutdatedPrebuilds(t *testing.T) {
174
174
175
175
// THEN: we should not be blocked from creating a new prebuild while the outdate one deletes.
176
176
state = ps .CalculateState ()
177
- actions ,err = ps .CalculateActions (clock , backoffInterval )
177
+ actions ,err = ps .CalculateActions (backoffInterval )
178
178
require .NoError (t ,err )
179
179
validateState (t , prebuilds.ReconciliationState {Desired :1 },* state )
180
180
validateActions (t , []* prebuilds.ReconciliationActions {
@@ -223,7 +223,7 @@ func TestDeleteOutdatedPrebuilds(t *testing.T) {
223
223
// THEN: we should identify that this prebuild is outdated and needs to be deleted.
224
224
// Despite the fact that deletion of another outdated prebuild is already in progress.
225
225
state := ps .CalculateState ()
226
- actions ,err := ps .CalculateActions (clock , backoffInterval )
226
+ actions ,err := ps .CalculateActions (backoffInterval )
227
227
require .NoError (t ,err )
228
228
validateState (t , prebuilds.ReconciliationState {
229
229
Actual :1 ,
@@ -467,7 +467,7 @@ func TestInProgressActions(t *testing.T) {
467
467
468
468
// THEN: we should identify that this prebuild is in progress.
469
469
state := ps .CalculateState ()
470
- actions ,err := ps .CalculateActions (clock , backoffInterval )
470
+ actions ,err := ps .CalculateActions (backoffInterval )
471
471
require .NoError (t ,err )
472
472
tc .checkFn (* state ,actions )
473
473
})
@@ -510,7 +510,7 @@ func TestExtraneous(t *testing.T) {
510
510
511
511
// THEN: an extraneous prebuild is detected and marked for deletion.
512
512
state := ps .CalculateState ()
513
- actions ,err := ps .CalculateActions (clock , backoffInterval )
513
+ actions ,err := ps .CalculateActions (backoffInterval )
514
514
require .NoError (t ,err )
515
515
validateState (t , prebuilds.ReconciliationState {
516
516
Actual :2 ,Desired :1 ,Extraneous :1 ,Eligible :2 ,
@@ -685,13 +685,13 @@ func TestExpiredPrebuilds(t *testing.T) {
685
685
}
686
686
687
687
// WHEN: calculating the current preset's state.
688
- snapshot := prebuilds .NewGlobalSnapshot (presets ,nil ,running ,nil ,nil ,nil ,quartz . NewMock ( t ) ,testutil .Logger (t ))
688
+ snapshot := prebuilds .NewGlobalSnapshot (presets ,nil ,running ,nil ,nil ,nil ,clock ,testutil .Logger (t ))
689
689
ps ,err := snapshot .FilterByPreset (current .presetID )
690
690
require .NoError (t ,err )
691
691
692
692
// THEN: we should identify that this prebuild is expired.
693
693
state := ps .CalculateState ()
694
- actions ,err := ps .CalculateActions (clock , backoffInterval )
694
+ actions ,err := ps .CalculateActions (backoffInterval )
695
695
require .NoError (t ,err )
696
696
tc .checkFn (running ,* state ,actions )
697
697
})
@@ -727,7 +727,7 @@ func TestDeprecated(t *testing.T) {
727
727
728
728
// THEN: all running prebuilds should be deleted because the template is deprecated.
729
729
state := ps .CalculateState ()
730
- actions ,err := ps .CalculateActions (clock , backoffInterval )
730
+ actions ,err := ps .CalculateActions (backoffInterval )
731
731
require .NoError (t ,err )
732
732
validateState (t , prebuilds.ReconciliationState {
733
733
Actual :1 ,
@@ -774,13 +774,13 @@ func TestLatestBuildFailed(t *testing.T) {
774
774
}
775
775
776
776
// WHEN: calculating the current preset's state.
777
- snapshot := prebuilds .NewGlobalSnapshot (presets ,nil ,running ,inProgress ,backoffs ,nil ,quartz . NewMock ( t ) ,testutil .Logger (t ))
777
+ snapshot := prebuilds .NewGlobalSnapshot (presets ,nil ,running ,inProgress ,backoffs ,nil ,clock ,testutil .Logger (t ))
778
778
psCurrent ,err := snapshot .FilterByPreset (current .presetID )
779
779
require .NoError (t ,err )
780
780
781
781
// THEN: reconciliation should backoff.
782
782
state := psCurrent .CalculateState ()
783
- actions ,err := psCurrent .CalculateActions (clock , backoffInterval )
783
+ actions ,err := psCurrent .CalculateActions (backoffInterval )
784
784
require .NoError (t ,err )
785
785
validateState (t , prebuilds.ReconciliationState {
786
786
Actual :0 ,Desired :1 ,
@@ -798,7 +798,7 @@ func TestLatestBuildFailed(t *testing.T) {
798
798
799
799
// THEN: it should NOT be in backoff because all is OK.
800
800
state = psOther .CalculateState ()
801
- actions ,err = psOther .CalculateActions (clock , backoffInterval )
801
+ actions ,err = psOther .CalculateActions (backoffInterval )
802
802
require .NoError (t ,err )
803
803
validateState (t , prebuilds.ReconciliationState {
804
804
Actual :1 ,Desired :1 ,Eligible :1 ,
@@ -812,7 +812,7 @@ func TestLatestBuildFailed(t *testing.T) {
812
812
psCurrent ,err = snapshot .FilterByPreset (current .presetID )
813
813
require .NoError (t ,err )
814
814
state = psCurrent .CalculateState ()
815
- actions ,err = psCurrent .CalculateActions (clock , backoffInterval )
815
+ actions ,err = psCurrent .CalculateActions (backoffInterval )
816
816
require .NoError (t ,err )
817
817
validateState (t , prebuilds.ReconciliationState {
818
818
Actual :0 ,Desired :1 ,
@@ -867,15 +867,15 @@ func TestMultiplePresetsPerTemplateVersion(t *testing.T) {
867
867
},
868
868
}
869
869
870
- snapshot := prebuilds .NewGlobalSnapshot (presets ,nil ,nil ,inProgress ,nil ,nil ,quartz . NewMock ( t ) ,testutil .Logger (t ))
870
+ snapshot := prebuilds .NewGlobalSnapshot (presets ,nil ,nil ,inProgress ,nil ,nil ,clock ,testutil .Logger (t ))
871
871
872
872
// Nothing has to be created for preset 1.
873
873
{
874
874
ps ,err := snapshot .FilterByPreset (presetOpts1 .presetID )
875
875
require .NoError (t ,err )
876
876
877
877
state := ps .CalculateState ()
878
- actions ,err := ps .CalculateActions (clock , backoffInterval )
878
+ actions ,err := ps .CalculateActions (backoffInterval )
879
879
require .NoError (t ,err )
880
880
881
881
validateState (t , prebuilds.ReconciliationState {
@@ -891,7 +891,7 @@ func TestMultiplePresetsPerTemplateVersion(t *testing.T) {
891
891
require .NoError (t ,err )
892
892
893
893
state := ps .CalculateState ()
894
- actions ,err := ps .CalculateActions (clock , backoffInterval )
894
+ actions ,err := ps .CalculateActions (backoffInterval )
895
895
require .NoError (t ,err )
896
896
897
897
validateState (t , prebuilds.ReconciliationState {
@@ -995,7 +995,7 @@ func TestPrebuildScheduling(t *testing.T) {
995
995
require .NoError (t ,err )
996
996
997
997
state := ps .CalculateState ()
998
- actions ,err := ps .CalculateActions (clock , backoffInterval )
998
+ actions ,err := ps .CalculateActions (backoffInterval )
999
999
require .NoError (t ,err )
1000
1000
1001
1001
validateState (t , prebuilds.ReconciliationState {
@@ -1016,7 +1016,7 @@ func TestPrebuildScheduling(t *testing.T) {
1016
1016
require .NoError (t ,err )
1017
1017
1018
1018
state := ps .CalculateState ()
1019
- actions ,err := ps .CalculateActions (clock , backoffInterval )
1019
+ actions ,err := ps .CalculateActions (backoffInterval )
1020
1020
require .NoError (t ,err )
1021
1021
1022
1022
validateState (t , prebuilds.ReconciliationState {