Skip to content

Commit 1bd632b

Browse files
author
Joshua Reed
committed
Moved file.
1 parent 4bdabf4 commit 1bd632b

File tree

2 files changed

+0
-92
lines changed

2 files changed

+0
-92
lines changed

pkg/cloud/cloud_suite_test.go

Lines changed: 0 additions & 29 deletions
This file was deleted.

test/unit/cloud/cloud_suite_test.go

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -17,76 +17,13 @@ limitations under the License.
1717
package cloud_test
1818

1919
import (
20-
"fmt"
21-
"os"
2220
"testing"
2321

24-
"github.com/apache/cloudstack-go/v2/cloudstack"
2522
. "github.com/onsi/ginkgo/v2"
2623
. "github.com/onsi/gomega"
27-
"k8s.io/apimachinery/pkg/util/uuid"
28-
"sigs.k8s.io/cluster-api-provider-cloudstack/pkg/cloud"
29-
"sigs.k8s.io/cluster-api-provider-cloudstack/test/dummies"
30-
"sigs.k8s.io/cluster-api-provider-cloudstack/test/helpers"
31-
)
32-
33-
var (
34-
realCloudClient cloud.Client
35-
client cloud.Client
36-
realCSClient *cloudstack.CloudStackClient
37-
testDomainPath string // Needed in before and in after suite.
3824
)
3925

4026
func TestCloud(t *testing.T) {
4127
RegisterFailHandler(Fail)
42-
BeforeSuite(func() {
43-
// Create a real cloud client.
44-
projDir := os.Getenv("PROJECT_DIR")
45-
fmt.Println(projDir)
46-
fmt.Println(projDir)
47-
fmt.Println(projDir)
48-
var connectionErr error
49-
realCloudClient, connectionErr = cloud.NewClient(projDir + "/cloud-config")
50-
Ω(connectionErr).ShouldNot(HaveOccurred())
51-
52-
// Create a real CloudStack client.
53-
realCSClient, connectionErr = helpers.NewCSClient()
54-
Ω(connectionErr).ShouldNot(HaveOccurred())
55-
56-
// Create a new account and user to run tests that use a real ACS instance.
57-
uid := string(uuid.NewUUID())
58-
newAccount := cloud.Account{
59-
Name: "TestAccount-" + uid,
60-
Domain: cloud.Domain{Name: "TestDomain-" + uid, Path: "ROOT/TestDomain-" + uid}}
61-
newUser := cloud.User{Account: newAccount}
62-
Ω(helpers.GetOrCreateUserWithKey(realCSClient, &newUser)).Should(Succeed())
63-
testDomainPath = newAccount.Domain.Path
64-
65-
Ω(newUser.APIKey).ShouldNot(BeEmpty())
66-
67-
// Switch to test account user.
68-
cfg := cloud.Config{APIKey: newUser.APIKey, SecretKey: newUser.SecretKey}
69-
realCloudClient, connectionErr = realCloudClient.NewClientFromSpec(cfg)
70-
Ω(connectionErr).ShouldNot(HaveOccurred())
71-
})
72-
AfterSuite(func() {
73-
if realCSClient != nil { // Check for nil in case the before suite setup failed.
74-
// Delete created domain.
75-
id, err, found := helpers.GetDomainByPath(realCSClient, testDomainPath)
76-
Ω(err).ShouldNot(HaveOccurred())
77-
Ω(found).Should(BeTrue())
78-
Ω(helpers.DeleteDomain(realCSClient, id)).Should(Succeed())
79-
}
80-
})
8128
RunSpecs(t, "Cloud Suite")
8229
}
83-
84-
// FetchIntegTestResources runs through basic CloudStack Client setup methods needed to test others.
85-
func FetchIntegTestResources() {
86-
realCloudClient.ResolveZone(dummies.CSZone1)
87-
Ω(dummies.CSZone1.Spec.ID).ShouldNot(BeEmpty())
88-
dummies.CSMachine1.Status.ZoneID = dummies.CSZone1.Spec.ID
89-
dummies.CSMachine1.Spec.DiskOffering.Name = ""
90-
dummies.CSCluster.Spec.ControlPlaneEndpoint.Host = ""
91-
Ω(realCloudClient.GetOrCreateIsolatedNetwork(dummies.CSZone1, dummies.CSISONet1, dummies.CSCluster)).Should(Succeed())
92-
}

0 commit comments

Comments
 (0)