MaintenanceTask is cleared after run pass/failure

This commit is contained in:
Amber Brown 2021-10-26 14:09:32 +11:00
Родитель 78cb05e270
Коммит 22ba7801bf
2 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -167,7 +167,7 @@ func TestBackendTry(t *testing.T) {
},
},
{
name: "StateAdminUpdating success sets the last ProvisioningState and clears LastAdminUpdateError",
name: "StateAdminUpdating success sets the last ProvisioningState and clears LastAdminUpdateError and MaintenanceTask",
fixture: func(f *testdatabase.Fixture) {
f.AddOpenShiftClusterDocuments(&api.OpenShiftClusterDocument{
Key: strings.ToLower(resourceID),
@ -180,6 +180,7 @@ func TestBackendTry(t *testing.T) {
ProvisioningState: api.ProvisioningStateAdminUpdating,
LastProvisioningState: api.ProvisioningStateSucceeded,
LastAdminUpdateError: "oh no",
MaintenanceTask: api.MaintenanceTaskEverything,
},
},
})
@ -219,6 +220,7 @@ func TestBackendTry(t *testing.T) {
ProvisioningState: api.ProvisioningStateAdminUpdating,
LastProvisioningState: api.ProvisioningStateSucceeded,
FailedProvisioningState: api.ProvisioningStateUpdating,
MaintenanceTask: api.MaintenanceTaskEverything,
},
},
})

Просмотреть файл

@ -306,6 +306,7 @@ func (c *openShiftClusters) EndLease(ctx context.Context, key string, provisioni
return c.patchWithLease(ctx, key, func(doc *api.OpenShiftClusterDocument) error {
doc.OpenShiftCluster.Properties.ProvisioningState = provisioningState
doc.OpenShiftCluster.Properties.FailedProvisioningState = failedProvisioningState
doc.OpenShiftCluster.Properties.MaintenanceTask = ""
doc.LeaseOwner = ""
doc.LeaseExpires = 0