Skip to content

Commit 334887d

Browse files
authored
Merge pull request #19 from jj22ee/update-sample-app-param
Update Sample Apps aws-sdk-call param name to indicate Test ID
2 parents 0a362a3 + f45d547 commit 334887d

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

sample-apps/python/django_frontend_service/frontend_service_app/views.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,18 @@ def healthcheck(request):
4949
def aws_sdk_call(request):
5050
bucket_name = "e2e-test-bucket-name"
5151

52-
# Add an (pod) ID to bucketname to associate buckets to specific test runs
53-
ip = request.GET.get('ip', None)
54-
if ip is not None:
55-
bucket_name += "-" + ip
52+
# Add a unique test ID to bucketname to associate buckets to specific test runs
53+
testing_id = request.GET.get('testingId', None)
54+
if testing_id is not None:
55+
bucket_name += "-" + testing_id
5656
s3_client = boto3.client("s3")
5757
try:
5858
s3_client.get_bucket_location(
5959
Bucket=bucket_name,
6060
)
6161
except Exception as e:
62+
# bucket_name does not exist, so this is expected.
63+
logger.error("Error occurred when trying to get bucket location of: " + bucket_name)
6264
logger.error("Could not retrieve http request:" + str(e))
6365

6466
return get_xray_trace_id()

sample-apps/springboot/src/main/java/com/amazon/sampleapp/FrontendServiceController.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,19 @@ public String healthcheck() {
8080
// test aws calls instrumentation
8181
@GetMapping("/aws-sdk-call")
8282
@ResponseBody
83-
public String awssdkCall(@RequestParam(name = "ip", required = false) String ip) {
83+
public String awssdkCall(@RequestParam(name = "testingId", required = false) String testingId) {
8484
String bucketName = "e2e-test-bucket-name";
85-
// Add an (pod) ID to bucketname to associate buckets to specific test runs
86-
if (ip != null) {
87-
bucketName += "-" + ip;
85+
// Add a unique test ID to bucketname to associate buckets to specific test runs
86+
if (testingId != null) {
87+
bucketName += "-" + testingId;
8888
}
8989
GetBucketLocationRequest bucketLocationRequest =
9090
GetBucketLocationRequest.builder().bucket(bucketName).build();
9191
try {
9292
s3.getBucketLocation(bucketLocationRequest);
9393
} catch (Exception e) {
94-
// e2e-test-bucket-name does not exist, so this is expected.
94+
// bucketName does not exist, so this is expected.
95+
logger.error("Error occurred when trying to get bucket location of: " + bucketName);
9596
logger.error("Could not retrieve http request:" + e.getLocalizedMessage());
9697
}
9798
return getXrayTraceId();

0 commit comments

Comments
 (0)