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

Function TestSystemVMService

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

Source from the content-addressed store, hash-verified

26)
27
28func TestSystemVMService(t *testing.T) {
29 service := "SystemVMService"
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 testchangeServiceForSystemVm := func(t *testing.T) {
39 if _, ok := response["changeServiceForSystemVm"]; !ok {
40 t.Skipf("Skipping as no json response is provided in testdata")
41 }
42 p := client.SystemVM.NewChangeServiceForSystemVmParams("id", "serviceofferingid")
43 r, err := client.SystemVM.ChangeServiceForSystemVm(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("ChangeServiceForSystemVm", testchangeServiceForSystemVm)
52
53 testdestroySystemVm := func(t *testing.T) {
54 if _, ok := response["destroySystemVm"]; !ok {
55 t.Skipf("Skipping as no json response is provided in testdata")
56 }
57 p := client.SystemVM.NewDestroySystemVmParams("id")
58 r, err := client.SystemVM.DestroySystemVm(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("DestroySystemVm", testdestroySystemVm)
67
68 testlistSystemVms := func(t *testing.T) {
69 if _, ok := response["listSystemVms"]; !ok {
70 t.Skipf("Skipping as no json response is provided in testdata")
71 }
72 p := client.SystemVM.NewListSystemVmsParams()
73 _, err := client.SystemVM.ListSystemVms(p)
74 if err != nil {
75 t.Errorf(err.Error())
76 }
77 }
78 t.Run("ListSystemVms", testlistSystemVms)
79
80 testlistSystemVmsUsageHistory := func(t *testing.T) {
81 if _, ok := response["listSystemVmsUsageHistory"]; !ok {
82 t.Skipf("Skipping as no json response is provided in testdata")
83 }
84 p := client.SystemVM.NewListSystemVmsUsageHistoryParams()
85 _, err := client.SystemVM.ListSystemVmsUsageHistory(p)

Callers

nothing calls this directly

Calls 15

NewClientFunction · 0.92
readDataFunction · 0.85
CreateTestServerFunction · 0.85
DestroySystemVmMethod · 0.65
ListSystemVmsMethod · 0.65

Tested by

no test coverage detected