@@ -21,6 +21,7 @@ package cloudstack
2121
2222import (
2323 "fmt"
24+ "os"
2425 "testing"
2526
2627 "github.com/apache/cloudstack-go/v2/cloudstack"
@@ -29,6 +30,7 @@ import (
2930)
3031
3132func TestAccCloudStackKubernetesVersion_basic (t * testing.T ) {
33+ checkCKSEnabled (t )
3234 var version cloudstack.KubernetesSupportedVersion
3335
3436 resource .Test (t , resource.TestCase {
@@ -48,6 +50,7 @@ func TestAccCloudStackKubernetesVersion_basic(t *testing.T) {
4850}
4951
5052func TestAccCloudStackKubernetesVersion_update (t * testing.T ) {
53+ checkCKSEnabled (t )
5154 var version cloudstack.KubernetesSupportedVersion
5255
5356 resource .Test (t , resource.TestCase {
@@ -78,6 +81,28 @@ func TestAccCloudStackKubernetesVersion_update(t *testing.T) {
7881 })
7982}
8083
84+ func checkCKSEnabled (t * testing.T ) {
85+ cfg := Config {
86+ APIURL : os .Getenv ("CLOUDSTACK_API_URL" ),
87+ APIKey : os .Getenv ("CLOUDSTACK_API_KEY" ),
88+ SecretKey : os .Getenv ("CLOUDSTACK_SECRET_KEY" ),
89+ HTTPGETOnly : true ,
90+ Timeout : 60 ,
91+ }
92+ cs , err := cfg .NewClient ()
93+ if err != nil {
94+ return
95+ }
96+ p := cs .Configuration .NewListConfigurationsParams ()
97+ p .SetName ("cloud.kubernetes.service.enabled" )
98+ r , err := cs .Configuration .ListConfigurations (p )
99+ if err == nil {
100+ if r .Configurations [0 ].Value == "false" {
101+ t .Skip ("This test requires cloud.kubernetes.service.enabled to be true" )
102+ }
103+ }
104+ }
105+
81106func testAccCheckCloudStackKubernetesVersionExists (
82107 n string , version * cloudstack.KubernetesSupportedVersion ) resource.TestCheckFunc {
83108 return func (s * terraform.State ) error {
0 commit comments