Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"flag"
"sync"
"time"

"github.com/spf13/pflag"
"github.com/spf13/viper"
Expand Down Expand Up @@ -189,16 +188,3 @@ func initializeConfig(cfg *Config) error {

return viper.Unmarshal(cfg)
}

func GetRandomRegion() string {
regionLists := []string{
"regions/aws-us-west-2",
"regions/aws-us-east-1",
"regions/aws-ap-northeast-1",
"regions/aws-ap-southeast-1",
"regions/aws-eu-central-1",
"regions/alicloud-ap-southeast-1",
}
size := len(regionLists)
return regionLists[time.Now().Unix()%int64(size)]
}
2 changes: 1 addition & 1 deletion sceneTest/branch/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func cleanupExistingCluster(ctx context.Context, projectId, clusterName string)

// buildClusterConfig creates a cluster configuration based on the project ID and cluster name
func buildClusterConfig(projectId, clusterName string) (cluster.TidbCloudOpenApiserverlessv1beta1Cluster, error) {
region := config.GetRandomRegion()
region := "regions/aws-us-east-1"

clusterBody := cluster.TidbCloudOpenApiserverlessv1beta1Cluster{
DisplayName: clusterName,
Expand Down
6 changes: 2 additions & 4 deletions sceneTest/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
)

var testClusterId string
var region = "regions/aws-us-east-1"

// go test -v sceneTest/cluster/* -project-id {project-id}
func TestMain(m *testing.M) {
Expand All @@ -37,9 +38,6 @@ func TestCreateCluster(t *testing.T) {

t.Logf("Creating cluster: %s", clusterName)

// Set region to ap-northeast-1
region := "regions/aws-ap-northeast-1"

// Set spending limit
spendLimit := int32(100)

Expand Down Expand Up @@ -135,7 +133,7 @@ func TestGetCluster(t *testing.T) {
assert.NotNil(resp)
assert.Equal(testClusterId, *resp.ClusterId)
assert.NotEmpty(resp.DisplayName)
assert.Equal("regions/aws-ap-northeast-1", *resp.Region.Name)
assert.Equal(region, *resp.Region.Name)
assert.NotNil(resp.SpendingLimit)
assert.Equal(int32(100), *resp.SpendingLimit.Monthly)

Expand Down
Loading