Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the Unrecognized Client exception for China/ITAR tests #475

Merged
merged 5 commits into from
Mar 7, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ func getEc2TestRunners(env *environment.MetaData) []*test_runner.TestRunner {
{TestRunner: &RenameSSMTestRunner{test_runner.BaseTestRunner{DimensionFactory: factory}}},
{TestRunner: &JMXTomcatJVMTestRunner{test_runner.BaseTestRunner{DimensionFactory: factory}}},
{TestRunner: &JMXKafkaTestRunner{test_runner.BaseTestRunner{DimensionFactory: factory}}},
{TestRunner: &EntityMetricsTestRunner{test_runner.BaseTestRunner{DimensionFactory: factory}}},
}

// Only add EntityMetricsTestRunner if in us-west-2 (we don't have access to ListEntitiesForMetric in CN/ITAR)
if env.Region == "us-west-2" {
ec2TestRunners = append(ec2TestRunners, &test_runner.TestRunner{TestRunner: &EntityMetricsTestRunner{test_runner.BaseTestRunner{DimensionFactory: factory}}})
}
}
return ec2TestRunners
Expand Down
9 changes: 8 additions & 1 deletion util/awsservice/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package awsservice
import (
"context"
"fmt"
"os"
"sync"
"time"

Expand Down Expand Up @@ -59,7 +60,13 @@ var (
func init() {
ctx = context.Background()

err := ConfigureAWSClients("us-west-2")
region := os.Getenv("AWS_REGION")
if region == "" {
// default to us-west-2
region = "us-west-2"
}

err := ConfigureAWSClients(region)
if err != nil {
fmt.Println("There was an error trying to configure the AWS clients: ", err)
}
Expand Down