v1.11.3
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
1. Тесты находятся по директории `decort-sdk/tests/platform_upgrade`
|
||||
2. Внутри директории нужно создать и заполнить файл `.env` по аналогии с `.env.template` для доступа к платформе
|
||||
3. Внутри директории нужно создать и заполнить файл `input.json`, содержащий json с раздела [POST /system/docgenerator/prepareCatalog](https://delta.qa.loc/system/ActorApi?group=system#!/system__docgenerator/post_system_docgenerator_prepareCatalog) (для получения json нажать кнопку Try it Out!) - требуется только для тестов запросов и тестов API методов
|
||||
3. Внутри директории нужно создать и заполнить файл `input.json`, содержащий json из метода [POST /system/docgenerator/prepareCatalog](https://delta.qa.loc/portal/#/api/system) (для получения json нажать кнопку Try it Out!) - требуется только для тестов запросов и тестов API методов
|
||||
|
||||
Примечание: тесты можно запускать напрямую методами среды разработки либо из командной строки из нужной директории, например командой `go test -v -run <TestName>`, где `<TestName>` - название запускаемого теста.
|
||||
|
||||
|
||||
@@ -21,10 +21,6 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/stack"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/tasks"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/vins"
|
||||
disks_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/disks"
|
||||
image_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/image"
|
||||
node_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/node"
|
||||
|
||||
account_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/account"
|
||||
audit_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/audit"
|
||||
bservice_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/bservice"
|
||||
@@ -33,9 +29,11 @@ import (
|
||||
extnet_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/extnet"
|
||||
flipgroup_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/flipgroup"
|
||||
grid_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/grid"
|
||||
image_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/image"
|
||||
k8ci_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/k8ci"
|
||||
k8s_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/k8s"
|
||||
lb_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/lb"
|
||||
node_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/node"
|
||||
pcidevice_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/pcidevice"
|
||||
rg_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/rg"
|
||||
sep_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/sep"
|
||||
@@ -53,8 +51,6 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
t.Fatalf("Cannot get client: %v", err)
|
||||
}
|
||||
|
||||
const logFileName = "test_get_list_cloudAPI.log"
|
||||
var testLogs []string
|
||||
// Account
|
||||
// List
|
||||
bytes, err = client.CloudAPI().Account().ListRaw(context.Background(), account.ListRequest{})
|
||||
@@ -62,7 +58,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
testLogs = append(testLogs, getResult("Account list", bytes, account.ListAccounts{}, t))
|
||||
getResult("Account list", bytes, account.ListAccounts{}, t)
|
||||
// Get
|
||||
listAcc, _ := client.CloudAPI().Account().List(context.Background(), account.ListRequest{})
|
||||
if len(listAcc.Data) > 0 {
|
||||
@@ -71,7 +67,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Account get", bytes, account.RecordAccount{}, t))
|
||||
getResult("Account get", bytes, account.RecordAccount{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Account get because account list is empty")
|
||||
}
|
||||
@@ -82,7 +78,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Bservice list", bytes, bservice.ListBasicServices{}, t))
|
||||
getResult("Bservice list", bytes, bservice.ListBasicServices{}, t)
|
||||
// Get
|
||||
listBServ, _ := client.CloudAPI().BService().List(context.Background(), bservice.ListRequest{})
|
||||
if len(listBServ.Data) > 0 {
|
||||
@@ -91,7 +87,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Bservice get", bytes, bservice.RecordBasicService{}, t))
|
||||
getResult("Bservice get", bytes, bservice.RecordBasicService{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Bservice get because bservice list is empty")
|
||||
}
|
||||
@@ -102,7 +98,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Compute list", bytes, compute.ListComputes{}, t))
|
||||
getResult("Compute list", bytes, compute.ListComputes{}, t)
|
||||
// Get
|
||||
listComp, _ := client.CloudAPI().Compute().List(context.Background(), compute.ListRequest{})
|
||||
if len(listComp.Data) > 0 {
|
||||
@@ -111,7 +107,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Compute get", bytes, compute.RecordCompute{}, t))
|
||||
getResult("Compute get", bytes, compute.RecordCompute{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Compute get because compute list is empty")
|
||||
}
|
||||
@@ -122,7 +118,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Disk list", bytes, disks.ListDisks{}, t))
|
||||
getResult("Disk list", bytes, disks.ListDisks{}, t)
|
||||
// Get
|
||||
listDisk, _ := client.CloudAPI().Disks().List(context.Background(), disks.ListRequest{})
|
||||
if len(listDisk.Data) > 0 {
|
||||
@@ -131,7 +127,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Disk get", bytes, disks.RecordDisk{}, t))
|
||||
getResult("Disk get", bytes, disks.RecordDisk{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Disk get because disk list is empty")
|
||||
}
|
||||
@@ -142,7 +138,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("ExtNet list", bytes, extnet.ListExtNets{}, t))
|
||||
getResult("ExtNet list", bytes, extnet.ListExtNets{}, t)
|
||||
// Get
|
||||
listExtNet, _ := client.CloudAPI().ExtNet().List(context.Background(), extnet.ListRequest{})
|
||||
if len(listExtNet.Data) > 0 {
|
||||
@@ -151,7 +147,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("ExtNet get", bytes, extnet.RecordExtNet{}, t))
|
||||
getResult("ExtNet get", bytes, extnet.RecordExtNet{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test ExtNet get because listExtNet list is empty")
|
||||
}
|
||||
@@ -162,7 +158,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("FLIPGroup list", bytes, flipgroup.ListFLIPGroups{}, t))
|
||||
getResult("FLIPGroup list", bytes, flipgroup.ListFLIPGroups{}, t)
|
||||
// Get
|
||||
listFG, _ := client.CloudAPI().FLIPGroup().List(context.Background(), flipgroup.ListRequest{})
|
||||
if len(listFG.Data) > 0 {
|
||||
@@ -171,7 +167,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("FLIPGroup get", bytes, flipgroup.RecordFLIPGroup{}, t))
|
||||
getResult("FLIPGroup get", bytes, flipgroup.RecordFLIPGroup{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test FLIPGroup get because flipgroup list is empty")
|
||||
}
|
||||
@@ -182,7 +178,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Image list", bytes, image.ListImages{}, t))
|
||||
getResult("Image list", bytes, image.ListImages{}, t)
|
||||
// Get
|
||||
listImg, _ := client.CloudAPI().Image().List(context.Background(), image.ListRequest{})
|
||||
if len(listImg.Data) > 0 {
|
||||
@@ -191,7 +187,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Image get", bytes, image.RecordImage{}, t))
|
||||
getResult("Image get", bytes, image.RecordImage{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Image get because Image list is empty")
|
||||
}
|
||||
@@ -202,7 +198,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("K8CI list", bytes, k8ci.ListK8CI{}, t))
|
||||
getResult("K8CI list", bytes, k8ci.ListK8CI{}, t)
|
||||
// Get
|
||||
listk8ci, _ := client.CloudAPI().K8CI().List(context.Background(), k8ci.ListRequest{})
|
||||
if len(listk8ci.Data) > 0 {
|
||||
@@ -211,7 +207,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("K8CI get", bytes, k8ci.RecordK8CI{}, t))
|
||||
getResult("K8CI get", bytes, k8ci.RecordK8CI{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test K8CI get because K8CI list is empty")
|
||||
}
|
||||
@@ -222,7 +218,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("K8S list", bytes, k8s.ListK8SClusters{}, t))
|
||||
getResult("K8S list", bytes, k8s.ListK8SClusters{}, t)
|
||||
// Get
|
||||
listk8s, _ := client.CloudAPI().K8S().List(context.Background(), k8s.ListRequest{})
|
||||
if len(listk8s.Data) > 0 {
|
||||
@@ -231,7 +227,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("K8S get", bytes, k8s.RecordK8S{}, t))
|
||||
getResult("K8S get", bytes, k8s.RecordK8S{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test K8S get because K8S list is empty")
|
||||
}
|
||||
@@ -242,7 +238,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("LB list", bytes, lb.ListLB{}, t))
|
||||
getResult("LB list", bytes, lb.ListLB{}, t)
|
||||
// Get
|
||||
listLB, _ := client.CloudAPI().LB().List(context.Background(), lb.ListRequest{})
|
||||
if len(listLB.Data) > 0 {
|
||||
@@ -251,7 +247,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("LB get", bytes, lb.RecordLB{}, t))
|
||||
getResult("LB get", bytes, lb.RecordLB{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test LB get because LB list is empty")
|
||||
}
|
||||
@@ -262,7 +258,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Locations list", bytes, locations.ListLocations{}, t))
|
||||
getResult("Locations list", bytes, locations.ListLocations{}, t)
|
||||
|
||||
// RG
|
||||
// List
|
||||
@@ -270,7 +266,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("RG list", bytes, rg.ListResourceGroups{}, t))
|
||||
getResult("RG list", bytes, rg.ListResourceGroups{}, t)
|
||||
// Get
|
||||
listRG, _ := client.CloudAPI().RG().List(context.Background(), rg.ListRequest{})
|
||||
if len(listRG.Data) > 0 {
|
||||
@@ -279,7 +275,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("RG get", bytes, rg.RecordResourceGroup{}, t))
|
||||
getResult("RG get", bytes, rg.RecordResourceGroup{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test RG get because RG list is empty")
|
||||
}
|
||||
@@ -290,7 +286,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("SEP list", bytes, sep.ListAvailableSEP{}, t))
|
||||
getResult("SEP list", bytes, sep.ListAvailableSEP{}, t)
|
||||
|
||||
// Stack
|
||||
// List
|
||||
@@ -298,7 +294,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Stack list", bytes, stack.ListStacks{}, t))
|
||||
getResult("Stack list", bytes, stack.ListStacks{}, t)
|
||||
|
||||
// Tasks
|
||||
// List
|
||||
@@ -306,7 +302,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Tasks list", bytes, tasks.ListTasks{}, t))
|
||||
getResult("Tasks list", bytes, tasks.ListTasks{}, t)
|
||||
// Get
|
||||
listTasks, _ := client.CloudAPI().Tasks().List(context.Background(), tasks.ListRequest{})
|
||||
if len(listTasks.Data) > 0 {
|
||||
@@ -315,7 +311,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Tasks get", bytes, tasks.RecordAsyncTask{}, t))
|
||||
getResult("Tasks get", bytes, tasks.RecordAsyncTask{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Tasks get because Tasks list is empty")
|
||||
}
|
||||
@@ -326,7 +322,7 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("VINS list", bytes, vins.ListVINS{}, t))
|
||||
getResult("VINS list", bytes, vins.ListVINS{}, t)
|
||||
// Get
|
||||
listVINS, _ := client.CloudAPI().VINS().List(context.Background(), vins.ListRequest{})
|
||||
if len(listVINS.Data) > 0 {
|
||||
@@ -335,12 +331,11 @@ func TestGetListCloudAPI(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("VINS get", bytes, vins.RecordVINS{}, t))
|
||||
getResult("VINS get", bytes, vins.RecordVINS{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test VINS get because VINS list is empty")
|
||||
}
|
||||
|
||||
compareLogs(logFileName, testLogs, t, "get")
|
||||
}
|
||||
|
||||
// WARNING: not working correctly due to inclusions of tagless structures in cloudbroker
|
||||
@@ -353,15 +348,13 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
t.Fatalf("Cannot get client: %v", err)
|
||||
}
|
||||
|
||||
const logFileName = "test_get_list_cloudbroker.log"
|
||||
var testLogs = make([]string, 0)
|
||||
// Account
|
||||
// List
|
||||
bytes, err = client.CloudBroker().Account().ListRaw(context.Background(), account_cb.ListRequest{})
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Account list", bytes, account_cb.ListAccounts{}, t))
|
||||
getResult("Account list", bytes, account_cb.ListAccounts{}, t)
|
||||
// Get
|
||||
listAcc, _ := client.CloudBroker().Account().List(context.Background(), account_cb.ListRequest{})
|
||||
if len(listAcc.Data) > 0 {
|
||||
@@ -370,7 +363,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Account get", bytes, account_cb.RecordAccount{}, t))
|
||||
getResult("Account get", bytes, account_cb.RecordAccount{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Account get because account list is empty")
|
||||
}
|
||||
@@ -381,7 +374,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Audit list", bytes, audit_cb.ListAudits{}, t))
|
||||
getResult("Audit list", bytes, audit_cb.ListAudits{}, t)
|
||||
// Get
|
||||
listAudits, _ := client.CloudBroker().Audit().List(context.Background(), audit_cb.ListRequest{})
|
||||
if len(listAudits.Data) > 0 {
|
||||
@@ -390,7 +383,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Audit get", bytes, audit_cb.RecordAudit{}, t))
|
||||
getResult("Audit get", bytes, audit_cb.RecordAudit{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Audit get because Audit list is empty")
|
||||
}
|
||||
@@ -401,7 +394,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Bservice list", bytes, bservice_cb.ListBasicServices{}, t))
|
||||
getResult("Bservice list", bytes, bservice_cb.ListBasicServices{}, t)
|
||||
// Get
|
||||
listBServ, _ := client.CloudBroker().BService().List(context.Background(), bservice_cb.ListRequest{})
|
||||
if len(listBServ.Data) > 0 {
|
||||
@@ -410,7 +403,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Bservice get", bytes, bservice_cb.RecordBasicService{}, t))
|
||||
getResult("Bservice get", bytes, bservice_cb.RecordBasicService{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Bservice get because bservice list is empty")
|
||||
}
|
||||
@@ -421,7 +414,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Compute list", bytes, compute_cb.ListComputes{}, t))
|
||||
getResult("Compute list", bytes, compute_cb.ListComputes{}, t)
|
||||
// Get
|
||||
listComp, _ := client.CloudBroker().Compute().List(context.Background(), compute_cb.ListRequest{})
|
||||
if len(listComp.Data) > 0 {
|
||||
@@ -430,7 +423,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Compute get", bytes, compute_cb.RecordCompute{}, t))
|
||||
getResult("Compute get", bytes, compute_cb.RecordCompute{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Compute get because compute list is empty")
|
||||
}
|
||||
@@ -441,7 +434,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Disk list", bytes, disks_cb.ListDisks{}, t))
|
||||
getResult("Disk list", bytes, disks_cb.ListDisks{}, t)
|
||||
// Get
|
||||
listDisk, _ := client.CloudBroker().Disks().List(context.Background(), disks_cb.ListRequest{})
|
||||
if len(listDisk.Data) > 0 {
|
||||
@@ -450,7 +443,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Disk get", bytes, disks_cb.RecordDisk{}, t))
|
||||
getResult("Disk get", bytes, disks_cb.RecordDisk{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Disk get because disk list is empty")
|
||||
}
|
||||
@@ -461,7 +454,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("ExtNet list", bytes, extnet_cb.ListExtNet{}, t))
|
||||
getResult("ExtNet list", bytes, extnet_cb.ListExtNet{}, t)
|
||||
// Get
|
||||
listExtNet, _ := client.CloudBroker().ExtNet().List(context.Background(), extnet_cb.ListRequest{})
|
||||
if len(listExtNet.Data) > 0 {
|
||||
@@ -470,7 +463,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("ExtNet get", bytes, extnet_cb.RecordExtNet{}, t))
|
||||
getResult("ExtNet get", bytes, extnet_cb.RecordExtNet{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test ExtNet get because listExtNet list is empty")
|
||||
}
|
||||
@@ -481,7 +474,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("FLIPGroup list", bytes, flipgroup_cb.ListFLIPGroups{}, t))
|
||||
getResult("FLIPGroup list", bytes, flipgroup_cb.ListFLIPGroups{}, t)
|
||||
// Get
|
||||
listFG, _ := client.CloudBroker().FLIPGroup().List(context.Background(), flipgroup_cb.ListRequest{})
|
||||
if len(listFG.Data) > 0 {
|
||||
@@ -490,7 +483,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("FLIPGroup get", bytes, flipgroup_cb.RecordFLIPGroup{}, t))
|
||||
getResult("FLIPGroup get", bytes, flipgroup_cb.RecordFLIPGroup{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test FLIPGroup get because flipgroup list is empty")
|
||||
}
|
||||
@@ -501,7 +494,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Grid list", bytes, grid_cb.ListGrids{}, t))
|
||||
getResult("Grid list", bytes, grid_cb.ListGrids{}, t)
|
||||
// Get
|
||||
listGrid, _ := client.CloudBroker().Grid().List(context.Background(), grid_cb.ListRequest{})
|
||||
if len(listGrid.Data) > 0 {
|
||||
@@ -510,7 +503,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Grid get", bytes, grid_cb.RecordGrid{}, t))
|
||||
getResult("Grid get", bytes, grid_cb.RecordGrid{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Grid get because Grid list is empty")
|
||||
}
|
||||
@@ -521,7 +514,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Image list", bytes, image_cb.ListImages{}, t))
|
||||
getResult("Image list", bytes, image_cb.ListImages{}, t)
|
||||
// Get
|
||||
listImg, _ := client.CloudBroker().Image().List(context.Background(), image_cb.ListRequest{})
|
||||
if len(listImg.Data) > 0 {
|
||||
@@ -530,7 +523,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Image get", bytes, image_cb.RecordImage{}, t))
|
||||
getResult("Image get", bytes, image_cb.RecordImage{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Image get because Image list is empty")
|
||||
}
|
||||
@@ -541,7 +534,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("K8CI list", bytes, k8ci_cb.ListK8CI{}, t))
|
||||
getResult("K8CI list", bytes, k8ci_cb.ListK8CI{}, t)
|
||||
// Get
|
||||
listk8ci, _ := client.CloudBroker().K8CI().List(context.Background(), k8ci_cb.ListRequest{})
|
||||
if len(listk8ci.Data) > 0 {
|
||||
@@ -550,7 +543,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("K8CI get", bytes, k8ci_cb.RecordK8CI{}, t))
|
||||
getResult("K8CI get", bytes, k8ci_cb.RecordK8CI{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test K8CI get because K8CI list is empty")
|
||||
}
|
||||
@@ -561,7 +554,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("K8S list", bytes, k8s_cb.ListK8S{}, t))
|
||||
getResult("K8S list", bytes, k8s_cb.ListK8S{}, t)
|
||||
// Get
|
||||
listk8s, _ := client.CloudBroker().K8S().List(context.Background(), k8s_cb.ListRequest{})
|
||||
if len(listk8s.Data) > 0 {
|
||||
@@ -570,7 +563,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("K8S get", bytes, k8s_cb.RecordK8S{}, t))
|
||||
getResult("K8S get", bytes, k8s_cb.RecordK8S{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test K8S get because K8S list is empty")
|
||||
}
|
||||
@@ -581,7 +574,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("LB list", bytes, lb_cb.ListLB{}, t))
|
||||
getResult("LB list", bytes, lb_cb.ListLB{}, t)
|
||||
// Get
|
||||
listLB, _ := client.CloudBroker().LB().List(context.Background(), lb_cb.ListRequest{})
|
||||
if len(listLB.Data) > 0 {
|
||||
@@ -590,7 +583,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("LB get", bytes, lb_cb.RecordLB{}, t))
|
||||
getResult("LB get", bytes, lb_cb.RecordLB{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test LB get because LB list is empty")
|
||||
}
|
||||
@@ -601,7 +594,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Node list", bytes, node_cb.ListNodes{}, t))
|
||||
getResult("Node list", bytes, node_cb.ListNodes{}, t)
|
||||
// Get
|
||||
listNode, _ := client.CloudBroker().Node().List(context.Background(), node_cb.ListRequest{})
|
||||
if len(listLB.Data) > 0 {
|
||||
@@ -610,7 +603,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Node get", bytes, node_cb.RecordNode{}, t))
|
||||
getResult("Node get", bytes, node_cb.RecordNode{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Node get because LB list is empty")
|
||||
}
|
||||
@@ -621,7 +614,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Pcidevice list", bytes, pcidevice_cb.ListPCIDevices{}, t))
|
||||
getResult("Pcidevice list", bytes, pcidevice_cb.ListPCIDevices{}, t)
|
||||
|
||||
// RG
|
||||
// List
|
||||
@@ -629,7 +622,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("RG list", bytes, rg_cb.ListRG{}, t))
|
||||
getResult("RG list", bytes, rg_cb.ListRG{}, t)
|
||||
// Get
|
||||
listRG, _ := client.CloudBroker().RG().List(context.Background(), rg_cb.ListRequest{})
|
||||
if len(listRG.Data) > 0 {
|
||||
@@ -638,7 +631,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("RG get", bytes, rg_cb.RecordRG{}, t))
|
||||
getResult("RG get", bytes, rg_cb.RecordRG{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test RG get because RG list is empty")
|
||||
}
|
||||
@@ -649,7 +642,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("SEP list", bytes, sep_cb.ListSEP{}, t))
|
||||
getResult("SEP list", bytes, sep_cb.ListSEP{}, t)
|
||||
// Get
|
||||
listSEP, _ := client.CloudBroker().SEP().List(context.Background(), sep_cb.ListRequest{})
|
||||
if len(listSEP.Data) > 0 {
|
||||
@@ -658,7 +651,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("SEP get", bytes, sep_cb.RecordSEP{}, t))
|
||||
getResult("SEP get", bytes, sep_cb.RecordSEP{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test SEP get because SEP list is empty")
|
||||
}
|
||||
@@ -667,7 +660,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("SEP and pools list", bytes, sep_cb.ListAvailableSEP{}, t))
|
||||
getResult("SEP and pools list", bytes, sep_cb.ListAvailableSEP{}, t)
|
||||
|
||||
// Stack
|
||||
// List
|
||||
@@ -675,7 +668,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Stack list", bytes, stack_cb.ListStacks{}, t))
|
||||
getResult("Stack list", bytes, stack_cb.ListStacks{}, t)
|
||||
// Get
|
||||
listStack, _ := client.CloudBroker().Stack().List(context.Background(), stack_cb.ListRequest{})
|
||||
if len(listStack.Data) > 0 {
|
||||
@@ -684,7 +677,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Stack get", bytes, stack_cb.InfoStack{}, t))
|
||||
getResult("Stack get", bytes, stack_cb.InfoStack{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test Stack get because Stack list is empty")
|
||||
}
|
||||
@@ -695,7 +688,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("Tasks list", bytes, tasks_cb.ListTasks{}, t))
|
||||
getResult("Tasks list", bytes, tasks_cb.ListTasks{}, t)
|
||||
|
||||
// VINS
|
||||
// List
|
||||
@@ -703,7 +696,7 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("VINS list", bytes, vins_cb.ListVINS{}, t))
|
||||
getResult("VINS list", bytes, vins_cb.ListVINS{}, t)
|
||||
// Get
|
||||
listVINS, _ := client.CloudBroker().VINS().List(context.Background(), vins_cb.ListRequest{})
|
||||
if len(listVINS.Data) > 0 {
|
||||
@@ -712,11 +705,10 @@ func TestGetListCloudbroker(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
testLogs = append(testLogs, getResult("VINS get", bytes, vins_cb.RecordVINS{}, t))
|
||||
getResult("VINS get", bytes, vins_cb.RecordVINS{}, t)
|
||||
} else {
|
||||
t.Errorf("Can not test VINS get because VINS list is empty")
|
||||
}
|
||||
compareLogs(logFileName, testLogs, t, "get")
|
||||
}
|
||||
|
||||
// TestRequestsCloudAPI tests platform requests vs. golang request structures in sdk for cloudapi requests
|
||||
@@ -759,4 +751,38 @@ func TestGetAllPaths(t *testing.T) {
|
||||
}
|
||||
t.Errorf(errorText)
|
||||
}
|
||||
|
||||
caTestUrls := getRequestsMapCloudAPI()
|
||||
cbTestUrls := getRequestsMapCloudbroker()
|
||||
|
||||
urlsInTest := make([]string, len(caTestUrls)+len(cbTestUrls))
|
||||
|
||||
i := 0
|
||||
for k := range caTestUrls {
|
||||
urlsInTest[i] = k
|
||||
i++
|
||||
}
|
||||
for k := range cbTestUrls {
|
||||
urlsInTest[i] = k
|
||||
i++
|
||||
}
|
||||
|
||||
missingUrls = getMissingDecortUrls(jsonUrls, urlsInTest)
|
||||
if len(missingUrls) > 0 {
|
||||
errorText := fmt.Sprintf("Below API handlers (%d in total) need to be added to request map:\n", len(missingUrls))
|
||||
for _, r := range missingUrls {
|
||||
errorText += fmt.Sprintln(r)
|
||||
}
|
||||
t.Errorf(errorText)
|
||||
}
|
||||
|
||||
deprecatedUrls = getDeprecatedDecortUrls(jsonUrls, urlsInTest)
|
||||
if len(deprecatedUrls) > 0 {
|
||||
errorText := fmt.Sprintf("Below API handlers (%d in total) need to be delete to request map:\n", len(deprecatedUrls))
|
||||
for _, r := range deprecatedUrls {
|
||||
errorText += fmt.Sprintln(r)
|
||||
}
|
||||
t.Errorf(errorText)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/lb"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/locations"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/pcidevice"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/prometheus"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/rg"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/sep"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/stack"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/tasks"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/user"
|
||||
@@ -41,6 +43,7 @@ import (
|
||||
lb_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/lb"
|
||||
node_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/node"
|
||||
pcidevice_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/pcidevice"
|
||||
prometheus_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/prometheus"
|
||||
rg_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/rg"
|
||||
sep_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/sep"
|
||||
stack_cb "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/stack"
|
||||
@@ -188,6 +191,8 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
||||
"/restmachine/cloudapi/compute/userList": compute.UserListRequest{},
|
||||
"/restmachine/cloudapi/compute/userRevoke": compute.UserRevokeRequest{},
|
||||
"/restmachine/cloudapi/compute/userUpdate": compute.UserUpdateRequest{},
|
||||
"/restmachine/cloudapi/compute/changeMac": compute.ChangeMACRequest{},
|
||||
"/restmachine/cloudapi/compute/changeIp": compute.ChangeIPRequest{},
|
||||
|
||||
// disks
|
||||
"/restmachine/cloudapi/disks/create": disks.CreateRequest{},
|
||||
@@ -315,6 +320,23 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
||||
// pcidevice
|
||||
"/restmachine/cloudapi/pcidevice/list": pcidevice.ListRequest{},
|
||||
|
||||
// prometheus
|
||||
"/restmachine/cloudapi/prometheus/computeTransmitPackets": prometheus.ComputeTransmitPacketsRequest{},
|
||||
"/restmachine/cloudapi/prometheus/computeWriteRequests": prometheus.ComputeWriteRequestsRequest{},
|
||||
"/restmachine/cloudapi/prometheus/computeCPUload": prometheus.ComputeCPULoadRequest{},
|
||||
"/restmachine/cloudapi/prometheus/computeTransmitBytes": prometheus.ComputeTransmitBytesRequest{},
|
||||
"/restmachine/cloudapi/prometheus/computeMemoryUsed": prometheus.ComputeMemoryUsedRequest{},
|
||||
"/restmachine/cloudapi/prometheus/computeMemoryUsable": prometheus.ComputeMemoryUsableRequest{},
|
||||
"/restmachine/cloudapi/prometheus/computeMemoryAvailable": prometheus.ComputeMemoryAvailableRequest{},
|
||||
"/restmachine/cloudapi/prometheus/computeReceiveBytes": prometheus.ComputeReceiveBytesRequest{},
|
||||
"/restmachine/cloudapi/prometheus/computes": prometheus.ComputesRequest{},
|
||||
"/restmachine/cloudapi/prometheus/computeReceivePackets": prometheus.ComputeReceivePacketsRequest{},
|
||||
"/restmachine/cloudapi/prometheus/computeReadRequests": prometheus.ComputeReadRequestsRequest{},
|
||||
"/restmachine/cloudapi/prometheus/computeWriteBytes": prometheus.ComputeWriteBytesRequest{},
|
||||
"/restmachine/cloudapi/prometheus/computeReadBytes": prometheus.ComputeReadBytesRequest{},
|
||||
"/restmachine/cloudapi/prometheus/computeMemoryUsage": prometheus.ComputeMemoryUsageRequest{},
|
||||
"/restmachine/cloudapi/prometheus/computeMemoryUnused": prometheus.ComputeMemoryUnusedRequest{},
|
||||
|
||||
// rg
|
||||
"/restmachine/cloudapi/rg/accessGrant": rg.AccessGrantRequest{},
|
||||
"/restmachine/cloudapi/rg/accessRevoke": rg.AccessRevokeRequest{},
|
||||
@@ -339,6 +361,10 @@ func getRequestsMapCloudAPI() map[string]interface{} {
|
||||
"/restmachine/cloudapi/rg/setDefNet": rg.SetDefNetRequest{},
|
||||
"/restmachine/cloudapi/rg/update": rg.UpdateRequest{},
|
||||
"/restmachine/cloudapi/rg/usage": rg.UsageRequest{},
|
||||
"/restmachine/cloudapi/rg/removeDefNet": rg.RemoveDefNetRequest{},
|
||||
|
||||
// sep
|
||||
"/restmachine/cloudapi/sep/listAvailableSepAndPools": sep.ListAvailableSEPAndPoolsRequest{},
|
||||
|
||||
// stack, tasks
|
||||
"/restmachine/cloudapi/stack/get": stack.GetRequest{},
|
||||
@@ -427,27 +453,28 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/account/updateUser": account_cb.UpdateUserRequest{},
|
||||
|
||||
// apiaccess_cb
|
||||
"/restmachine/cloudbroker/apiaccess/apisExclude": apiaccess_cb.APIsExcludeRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/apiFind": apiaccess_cb.APIFindRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/apisInclude": apiaccess_cb.APIsIncludeRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/copy": apiaccess_cb.CopyRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/create": apiaccess_cb.CreateRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/delete": apiaccess_cb.DeleteRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/descUpdate": apiaccess_cb.DescUpdateRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/get": apiaccess_cb.GetRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/getFull": EmptyStruct{},
|
||||
"/restmachine/cloudbroker/apiaccess/getPreGroups": EmptyStruct{},
|
||||
"/restmachine/cloudbroker/apiaccess/list": apiaccess_cb.ListRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/setDefault": apiaccess_cb.SetDefaultRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/subtract": apiaccess_cb.SubtractRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/union": apiaccess_cb.UnionRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/update": apiaccess_cb.UpdateRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/userList": apiaccess_cb.UserListRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/apisExclude": apiaccess_cb.APIsExcludeRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/apiFind": apiaccess_cb.APIFindRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/apisInclude": apiaccess_cb.APIsIncludeRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/copy": apiaccess_cb.CopyRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/create": apiaccess_cb.CreateRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/delete": apiaccess_cb.DeleteRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/descUpdate": apiaccess_cb.DescUpdateRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/get": apiaccess_cb.GetRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/getFull": EmptyStruct{},
|
||||
"/restmachine/cloudbroker/apiaccess/list": apiaccess_cb.ListRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/setDefault": apiaccess_cb.SetDefaultRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/subtract": apiaccess_cb.SubtractRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/union": apiaccess_cb.UnionRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/update": apiaccess_cb.UpdateRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/userList": apiaccess_cb.UserListRequest{},
|
||||
"/restmachine/cloudbroker/apiaccess/getDefault": EmptyStruct{},
|
||||
|
||||
// audit_cb
|
||||
"/restmachine/cloudbroker/audit/get": audit_cb.GetRequest{},
|
||||
"/restmachine/cloudbroker/audit/linkedJobs": audit_cb.LinkedJobsRequest{},
|
||||
"/restmachine/cloudbroker/audit/list": audit_cb.ListRequest{},
|
||||
"/restmachine/cloudbroker/audit/get": audit_cb.GetRequest{},
|
||||
"/restmachine/cloudbroker/audit/linkedJobs": audit_cb.LinkedJobsRequest{},
|
||||
"/restmachine/cloudbroker/audit/list": audit_cb.ListRequest{},
|
||||
"/restmachine/cloudbroker/audit/exportAuditsToFile": EmptyStruct{},
|
||||
|
||||
// backup_cb
|
||||
"/restmachine/cloudbroker/backup/createDiskBackup": backup_cb.CreateDiskBackupRequest{},
|
||||
@@ -548,6 +575,9 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/compute/userList": compute_cb.UserListRequest{},
|
||||
"/restmachine/cloudbroker/compute/userRevoke": compute_cb.UserRevokeRequest{},
|
||||
"/restmachine/cloudbroker/compute/userUpdate": compute_cb.UserUpdateRequest{},
|
||||
"/restmachine/cloudbroker/compute/changeIp": compute_cb.ChangeIPRequest{},
|
||||
"/restmachine/cloudbroker/compute/changeMac": compute_cb.ChangeMACRequest{},
|
||||
"/restmachine/cloudbroker/compute/setNetConfig": compute_cb.SetNetConfigRequest{},
|
||||
|
||||
// disks
|
||||
"/restmachine/cloudbroker/disks/create": disks_cb.CreateRequest{},
|
||||
@@ -570,7 +600,6 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/disks/replicationStatus": disks_cb.ReplicationStatusRequest{},
|
||||
"/restmachine/cloudbroker/disks/replicationStop": disks_cb.ReplicationStopRequest{},
|
||||
"/restmachine/cloudbroker/disks/replicationSuspend": disks_cb.ReplicationSuspendRequest{},
|
||||
"/restmachine/cloudbroker/disks/resize": disks_cb.ResizeRequest{},
|
||||
"/restmachine/cloudbroker/disks/resize2": disks_cb.ResizeRequest{},
|
||||
"/restmachine/cloudbroker/disks/restore": disks_cb.RestoreRequest{},
|
||||
"/restmachine/cloudbroker/disks/search": disks_cb.SearchRequest{},
|
||||
@@ -652,6 +681,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/grid/setMemAllocationRatio": grid_cb.SetMemAllocationRatioRequest{},
|
||||
"/restmachine/cloudbroker/grid/setPasswordPolicy": grid_cb.SetPasswordPolicyRequest{},
|
||||
"/restmachine/cloudbroker/grid/status": EmptyStruct{},
|
||||
"/restmachine/cloudbroker/grid/getSettings": grid_cb.GetSettingsRequest{},
|
||||
|
||||
// group
|
||||
"/restmachine/cloudbroker/group/get": group_cb.GetRequest{},
|
||||
@@ -679,6 +709,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/image/share": image_cb.ShareRequest{},
|
||||
"/restmachine/cloudbroker/image/syncCreateImage": image_cb.SyncCreateRequest{},
|
||||
"/restmachine/cloudbroker/image/updateNodes": image_cb.UpdateNodesRequest{},
|
||||
"/restmachine/cloudbroker/image/uploadImageFile": image_cb.UploadImageFileResponse{},
|
||||
|
||||
// k8ci
|
||||
"/restmachine/cloudbroker/k8ci/accessAdd": k8ci_cb.AccessAddRequest{},
|
||||
@@ -768,6 +799,7 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/node/setsriovstatus": node_cb.SetSRIOVStatusRequest{},
|
||||
"/restmachine/cloudbroker/node/setVFsNumber": node_cb.SetVFsNumberRequest{},
|
||||
"/restmachine/cloudbroker/node/update": node_cb.UpdateRequest{},
|
||||
"/restmachine/cloudbroker/node/setVFsParams": node_cb.VFParam{},
|
||||
|
||||
// pcidevice
|
||||
"/restmachine/cloudbroker/pcidevice/create": pcidevice_cb.CreateRequest{},
|
||||
@@ -776,6 +808,23 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/pcidevice/enable": pcidevice_cb.EnableRequest{},
|
||||
"/restmachine/cloudbroker/pcidevice/list": pcidevice_cb.ListRequest{},
|
||||
|
||||
// prometheus
|
||||
"/restmachine/cloudbroker/prometheus/computeTransmitPackets": prometheus_cb.ComputeTransmitPacketsRequest{},
|
||||
"/restmachine/cloudbroker/prometheus/computeWriteRequests": prometheus_cb.ComputeWriteRequestsRequest{},
|
||||
"/restmachine/cloudbroker/prometheus/computeCPUload": prometheus_cb.ComputeCPULoadRequest{},
|
||||
"/restmachine/cloudbroker/prometheus/computeTransmitBytes": prometheus_cb.ComputeTransmitBytesRequest{},
|
||||
"/restmachine/cloudbroker/prometheus/computeMemoryUsed": prometheus_cb.ComputeMemoryUsedRequest{},
|
||||
"/restmachine/cloudbroker/prometheus/computeMemoryUsable": prometheus_cb.ComputeMemoryUsableRequest{},
|
||||
"/restmachine/cloudbroker/prometheus/computeMemoryAvailable": prometheus_cb.ComputeMemoryAvailableRequest{},
|
||||
"/restmachine/cloudbroker/prometheus/computeReceiveBytes": prometheus_cb.ComputeReceiveBytesRequest{},
|
||||
"/restmachine/cloudbroker/prometheus/computes": prometheus_cb.ComputesRequest{},
|
||||
"/restmachine/cloudbroker/prometheus/computeReceivePackets": prometheus_cb.ComputeReceivePacketsRequest{},
|
||||
"/restmachine/cloudbroker/prometheus/computeReadRequests": prometheus_cb.ComputeReadRequestsRequest{},
|
||||
"/restmachine/cloudbroker/prometheus/computeWriteBytes": prometheus_cb.ComputeWriteBytesRequest{},
|
||||
"/restmachine/cloudbroker/prometheus/computeReadBytes": prometheus_cb.ComputeReadBytesRequest{},
|
||||
"/restmachine/cloudbroker/prometheus/computeMemoryUsage": prometheus_cb.ComputeMemoryUsageRequest{},
|
||||
"/restmachine/cloudbroker/prometheus/computeMemoryUnused": prometheus_cb.ComputeMemoryUnusedRequest{},
|
||||
|
||||
// rg
|
||||
"/restmachine/cloudbroker/rg/accessGrant": rg_cb.AccessGrantRequest{},
|
||||
"/restmachine/cloudbroker/rg/accessRevoke": rg_cb.AccessRevokeRequest{},
|
||||
@@ -807,31 +856,35 @@ func getRequestsMapCloudbroker() map[string]interface{} {
|
||||
"/restmachine/cloudbroker/rg/updateComputeFeatures": rg_cb.UpdateComputeFeaturesRequest{},
|
||||
"/restmachine/cloudbroker/rg/updateResourceTypes": rg_cb.UpdateResourceTypesRequest{},
|
||||
"/restmachine/cloudbroker/rg/usage": rg_cb.UsageRequest{},
|
||||
"/restmachine/cloudbroker/rg/removeDefNet": rg_cb.RemoveDefNetRequest{},
|
||||
|
||||
// sep
|
||||
"/restmachine/cloudbroker/sep/accessGrant": sep_cb.AccessGrantRequest{},
|
||||
"/restmachine/cloudbroker/sep/accessGrantToPool": sep_cb.AccessGrantToPoolRequest{},
|
||||
"/restmachine/cloudbroker/sep/accessRevoke": sep_cb.AccessRevokeRequest{},
|
||||
"/restmachine/cloudbroker/sep/accessRevokeToPool": sep_cb.AccessRevokeToPoolRequest{},
|
||||
"/restmachine/cloudbroker/sep/addConsumerNodes": sep_cb.AddConsumerNodesRequest{},
|
||||
"/restmachine/cloudbroker/sep/addPool": sep_cb.AddPoolRequest{},
|
||||
"/restmachine/cloudbroker/sep/addProviderNodes": sep_cb.AddProviderNodesRequest{},
|
||||
"/restmachine/cloudbroker/sep/configFieldEdit": sep_cb.ConfigFieldEditRequest{},
|
||||
"/restmachine/cloudbroker/sep/configInsert": sep_cb.ConfigInsertRequest{},
|
||||
"/restmachine/cloudbroker/sep/configValidate": sep_cb.ConfigValidateRequest{},
|
||||
"/restmachine/cloudbroker/sep/consumption": sep_cb.ConsumptionRequest{},
|
||||
"/restmachine/cloudbroker/sep/create": sep_cb.CreateRequest{},
|
||||
"/restmachine/cloudbroker/sep/decommission": sep_cb.DecommissionRequest{},
|
||||
"/restmachine/cloudbroker/sep/delConsumerNodes": sep_cb.DelConsumerNodesRequest{},
|
||||
"/restmachine/cloudbroker/sep/delete": sep_cb.DeleteRequest{},
|
||||
"/restmachine/cloudbroker/sep/delPool": sep_cb.DelPoolRequest{},
|
||||
"/restmachine/cloudbroker/sep/disable": sep_cb.DisableRequest{},
|
||||
"/restmachine/cloudbroker/sep/diskList": sep_cb.DiskListRequest{},
|
||||
"/restmachine/cloudbroker/sep/enable": sep_cb.EnableRequest{},
|
||||
"/restmachine/cloudbroker/sep/get": sep_cb.GetRequest{},
|
||||
"/restmachine/cloudbroker/sep/getConfig": sep_cb.GetConfigRequest{},
|
||||
"/restmachine/cloudbroker/sep/getPool": sep_cb.GetPoolRequest{},
|
||||
"/restmachine/cloudbroker/sep/list": sep_cb.ListRequest{},
|
||||
"/restmachine/cloudbroker/sep/accessGrant": sep_cb.AccessGrantRequest{},
|
||||
"/restmachine/cloudbroker/sep/accessGrantToPool": sep_cb.AccessGrantToPoolRequest{},
|
||||
"/restmachine/cloudbroker/sep/accessRevoke": sep_cb.AccessRevokeRequest{},
|
||||
"/restmachine/cloudbroker/sep/accessRevokeToPool": sep_cb.AccessRevokeToPoolRequest{},
|
||||
"/restmachine/cloudbroker/sep/addConsumerNodes": sep_cb.AddConsumerNodesRequest{},
|
||||
"/restmachine/cloudbroker/sep/addPool": sep_cb.AddPoolRequest{},
|
||||
"/restmachine/cloudbroker/sep/addProviderNodes": sep_cb.AddProviderNodesRequest{},
|
||||
"/restmachine/cloudbroker/sep/configFieldEdit": sep_cb.ConfigFieldEditRequest{},
|
||||
"/restmachine/cloudbroker/sep/configInsert": sep_cb.ConfigInsertRequest{},
|
||||
"/restmachine/cloudbroker/sep/configValidate": sep_cb.ConfigValidateRequest{},
|
||||
"/restmachine/cloudbroker/sep/consumption": sep_cb.ConsumptionRequest{},
|
||||
"/restmachine/cloudbroker/sep/create": sep_cb.CreateRequest{},
|
||||
"/restmachine/cloudbroker/sep/decommission": sep_cb.DecommissionRequest{},
|
||||
"/restmachine/cloudbroker/sep/delConsumerNodes": sep_cb.DelConsumerNodesRequest{},
|
||||
"/restmachine/cloudbroker/sep/delete": sep_cb.DeleteRequest{},
|
||||
"/restmachine/cloudbroker/sep/delPool": sep_cb.DelPoolRequest{},
|
||||
"/restmachine/cloudbroker/sep/disable": sep_cb.DisableRequest{},
|
||||
"/restmachine/cloudbroker/sep/diskList": sep_cb.DiskListRequest{},
|
||||
"/restmachine/cloudbroker/sep/enable": sep_cb.EnableRequest{},
|
||||
"/restmachine/cloudbroker/sep/get": sep_cb.GetRequest{},
|
||||
"/restmachine/cloudbroker/sep/getConfig": sep_cb.GetConfigRequest{},
|
||||
"/restmachine/cloudbroker/sep/getPool": sep_cb.GetPoolRequest{},
|
||||
"/restmachine/cloudbroker/sep/list": sep_cb.ListRequest{},
|
||||
"/restmachine/cloudbroker/sep/sharedLockStop": sep_cb.SharedLockStopRequest{},
|
||||
"/restmachine/cloudbroker/sep/listAvailableSepAndPools": sep_cb.ListAvailableSEPAndPoolsRequest{},
|
||||
"/restmachine/cloudbroker/sep/sharedLockStart": sep_cb.SharedLockStartRequest{},
|
||||
|
||||
// stack
|
||||
"/restmachine/cloudbroker/stack/get": stack_cb.GetRequest{},
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"os"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func compareLogs(logFileName string, logsData []string, t *testing.T, testType string) {
|
||||
if _, err := os.Stat(logFileName); os.IsNotExist(err) {
|
||||
file, err := os.Create(logFileName)
|
||||
if err != nil {
|
||||
t.Errorf("Failed to create log file: %v", err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
writer := bufio.NewWriter(file)
|
||||
|
||||
jsonData, err := json.MarshalIndent(logsData, "", " ")
|
||||
if err != nil {
|
||||
t.Errorf("Failed to marshal logsData to JSON: %v", err)
|
||||
}
|
||||
|
||||
_, err = writer.WriteString(string(jsonData))
|
||||
if err != nil {
|
||||
t.Errorf("Failed to write JSON to log file: %v", err)
|
||||
}
|
||||
|
||||
writer.Flush()
|
||||
} else {
|
||||
file, err := os.Open(logFileName)
|
||||
if err != nil {
|
||||
t.Errorf("Failed to open log file: %v", err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
reader := bufio.NewReader(file)
|
||||
var sb strings.Builder
|
||||
for {
|
||||
line, err := reader.ReadString('\n')
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
sb.WriteString(strings.TrimSpace(line))
|
||||
break
|
||||
}
|
||||
t.Errorf("Error reading log file: %v", err)
|
||||
return
|
||||
}
|
||||
sb.WriteString(strings.TrimSpace(line))
|
||||
}
|
||||
|
||||
var fileContent = sb.String()
|
||||
|
||||
var fileLogsData []string
|
||||
err = json.Unmarshal([]byte(fileContent), &fileLogsData)
|
||||
if err != nil {
|
||||
t.Errorf("Failed to unmarshal JSON from log file: %v", err)
|
||||
}
|
||||
|
||||
if len(fileLogsData) != len(logsData) {
|
||||
t.Errorf("Log data length does not match. Got: %d, Expected: %d", len(fileLogsData), len(logsData))
|
||||
}
|
||||
|
||||
var allLinesMatch = true
|
||||
|
||||
switch testType {
|
||||
default:
|
||||
for i := range logsData {
|
||||
if sortBracketsContent(fileLogsData[i]) != sortBracketsContent(logsData[i]) {
|
||||
allLinesMatch = false
|
||||
t.Errorf("Line %d does not match. Got: %s, Expected: %s", i+1, sortBracketsContent(fileLogsData[i]), sortBracketsContent(logsData[i]))
|
||||
}
|
||||
}
|
||||
if allLinesMatch {
|
||||
t.Log("\nAll lines match the log file.")
|
||||
}
|
||||
case "request":
|
||||
var tmp = make(map[string]struct{})
|
||||
for _, v := range fileLogsData {
|
||||
if _, ok := tmp[v]; ok {
|
||||
delete(tmp, v)
|
||||
} else {
|
||||
tmp[v] = struct{}{}
|
||||
}
|
||||
|
||||
}
|
||||
for _, v := range logsData {
|
||||
if _, ok := tmp[v]; ok {
|
||||
delete(tmp, v)
|
||||
} else {
|
||||
tmp[v] = struct{}{}
|
||||
}
|
||||
|
||||
}
|
||||
if len(tmp) == 0 {
|
||||
t.Log("\nAll lines match the log file.")
|
||||
return
|
||||
}
|
||||
for i := range tmp {
|
||||
t.Errorf("Line %s does not match.", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func sortBracketsContent(log string) string {
|
||||
re := regexp.MustCompile(`\[([^\[\]]*)\]`)
|
||||
return re.ReplaceAllStringFunc(log, func(match string) string {
|
||||
content := match[1 : len(match)-1]
|
||||
parts := strings.Split(content, " ")
|
||||
sort.Strings(parts)
|
||||
return "[" + strings.Join(parts, " ") + "]"
|
||||
})
|
||||
}
|
||||
@@ -51,15 +51,12 @@ func getBytesFromJSON(fileName string, t *testing.T) []byte {
|
||||
|
||||
func getErrorsFromJSON(bytes []byte, t *testing.T, cloud string) {
|
||||
var requests map[string]interface{}
|
||||
var logFileName string
|
||||
|
||||
switch cloud {
|
||||
case "cloudapi":
|
||||
requests = getRequestsMapCloudAPI()
|
||||
logFileName = "test_requests_cloudAPI.log"
|
||||
case "cloudbroker":
|
||||
requests = getRequestsMapCloudbroker()
|
||||
logFileName = "test_requests_cloudbroker.log"
|
||||
default:
|
||||
t.Fatalf("Wrong cloud provided, expected `cloudapi` or `cloudbroker`, got %s", cloud)
|
||||
}
|
||||
@@ -151,7 +148,6 @@ func getErrorsFromJSON(bytes []byte, t *testing.T, cloud string) {
|
||||
t.Error(msg)
|
||||
dataLogs = append(dataLogs, msg)
|
||||
}
|
||||
compareLogs(logFileName, dataLogs, t, "request")
|
||||
}
|
||||
|
||||
// checkName checks if name field from platform has the same value as json tag in golang structure (maybe including omitempty)
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
var DEPRECATED_GROUPS = []string{
|
||||
"/cloudapi/machine/",
|
||||
"/cloudapi/cloudspace/",
|
||||
"/cloudapi/prometheus/",
|
||||
"//cloudbroker/pgpu/",
|
||||
"/cloudapi/gpu/",
|
||||
"/cloudapi/portforwarding/",
|
||||
@@ -28,7 +27,6 @@ var DEPRECATED_GROUPS = []string{
|
||||
"/cloudbroker/account/listCS",
|
||||
"/cloudbroker/machine/",
|
||||
"/cloudbroker/bservice/",
|
||||
"/cloudbroker/prometheus/",
|
||||
"/cloudbroker/auditcollector/",
|
||||
"/cloudbroker/health/",
|
||||
"/cloudbroker/metering/",
|
||||
|
||||
Reference in New Issue
Block a user