bhouse-nexthop commented on code in PR #287:
URL: 
https://github.com/apache/cloudstack-terraform-provider/pull/287#discussion_r2930989683


##########
cloudstack/provider_test.go:
##########
@@ -145,3 +145,32 @@ func testAccPreCheck(t *testing.T) {
                t.Fatal("CLOUDSTACK_SECRET_KEY must be set for acceptance 
tests")
        }
 }
+
+// getCloudStackVersion returns the CloudStack version from the API
+func getCloudStackVersion(t *testing.T) string {
+       cfg := Config{
+               APIURL:      os.Getenv("CLOUDSTACK_API_URL"),
+               APIKey:      os.Getenv("CLOUDSTACK_API_KEY"),
+               SecretKey:   os.Getenv("CLOUDSTACK_SECRET_KEY"),
+               HTTPGETOnly: true,
+               Timeout:     60,
+       }
+       cs, err := cfg.NewClient()
+       if err != nil {
+               t.Logf("Failed to create CloudStack client: %v", err)
+               return ""
+       }
+
+       p := cs.Configuration.NewListCapabilitiesParams()
+       r, err := cs.Configuration.ListCapabilities(p)
+       if err != nil {
+               t.Logf("Failed to get CloudStack capabilities: %v", err)
+               return ""
+       }
+
+       if r.Capabilities != nil {
+               return r.Capabilities.Cloudstackversion
+       }
+
+       return ""
+}

Review Comment:
   done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to