forked from aws-samples/aurora-dsql-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_test.go
64 lines (49 loc) · 1.33 KB
/
example_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
import (
"fmt"
"os"
"testing"
"github.com/aws/aws-sdk-go-v2/service/dsql"
)
var client *dsql.Client
var region = "us-east-1"
func TestMain(m *testing.M) {
awsDefaultRegion := os.Getenv("AWS_DEFAULT_REGION") // AWS CLI v1 environment region variable
if awsDefaultRegion != "" {
region = awsDefaultRegion
}
awsRegion := os.Getenv("AWS_REGION") // AWS CLI v2 environment region variable
if awsRegion != "" {
region = awsRegion
}
fmt.Println("Initializing the AWS client in region:" + region)
clientUtil := ClientUtil{}
awsClient, err := clientUtil.GetInstance(region)
if err != nil {
fmt.Println("failed to get the aws client:" + err.Error())
os.Exit(1)
}
client = awsClient
if client == nil {
fmt.Println("aws client is not initialized")
os.Exit(1)
}
m.Run()
fmt.Println("All tests completed")
}
func TestSingleRegion(t *testing.T) {
fmt.Println("Single Region Cluster Test: Starting")
err := SingleRegionTest(client)
if err != nil {
t.Error("single region test failed:" + err.Error())
}
fmt.Println("Single Region Cluster Test: Completed")
}
func TestMultiRegion(t *testing.T) {
fmt.Println("Multi Region Cluster Test: Starting")
err := MultiRegionTest(client)
if err != nil {
t.Error("multi region test failed:" + err.Error())
}
fmt.Println("Multi Region Cluster Test: Completed")
}