MCPcopy Index your code
hub / github.com/apache/cloudstack-go / TestAutoScaleService

Function TestAutoScaleService

test/AutoScaleService_test.go:28–320  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26)
27
28func TestAutoScaleService(t *testing.T) {
29 service := "AutoScaleService"
30 response, err := readData(service)
31 if err != nil {
32 t.Skipf("Skipping test as %v", err)
33 }
34 server := CreateTestServer(t, response)
35 client := cloudstack.NewClient(server.URL, "APIKEY", "SECRETKEY", true)
36 defer server.Close()
37
38 testcreateAutoScalePolicy := func(t *testing.T) {
39 if _, ok := response["createAutoScalePolicy"]; !ok {
40 t.Skipf("Skipping as no json response is provided in testdata")
41 }
42 p := client.AutoScale.NewCreateAutoScalePolicyParams("action", []string{}, 0)
43 r, err := client.AutoScale.CreateAutoScalePolicy(p)
44 if err != nil {
45 t.Errorf(err.Error())
46 }
47 if r.Id == "" {
48 t.Errorf("Failed to parse response. ID not found")
49 }
50 }
51 t.Run("CreateAutoScalePolicy", testcreateAutoScalePolicy)
52
53 testcreateAutoScaleVmGroup := func(t *testing.T) {
54 if _, ok := response["createAutoScaleVmGroup"]; !ok {
55 t.Skipf("Skipping as no json response is provided in testdata")
56 }
57 p := client.AutoScale.NewCreateAutoScaleVmGroupParams("lbruleid", 0, 0, []string{}, []string{}, "vmprofileid")
58 r, err := client.AutoScale.CreateAutoScaleVmGroup(p)
59 if err != nil {
60 t.Errorf(err.Error())
61 }
62 if r.Id == "" {
63 t.Errorf("Failed to parse response. ID not found")
64 }
65 }
66 t.Run("CreateAutoScaleVmGroup", testcreateAutoScaleVmGroup)
67
68 testcreateAutoScaleVmProfile := func(t *testing.T) {
69 if _, ok := response["createAutoScaleVmProfile"]; !ok {
70 t.Skipf("Skipping as no json response is provided in testdata")
71 }
72 p := client.AutoScale.NewCreateAutoScaleVmProfileParams("serviceofferingid", "templateid", "zoneid")
73 r, err := client.AutoScale.CreateAutoScaleVmProfile(p)
74 if err != nil {
75 t.Errorf(err.Error())
76 }
77 if r.Id == "" {
78 t.Errorf("Failed to parse response. ID not found")
79 }
80 }
81 t.Run("CreateAutoScaleVmProfile", testcreateAutoScaleVmProfile)
82
83 testcreateCondition := func(t *testing.T) {
84 if _, ok := response["createCondition"]; !ok {
85 t.Skipf("Skipping as no json response is provided in testdata")

Callers

nothing calls this directly

Calls 15

NewClientFunction · 0.92
readDataFunction · 0.85
CreateTestServerFunction · 0.85
CreateAutoScalePolicyMethod · 0.65
CreateConditionMethod · 0.65

Tested by

no test coverage detected