v1.13.2
This commit is contained in:
@@ -8,9 +8,11 @@
|
||||
- [Тесты Raw методов (Get, List)](#тесты-raw-методов-get-list)
|
||||
- [Cloudapi](#cloudapi)
|
||||
- [Cloudbroker](#cloudbroker)
|
||||
- [SDN](#sdn)
|
||||
- [Тесты запросов](#тесты-запросов)
|
||||
- [Cloudapi](#cloudapi-1)
|
||||
- [Cloudbroker](#cloudbroker-1)
|
||||
- [SDN](#sdn-1)
|
||||
- [Тесты API методов](#тесты-api-методов)
|
||||
|
||||
## Подготовка к тестам
|
||||
@@ -46,6 +48,13 @@
|
||||
Запустить тест `TestGetListCloudbroker` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
|
||||
При наличии подсвеченных полей, проверить, что они содержатся на платформе и не содержатся в go структурах, завести и исправить ошибку.
|
||||
|
||||
### SDN
|
||||
|
||||
Запустить тест `TestGetListSDNAPI` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
|
||||
При наличии подсвеченных полей, проверить, что они содержатся на платформе и не содержатся в go структурах, завести и исправить ошибку.
|
||||
|
||||
Пример вывода аналогичен тестам для Cloudapi и Cloudbroker.
|
||||
|
||||
## Тесты запросов
|
||||
|
||||
### Cloudapi
|
||||
@@ -89,6 +98,13 @@ FAIL
|
||||
FAIL
|
||||
```
|
||||
|
||||
### SDN
|
||||
|
||||
Запустить тест `TestRequestsSDN` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
|
||||
При наличии подсвеченных ошибок, проверить, что они являются ошибками (возможны ситуации, когда расхождение платформы и sdk задумано специально), завести и исправить ошибку.
|
||||
|
||||
Пример вывода аналогичен тестам для Cloudapi и Cloudbroker.
|
||||
|
||||
## Тесты API методов
|
||||
|
||||
Запустить тест `TestGetAllPaths` в `decort-sdk/tests/platform_upgrade/cloud_test.go`
|
||||
|
||||
@@ -135,7 +135,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
||||
"/restmachine/cloudapi/bservice/snapshotRollback": bservice.SnapshotRollbackRequest{},
|
||||
"/restmachine/cloudapi/bservice/start": bservice.StartRequest{},
|
||||
"/restmachine/cloudapi/bservice/stop": bservice.StopRequest{},
|
||||
|
||||
"/restmachine/cloudapi/bservice/migrateToZone": bservice.MigrateToZoneRequest{},
|
||||
// compute
|
||||
"/restmachine/cloudapi/compute/abort_shared_snapshot_merge": compute.AbortSharedSnapshotMergeRequest{},
|
||||
"/restmachine/cloudapi/compute/shared_snapshot_merge_status": compute.SharedSnapshotMergeStatusRequest{},
|
||||
@@ -194,7 +194,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
||||
"/restmachine/cloudapi/compute/pfwDel": compute.PFWDelRequest{},
|
||||
"/restmachine/cloudapi/compute/pfwList": compute.PFWListRequest{},
|
||||
"/restmachine/cloudapi/compute/pause": compute.PauseRequest{},
|
||||
"/restmachine/cloudapi/compute/pinToNode": compute.PinToNodeRequest{},
|
||||
"/restmachine/cloudapi/compute/pin_to_node": compute.PinToNodeRequest{},
|
||||
"/restmachine/cloudapi/compute/powerCycle": compute.PowerCycleRequest{},
|
||||
"/restmachine/cloudapi/compute/reboot": compute.RebootRequest{},
|
||||
"/restmachine/cloudapi/compute/redeploy": compute.RedeployRequest{},
|
||||
@@ -212,7 +212,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
||||
"/restmachine/cloudapi/compute/stop": compute.StopRequest{},
|
||||
"/restmachine/cloudapi/compute/tagAdd": compute.TagAddRequest{},
|
||||
"/restmachine/cloudapi/compute/tagRemove": compute.TagRemoveRequest{},
|
||||
"/restmachine/cloudapi/compute/unpinFromNode": compute.UnpinFromNodeRequest{},
|
||||
"/restmachine/cloudapi/compute/unpin_from_node": compute.UnpinFromNodeRequest{},
|
||||
"/restmachine/cloudapi/compute/update": compute.UpdateRequest{},
|
||||
"/restmachine/cloudapi/compute/userGrant": compute.UserGrantRequest{},
|
||||
"/restmachine/cloudapi/compute/userList": compute.UserListRequest{},
|
||||
@@ -225,6 +225,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
||||
"/restmachine/cloudapi/compute/guest_agent_execute": compute.GuestAgentExecuteRequest{},
|
||||
"/restmachine/cloudapi/compute/guest_agent_feature_get": compute.GuestAgentFeatureGetRequest{},
|
||||
"/restmachine/cloudapi/compute/guest_agent_feature_update": compute.GuestAgentFeatureUpdateRequest{},
|
||||
"/restmachine/cloudapi/compute/migrateToZone": compute.MigrateToZoneRequest{},
|
||||
|
||||
// disks
|
||||
"/restmachine/cloudapi/disks/change_disk_storage_policy": disks.ChangeDiskStoragePolicyRequest{},
|
||||
@@ -314,6 +315,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
||||
"/restmachine/cloudapi/k8s/workersGroupGetByName": k8s.WorkersGroupGetByNameRequest{},
|
||||
"/restmachine/cloudapi/k8s/workerReset": k8s.WorkerResetRequest{},
|
||||
"/restmachine/cloudapi/k8s/workerRestart": k8s.WorkerRestartRequest{},
|
||||
"/restmachine/cloudapi/k8s/migrateToZone": k8s.MigrateToZoneRequest{},
|
||||
|
||||
// kvmx86
|
||||
"/restmachine/cloudapi/kvmx86/create": kvmx86.CreateRequest{},
|
||||
@@ -346,6 +348,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
||||
"/restmachine/cloudapi/lb/stop": lb.StopRequest{},
|
||||
"/restmachine/cloudapi/lb/update": lb.UpdateRequest{},
|
||||
"/restmachine/cloudapi/lb/updateSysctlParams": lb.UpdateSysctParamsRequest{},
|
||||
"/restmachine/cloudapi/lb/migrateToZone": lb.MigrateToZoneRequest{},
|
||||
|
||||
// locations
|
||||
"/restmachine/cloudapi/locations/getUrl": EmptyStruct{},
|
||||
@@ -465,6 +468,7 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
||||
"/restmachine/cloudapi/vins/staticRouteList": vins.StaticRouteListRequest{},
|
||||
"/restmachine/cloudapi/vins/vnfdevRedeploy": vins.VNFDevRedeployRequest{},
|
||||
"/restmachine/cloudapi/vins/vnfdevRestart": vins.VNFDevRestartRequest{},
|
||||
"/restmachine/cloudapi/vins/migrateToZone": vins.MigrateToZoneRequest{},
|
||||
|
||||
// zone
|
||||
"/restmachine/cloudapi/zone/get": zone.GetRequest{},
|
||||
@@ -508,6 +512,8 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/account/updateComputeFeatures": account_cb.UpdateComputeFeaturesRequest{},
|
||||
"/restmachine/cloudbroker/account/updateResourceTypes": account_cb.UpdateResourceTypesRequest{},
|
||||
"/restmachine/cloudbroker/account/updateUser": account_cb.UpdateUserRequest{},
|
||||
"/restmachine/cloudbroker/account/addZone": account_cb.AddZoneRequest{},
|
||||
"/restmachine/cloudbroker/account/removeZone": account_cb.RemoveZoneRequest{},
|
||||
|
||||
// apiaccess_cb
|
||||
"/restmachine/cloudbroker/apiaccess/apisExclude": apiaccess_cb.APIsExcludeRequest{},
|
||||
@@ -650,6 +656,10 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/compute/guest_agent_feature_get": compute_cb.GuestAgentFeatureGetRequest{},
|
||||
"/restmachine/cloudbroker/compute/guest_agent_feature_update": compute_cb.GuestAgentFeatureUpdateRequest{},
|
||||
"/restmachine/cloudbroker/compute/change_read_only": compute_cb.ChangeReadOnlyRequest{},
|
||||
"/restmachine/cloudbroker/compute/migrateToZone": compute_cb.MigrateToZoneRequest{},
|
||||
"/restmachine/cloudbroker/compute/migrate_abort": compute_cb.MigrateAbortRequest{},
|
||||
"/restmachine/cloudbroker/compute/start_migration_out": compute_cb.StartMigrationOutRequest{},
|
||||
"/restmachine/cloudbroker/compute/stop_migration_out": compute_cb.StopMigrationOutRequest{},
|
||||
|
||||
// disks
|
||||
"/restmachine/cloudbroker/disks/change_disk_storage_policy": disks_cb.ChangeDiskStoragePolicyRequest{},
|
||||
@@ -726,6 +736,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/extnet/staticRouteDel": extnet_cb.StaticRouteDelRequest{},
|
||||
"/restmachine/cloudbroker/extnet/staticRouteList": extnet_cb.StaticRouteListRequest{},
|
||||
"/restmachine/cloudbroker/extnet/update": extnet_cb.UpdateRequest{},
|
||||
"/restmachine/cloudbroker/extnet/migrateToZone": extnet_cb.MigrateToZoneRequest{},
|
||||
|
||||
// flipgroup
|
||||
"/restmachine/cloudbroker/flipgroup/computeAdd": flipgroup_cb.ComputeAddRequest{},
|
||||
@@ -824,6 +835,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/k8s/workersGroupGetByName": k8s_cb.WorkersGroupGetByNameRequest{},
|
||||
"/restmachine/cloudbroker/k8s/workerReset": k8s_cb.WorkerResetRequest{},
|
||||
"/restmachine/cloudbroker/k8s/workerRestart": k8s_cb.WorkerRestartRequest{},
|
||||
"/restmachine/cloudbroker/k8s/migrateToZone": k8s_cb.MigrateToZoneRequest{},
|
||||
|
||||
// kvmx86
|
||||
"/restmachine/cloudbroker/kvmx86/create": kvmx86_cb.CreateRequest{},
|
||||
@@ -857,6 +869,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/lb/stop": lb_cb.StopRequest{},
|
||||
"/restmachine/cloudbroker/lb/update": lb_cb.UpdateRequest{},
|
||||
"/restmachine/cloudbroker/lb/updateSysctlParams": lb_cb.UpdateSysctParamsRequest{},
|
||||
"/restmachine/cloudbroker/lb/migrateToZone": lb_cb.MigrateToZoneRequest{},
|
||||
|
||||
// node
|
||||
"/restmachine/cloudbroker/node/add_ssh_identity": node_cb.AddSSHIdentityRequest{},
|
||||
@@ -976,6 +989,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/sep/sharedLockStop": sep_cb.SharedLockStopRequest{},
|
||||
"/restmachine/cloudbroker/sep/listAvailableSepAndPools": sep_cb.ListAvailableSEPAndPoolsRequest{},
|
||||
"/restmachine/cloudbroker/sep/sharedLockStart": sep_cb.SharedLockStartRequest{},
|
||||
"/restmachine/cloudbroker/sep/getTemplate": sep_cb.GetTemplateRequest{},
|
||||
|
||||
// storage_policy
|
||||
"/restmachine/cloudbroker/storage_policy/get": stpolicy_cb.GetRequest{},
|
||||
@@ -1074,6 +1088,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/vins/vnfdevReset": vins_cb.VNFDevResetRequest{},
|
||||
"/restmachine/cloudbroker/vins/vnfdevStart": vins_cb.VNFDevStartRequest{},
|
||||
"/restmachine/cloudbroker/vins/vnfdevStop": vins_cb.VNFDevStopRequest{},
|
||||
"/restmachine/cloudbroker/vins/migrateToZone": vins_cb.MigrateToZoneRequest{},
|
||||
|
||||
// zone
|
||||
"/restmachine/cloudbroker/zone/get": zone_cb.GetRequest{},
|
||||
|
||||
@@ -33,57 +33,101 @@ func getParameters(input map[string]interface{}) []interface{} {
|
||||
return emptySlice
|
||||
}
|
||||
|
||||
params, ok := parameters["parameters"]
|
||||
if !ok {
|
||||
return emptySlice
|
||||
var result []interface{}
|
||||
|
||||
//Check for requestBody
|
||||
if requestBody, ok := parameters["requestBody"].(map[string]interface{}); ok {
|
||||
if content, ok := requestBody["content"].(map[string]interface{}); ok {
|
||||
// Check for application/x-www-form-urlencoded, application/json, or multipart/form-data
|
||||
var schemaData map[string]interface{}
|
||||
var found bool
|
||||
|
||||
if formData, ok := content["application/x-www-form-urlencoded"].(map[string]interface{}); ok {
|
||||
if schema, ok := formData["schema"].(map[string]interface{}); ok {
|
||||
schemaData = schema
|
||||
found = true
|
||||
}
|
||||
} else if jsonData, ok := content["application/json"].(map[string]interface{}); ok {
|
||||
if schema, ok := jsonData["schema"].(map[string]interface{}); ok {
|
||||
schemaData = schema
|
||||
found = true
|
||||
}
|
||||
} else if multipartData, ok := content["multipart/form-data"].(map[string]interface{}); ok {
|
||||
if schema, ok := multipartData["schema"].(map[string]interface{}); ok {
|
||||
schemaData = schema
|
||||
found = true
|
||||
}
|
||||
}
|
||||
|
||||
if found && schemaData != nil {
|
||||
if properties, ok := schemaData["properties"].(map[string]interface{}); ok {
|
||||
requiredFields := make(map[string]bool)
|
||||
if req, ok := schemaData["required"].([]interface{}); ok {
|
||||
for _, r := range req {
|
||||
if reqStr, ok := r.(string); ok {
|
||||
requiredFields[reqStr] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
for name, prop := range properties {
|
||||
propMap, ok := prop.(map[string]interface{})
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
newParam := make(map[string]interface{})
|
||||
newParam["name"] = name
|
||||
if propType, ok := propMap["type"].(string); ok {
|
||||
newParam["type"] = propType
|
||||
}
|
||||
newParam["required"] = requiredFields[name]
|
||||
if propType, ok := propMap["type"].(string); ok && propType == "array" {
|
||||
if items, ok := propMap["items"].(map[string]interface{}); ok {
|
||||
newParam["items"] = items
|
||||
}
|
||||
}
|
||||
result = append(result, newParam)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
res, ok := params.([]interface{})
|
||||
if !ok {
|
||||
return emptySlice
|
||||
}
|
||||
// Check if there's a body parameter
|
||||
for _, p := range res {
|
||||
param, ok := p.(map[string]interface{})
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if param["name"] == "body" {
|
||||
schema, ok := param["schema"].(map[string]interface{})
|
||||
if params, ok := parameters["parameters"].([]interface{}); ok {
|
||||
for _, p := range params {
|
||||
param, ok := p.(map[string]interface{})
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
properties, ok := schema["properties"].(map[string]interface{})
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
requiredFields := make(map[string]bool)
|
||||
if req, ok := schema["required"].([]interface{}); ok {
|
||||
for _, r := range req {
|
||||
requiredFields[r.(string)] = true
|
||||
}
|
||||
}
|
||||
var newParams []interface{}
|
||||
for name, prop := range properties {
|
||||
propMap, ok := prop.(map[string]interface{})
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
newParam := make(map[string]interface{})
|
||||
|
||||
newParam := make(map[string]interface{})
|
||||
if name, ok := param["name"].(string); ok {
|
||||
newParam["name"] = name
|
||||
newParam["type"] = propMap["type"]
|
||||
newParam["required"] = requiredFields[name]
|
||||
if propMap["type"] == "array" {
|
||||
if items, ok := propMap["items"].(map[string]interface{}); ok {
|
||||
}
|
||||
if schema, ok := param["schema"].(map[string]interface{}); ok {
|
||||
if paramType, ok := schema["type"].(string); ok {
|
||||
newParam["type"] = paramType
|
||||
}
|
||||
if paramType, ok := schema["type"].(string); ok && paramType == "array" {
|
||||
if items, ok := schema["items"].(map[string]interface{}); ok {
|
||||
newParam["items"] = items
|
||||
}
|
||||
}
|
||||
newParams = append(newParams, newParam)
|
||||
}
|
||||
return newParams
|
||||
// Handle required field
|
||||
if required, ok := param["required"].(bool); ok {
|
||||
newParam["required"] = required
|
||||
} else {
|
||||
newParam["required"] = false
|
||||
}
|
||||
result = append(result, newParam)
|
||||
}
|
||||
}
|
||||
return res
|
||||
|
||||
if len(result) > 0 {
|
||||
return result
|
||||
}
|
||||
|
||||
return emptySlice
|
||||
}
|
||||
|
||||
func getBytesFromJSON(fileName string, t *testing.T) []byte {
|
||||
|
||||
@@ -48,6 +48,7 @@ var DEPRECATED_GROUPS = []string{
|
||||
"/cloudbroker/vins/staticRouteAccessGrant",
|
||||
"/cloudbroker/vins/staticRouteAccessRevoke",
|
||||
"/restmachine/cloudbroker/image/updateNodes",
|
||||
"/restmachine/cloudbroker/image/uploadImageFile",
|
||||
}
|
||||
|
||||
// getUrlsFromBytes converts bytes to array of urls strings
|
||||
|
||||
Reference in New Issue
Block a user