Skip to content

Commit 1308ba3

Browse files
authored
feat: Adding E2E log test for RDS database interations (#104)
This change introduces the expected EMF log templates and asserts them after calling `/mysql` API.
1 parent 0737925 commit 1308ba3

File tree

4 files changed

+45
-1
lines changed

4 files changed

+45
-1
lines changed

.github/workflows/java-eks-e2e-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ jobs:
371371
--platform-info ${{ env.CLUSTER_NAME }}
372372
--service-name sample-application-${{ env.TESTING_ID }}
373373
--remote-service-deployment-name ${{ env.REMOTE_SERVICE_DEPLOYMENT_NAME }}
374+
--remote-resource-identifier "information_schema|${{env.RDS_MYSQL_CLUSTER_ENDPOINT}}|3306"
374375
--query-string ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}
375376
--rollup'
376377

validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public enum PredefinedExpectedTemplate implements FileConfig {
3939
JAVA_EKS_CLIENT_CALL_METRIC("/expected-data-template/java/eks/client-call-metric.mustache"),
4040
JAVA_EKS_CLIENT_CALL_TRACE("/expected-data-template/java/eks/client-call-trace.mustache"),
4141

42+
JAVA_EKS_RDS_MYSQL_LOG("/expected-data-template/java/eks/rds-mysql-log.mustache"),
4243
JAVA_EKS_RDS_MYSQL_METRIC("/expected-data-template/java/eks/rds-mysql-metric.mustache"),
4344

4445
/** Java EC2 Default Test Case Validations */
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[{
2+
"EC2.AutoScalingGroup": "^eks-.+",
3+
"EC2.InstanceId": "^i-[A-Za-z0-9]{17}$",
4+
"EKS.Cluster": "^{{platformInfo}}$",
5+
"Environment": "^eks:{{platformInfo}}/{{appNamespace}}$",
6+
"K8s.Namespace": "^{{appNamespace}}$",
7+
"K8s.Node": "^i-[A-Za-z0-9]{17}$",
8+
"K8s.Pod": "^sample-app-deployment-{{testingId}}(-[A-Za-z0-9]*)*$",
9+
"K8s.Workload": "^sample-app-deployment-{{testingId}}$",
10+
"PlatformType": "^AWS::EKS$",
11+
"Service": "^{{serviceName}}$",
12+
"Operation": "GET /mysql",
13+
"Version": "^1$",
14+
"Telemetry.Source": "^LocalRootSpan$",
15+
"Host": "^ip(-[0-9]{1,3}){4}.*$"
16+
},
17+
{
18+
"EC2.AutoScalingGroup": "^eks-.+",
19+
"EC2.InstanceId": "^i-[A-Za-z0-9]{17}$",
20+
"EKS.Cluster": "^{{platformInfo}}$",
21+
"Environment": "^eks:{{platformInfo}}/{{appNamespace}}$",
22+
"K8s.Namespace": "^{{appNamespace}}$",
23+
"K8s.Node": "^i-[A-Za-z0-9]{17}$",
24+
"K8s.Pod": "^sample-app-deployment-{{testingId}}(-[A-Za-z0-9]*)*$",
25+
"K8s.Workload": "^sample-app-deployment-{{testingId}}$",
26+
"PlatformType": "^AWS::EKS$",
27+
"Service": "^{{serviceName}}$",
28+
"Operation": "GET /mysql",
29+
"Version": "^1$",
30+
"Telemetry.Source": "^ClientSpan$",
31+
"Host": "^ip(-[0-9]{1,3}){4}.*$",
32+
"RemoteService": "mysql",
33+
"RemoteOperation": "SELECT",
34+
"RemoteResourceType": "DB::Connection",
35+
"RemoteResourceIdentifier": "^{{remoteResourceIdentifier}}$"
36+
}]

validator/src/main/resources/validations/java/eks/log-validation.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,10 @@
2121
httpPath: "/client-call"
2222
httpMethod: "get"
2323
callingType: "http"
24-
expectedLogStructureTemplate: "JAVA_EKS_CLIENT_CALL_LOG"
24+
expectedLogStructureTemplate: "JAVA_EKS_CLIENT_CALL_LOG"
25+
-
26+
validationType: "cw-log"
27+
httpPath: "/mysql"
28+
httpMethod: "get"
29+
callingType: "http"
30+
expectedLogStructureTemplate: "JAVA_EKS_RDS_MYSQL_LOG"

0 commit comments

Comments
 (0)