synergiator commented on issue #15:
URL: https://github.com/apache/cloudstack-go/issues/15#issuecomment-981060224


   Strange enough, VM deployment using a unit test works, can't reproduce this 
error with this SDK itself.
   Based on the [mock test 
](https://github.com/apache/cloudstack-go/blob/v2.11.0/cloudstack/VirtualMachineService_test.go)kindly
 provided by @Pearl1594 (just removed the HTTP mock server and hardcoded 
required params/values)  I've tried the following against an instance with API 
level 4.11:
   
   ```
   func TestVirtualMachineService_DeployVirtualMachineReal(t *testing.T) {
        
        var URL="https://<DOMAIN>/client/api"
        var APIKEY =  ...
        var SECRETKEY = ...
   
        var zoneid = "23ec4069-ede9-46b4-9236-d8e373a4ef59"
        var templateid = "450ec62f-16b1-4d04-a00b-a6fd4933e429"
        var networkids = []string{"690ef536-3996-4aaf-b45d-5501f079d6eb"}
        var serviceofferingid = "171aa1ff-3c93-4030-946a-d16e34774a76"
   
        client := NewAsyncClient(URL, APIKEY, SECRETKEY, true)
        params := 
client.VirtualMachine.NewDeployVirtualMachineParams(serviceofferingid, 
templateid, zoneid)
        params.SetName("testDummyVM")
        params.SetNetworkids(networkids)
        resp, err := client.VirtualMachine.DeployVirtualMachine(params)
        if err != nil {
                t.Errorf("Failed to deploy VM with given specs due to %v", err)
                return
        }
   
        if resp == nil || resp.Name != "testDummyVM" {
                t.Errorf("Failed to deploy VM with given specs")
        }
   }
   
   ```
   Run single unit test:
   ```
   go test -v -run TestVirtualMachineService_DeployVirtualMachineReal
   ```
   Result: VM appears in the management UI and the test reports success.
   ```
   === RUN   TestVirtualMachineService_DeployVirtualMachineReal
   --- PASS: TestVirtualMachineService_DeployVirtualMachineReal (79.34s)
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to