зеркало из https://github.com/Azure/ARO-RP.git
fix e2e, hopefully
This commit is contained in:
Родитель
52d0150b2b
Коммит
45ec965ab7
|
@ -39,6 +39,7 @@ func validateMaintenanceTask(task MaintenanceTask) error {
|
|||
task == MaintenanceTaskRenewCerts ||
|
||||
task == MaintenanceTaskPending ||
|
||||
task == MaintenanceTaskNone ||
|
||||
task == MaintenanceTaskSyncClusterObject ||
|
||||
task == MaintenanceTaskCustomerActionNeeded) {
|
||||
return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "properties.maintenanceTask", "Invalid enum parameter.")
|
||||
}
|
||||
|
|
|
@ -262,6 +262,7 @@ func (t MaintenanceTask) IsMaintenanceOngoingTask() bool {
|
|||
result := (t == MaintenanceTaskEverything) ||
|
||||
(t == MaintenanceTaskOperator) ||
|
||||
(t == MaintenanceTaskRenewCerts) ||
|
||||
(t == MaintenanceTaskSyncClusterObject) ||
|
||||
(t == "")
|
||||
return result
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ func (f *frontend) _putAdminMaintManifestCreate(ctx context.Context, r *http.Req
|
|||
return nil, api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidRequestContent, "", "The request content could not be deserialized: "+err.Error())
|
||||
}
|
||||
|
||||
// fill in some sefaults
|
||||
// fill in some defaults
|
||||
ext.ID = dbMaintenanceManifests.NewUUID()
|
||||
ext.State = admin.MaintenanceManifestStatePending
|
||||
|
||||
|
|
|
@ -114,6 +114,44 @@ func TestMIMOCreateManifest(t *testing.T) {
|
|||
},
|
||||
wantStatusCode: http.StatusCreated,
|
||||
},
|
||||
{
|
||||
name: "default set to pending",
|
||||
fixtures: func(f *testdatabase.Fixture) {
|
||||
f.AddOpenShiftClusterDocuments(&api.OpenShiftClusterDocument{
|
||||
Key: strings.ToLower(resourceID),
|
||||
OpenShiftCluster: &api.OpenShiftCluster{
|
||||
ID: resourceID,
|
||||
Name: "resourceName",
|
||||
Type: "Microsoft.RedHatOpenShift/openshiftClusters",
|
||||
},
|
||||
})
|
||||
},
|
||||
body: &admin.MaintenanceManifest{
|
||||
MaintenanceSetID: "exampleset",
|
||||
RunAfter: 1,
|
||||
RunBefore: 1,
|
||||
},
|
||||
wantResult: func(c *testdatabase.Checker) {
|
||||
c.AddMaintenanceManifestDocuments(&api.MaintenanceManifestDocument{
|
||||
ID: "07070707-0707-0707-0707-070707070001",
|
||||
ClusterResourceID: strings.ToLower(resourceID),
|
||||
MaintenanceManifest: api.MaintenanceManifest{
|
||||
MaintenanceSetID: "exampleset",
|
||||
State: api.MaintenanceManifestStatePending,
|
||||
RunAfter: 1,
|
||||
RunBefore: 1,
|
||||
},
|
||||
})
|
||||
},
|
||||
wantResponse: &admin.MaintenanceManifest{
|
||||
ID: "07070707-0707-0707-0707-070707070001",
|
||||
MaintenanceSetID: "exampleset",
|
||||
State: admin.MaintenanceManifestStatePending,
|
||||
RunAfter: 1,
|
||||
RunBefore: 1,
|
||||
},
|
||||
wantStatusCode: http.StatusCreated,
|
||||
},
|
||||
} {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
now := func() time.Time { return time.Unix(1000, 0) }
|
||||
|
|
|
@ -5,7 +5,6 @@ package e2e
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
|
@ -31,10 +30,18 @@ var _ = Describe("MIMO Actuator E2E Testing", func() {
|
|||
var oc = &admin.OpenShiftCluster{}
|
||||
testflag := "aro.e2e.testflag." + uuid.DefaultGenerator.Generate()
|
||||
|
||||
ocIn := &admin.OpenShiftCluster{
|
||||
Properties: admin.OpenShiftClusterProperties{
|
||||
MaintenanceTask: admin.MaintenanceTaskSyncClusterObject,
|
||||
OperatorFlags: admin.OperatorFlags{
|
||||
testflag: "true",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
By("set a bogus flag on the cluster")
|
||||
resp, err := adminRequest(ctx,
|
||||
http.MethodPatch, clusterResourceID, nil, true,
|
||||
json.RawMessage("{\"properties\": {\"maintenanceTask\": \"SyncClusterObject\", \"operatorFlags\": {\""+testflag+"\": \"true\"}}}"), oc)
|
||||
http.MethodPatch, clusterResourceID, nil, true, ocIn, oc)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(resp.StatusCode).To(Equal(http.StatusOK))
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче