@@ -4733,6 +4733,9 @@ func TestUpdateApplicationSetApplicationStatus(t *testing.T) {
4733
4733
Health : v1alpha1.HealthStatus {
4734
4734
Status : health .HealthStatusProgressing ,
4735
4735
},
4736
+ Sync : v1alpha1.SyncStatus {
4737
+ Revision : "Next" ,
4738
+ },
4736
4739
},
4737
4740
},
4738
4741
},
@@ -4796,7 +4799,8 @@ func TestUpdateApplicationSetApplicationStatus(t *testing.T) {
4796
4799
Phase : common .OperationRunning ,
4797
4800
},
4798
4801
Sync : v1alpha1.SyncStatus {
4799
- Status : v1alpha1 .SyncStatusCodeSynced ,
4802
+ Status : v1alpha1 .SyncStatusCodeSynced ,
4803
+ Revision : "Current" ,
4800
4804
},
4801
4805
},
4802
4806
},
@@ -4861,7 +4865,8 @@ func TestUpdateApplicationSetApplicationStatus(t *testing.T) {
4861
4865
Phase : common .OperationSucceeded ,
4862
4866
},
4863
4867
Sync : v1alpha1.SyncStatus {
4864
- Status : v1alpha1 .SyncStatusCodeSynced ,
4868
+ Status : v1alpha1 .SyncStatusCodeSynced ,
4869
+ Revision : "Next" ,
4865
4870
},
4866
4871
},
4867
4872
},
@@ -4926,7 +4931,8 @@ func TestUpdateApplicationSetApplicationStatus(t *testing.T) {
4926
4931
Phase : common .OperationSucceeded ,
4927
4932
},
4928
4933
Sync : v1alpha1.SyncStatus {
4929
- Status : v1alpha1 .SyncStatusCodeSynced ,
4934
+ Revision : "Current" ,
4935
+ Status : v1alpha1 .SyncStatusCodeSynced ,
4930
4936
},
4931
4937
},
4932
4938
},
@@ -5166,7 +5172,7 @@ func TestUpdateApplicationSetApplicationStatus(t *testing.T) {
5166
5172
},
5167
5173
},
5168
5174
{
5169
- name : "does not progresses a pending application with a successful sync triggered by controller with invalid revision to progressing " ,
5175
+ name : "removes the appStatus for applications that no longer exist " ,
5170
5176
appSet : v1alpha1.ApplicationSet {
5171
5177
ObjectMeta : metav1.ObjectMeta {
5172
5178
Name : "name" ,
@@ -5190,14 +5196,18 @@ func TestUpdateApplicationSetApplicationStatus(t *testing.T) {
5190
5196
Status : v1alpha1.ApplicationSetStatus {
5191
5197
ApplicationStatus : []v1alpha1.ApplicationSetApplicationStatus {
5192
5198
{
5193
- Application : "app1" ,
5194
- LastTransitionTime : & metav1.Time {
5195
- Time : time .Now ().Add (time .Duration (- 1 ) * time .Minute ),
5196
- },
5197
- Message : "" ,
5198
- Status : "Pending" ,
5199
+ Application : "app1" ,
5200
+ Message : "Application has pending changes, setting status to Waiting." ,
5201
+ Status : "Waiting" ,
5199
5202
Step : "1" ,
5200
- TargetRevisions : []string {"Next" },
5203
+ TargetRevisions : []string {"Current" },
5204
+ },
5205
+ {
5206
+ Application : "app2" ,
5207
+ Message : "Application has pending changes, setting status to Waiting." ,
5208
+ Status : "Waiting" ,
5209
+ Step : "1" ,
5210
+ TargetRevisions : []string {"Current" },
5201
5211
},
5202
5212
},
5203
5213
},
@@ -5209,25 +5219,14 @@ func TestUpdateApplicationSetApplicationStatus(t *testing.T) {
5209
5219
},
5210
5220
Status : v1alpha1.ApplicationStatus {
5211
5221
Health : v1alpha1.HealthStatus {
5212
- Status : health .HealthStatusDegraded ,
5222
+ Status : health .HealthStatusHealthy ,
5213
5223
},
5214
5224
OperationState : & v1alpha1.OperationState {
5215
5225
Phase : common .OperationSucceeded ,
5216
- StartedAt : metav1.Time {
5217
- Time : time .Now (),
5218
- },
5219
- Operation : v1alpha1.Operation {
5220
- InitiatedBy : v1alpha1.OperationInitiator {
5221
- Username : "applicationset-controller" ,
5222
- Automated : true ,
5223
- },
5224
- },
5225
- SyncResult : & v1alpha1.SyncOperationResult {
5226
- Revision : "Previous" ,
5227
- },
5228
5226
},
5229
5227
Sync : v1alpha1.SyncStatus {
5230
- Status : v1alpha1 .SyncStatusCodeSynced ,
5228
+ Status : v1alpha1 .SyncStatusCodeSynced ,
5229
+ Revision : "Current" ,
5231
5230
},
5232
5231
},
5233
5232
},
@@ -5238,15 +5237,15 @@ func TestUpdateApplicationSetApplicationStatus(t *testing.T) {
5238
5237
expectedAppStatus : []v1alpha1.ApplicationSetApplicationStatus {
5239
5238
{
5240
5239
Application : "app1" ,
5241
- Message : "" ,
5242
- Status : "Pending " ,
5240
+ Message : "Application resource is already Healthy, updating status from Waiting to Healthy. " ,
5241
+ Status : "Healthy " ,
5243
5242
Step : "1" ,
5244
- TargetRevisions : []string {"Next " },
5243
+ TargetRevisions : []string {"Current " },
5245
5244
},
5246
5245
},
5247
5246
},
5248
5247
{
5249
- name : "removes the appStatus for applications that no longer exist " ,
5248
+ name : "progresses a pending synced application with an old revision to progressing with the Current one " ,
5250
5249
appSet : v1alpha1.ApplicationSet {
5251
5250
ObjectMeta : metav1.ObjectMeta {
5252
5251
Name : "name" ,
@@ -5271,17 +5270,10 @@ func TestUpdateApplicationSetApplicationStatus(t *testing.T) {
5271
5270
ApplicationStatus : []v1alpha1.ApplicationSetApplicationStatus {
5272
5271
{
5273
5272
Application : "app1" ,
5274
- Message : "Application has pending changes, setting status to Waiting." ,
5275
- Status : "Waiting" ,
5276
- Step : "1" ,
5277
- TargetRevisions : []string {"Current" },
5278
- },
5279
- {
5280
- Application : "app2" ,
5281
- Message : "Application has pending changes, setting status to Waiting." ,
5282
- Status : "Waiting" ,
5273
+ Message : "" ,
5274
+ Status : "Pending" ,
5283
5275
Step : "1" ,
5284
- TargetRevisions : []string {"Current " },
5276
+ TargetRevisions : []string {"Old " },
5285
5277
},
5286
5278
},
5287
5279
},
@@ -5297,9 +5289,13 @@ func TestUpdateApplicationSetApplicationStatus(t *testing.T) {
5297
5289
},
5298
5290
OperationState : & v1alpha1.OperationState {
5299
5291
Phase : common .OperationSucceeded ,
5292
+ SyncResult : & v1alpha1.SyncOperationResult {
5293
+ Revision : "Current" ,
5294
+ },
5300
5295
},
5301
5296
Sync : v1alpha1.SyncStatus {
5302
- Status : v1alpha1 .SyncStatusCodeSynced ,
5297
+ Status : v1alpha1 .SyncStatusCodeSynced ,
5298
+ Revisions : []string {"Current" },
5303
5299
},
5304
5300
},
5305
5301
},
0 commit comments