github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/acceptance/openstack/cce/v3/clusters_test.go (about)

     1  package v3
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/opentelekomcloud/gophertelekomcloud/acceptance/clients"
     7  	"github.com/opentelekomcloud/gophertelekomcloud/acceptance/openstack/cce"
     8  	"github.com/stretchr/testify/suite"
     9  )
    10  
    11  type testCluster struct {
    12  	suite.Suite
    13  
    14  	vpcID       string
    15  	subnetID    string
    16  	clusterID   string
    17  	eniSubnetID string
    18  	eniCidr     string
    19  }
    20  
    21  func TestCluster(t *testing.T) {
    22  	suite.Run(t, new(testCluster))
    23  }
    24  
    25  func (s *testCluster) SetupSuite() {
    26  	t := s.T()
    27  	s.vpcID = clients.EnvOS.GetEnv("VPC_ID")
    28  	s.subnetID = clients.EnvOS.GetEnv("NETWORK_ID")
    29  	s.eniSubnetID = clients.EnvOS.GetEnv("ENI_SUBNET_ID")
    30  	s.eniCidr = "10.0.0.0/14"
    31  	if s.vpcID == "" || s.subnetID == "" || s.eniSubnetID == "" {
    32  		t.Skip("OS_VPC_ID, OS_NETWORK_ID and OS_ENI_SUBNET_ID are required for this test")
    33  	}
    34  	s.clusterID = cce.CreateTurboCluster(t, s.vpcID, s.subnetID, s.eniSubnetID, s.eniCidr)
    35  }
    36  
    37  func (s *testCluster) TearDownSuite() {
    38  	t := s.T()
    39  	if s.clusterID != "" {
    40  		cce.DeleteCluster(t, s.clusterID)
    41  		s.clusterID = ""
    42  	}
    43  }