weizhouapache commented on code in PR #284:
URL:
https://github.com/apache/cloudstack-terraform-provider/pull/284#discussion_r2910983358
##########
cloudstack/provider_test.go:
##########
@@ -145,3 +148,50 @@ func testAccPreCheck(t *testing.T) {
t.Fatal("CLOUDSTACK_SECRET_KEY must be set for acceptance
tests")
}
}
+
+// testAccPreCheckStaticRouteNexthop checks if the CloudStack version supports
+// the nexthop parameter for static routes (requires 4.22.0+)
+func testAccPreCheckStaticRouteNexthop(t *testing.T) {
+ testAccPreCheck(t)
+ cs := testAccProvider.Meta().(*cloudstack.CloudStackClient)
+
+ // Check the API capabilities to get CloudStack version
+ p := cs.Configuration.NewListCapabilitiesParams()
+ caps, err := cs.Configuration.ListCapabilities(p)
+ if err != nil {
+ t.Skipf("Unable to check CloudStack capabilities: %v", err)
+ return
+ }
+
+ // Check CloudStack version - nexthop support was added in 4.22.0
+ if caps != nil && caps.Capabilities != nil &&
caps.Capabilities.Cloudstackversion != "" {
+ version := caps.Capabilities.Cloudstackversion
+
+ // Parse version string (e.g., "4.22.0.0" -> major=4, minor=22)
+ // Convert to numeric value: major * 1000 + minor (e.g., 4.22
-> 4022)
+ parts := strings.Split(version, ".")
Review Comment:
can this be extracted as method ?
--
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]