This commit is contained in:
asteam
2025-05-07 13:15:39 +03:00
parent 0c44daa241
commit c7a2c4ed5a
52 changed files with 1680 additions and 400 deletions

View File

@@ -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)
}
}