From 6e46a698072beb3612cbf47768c0c7d57c7b6d5c Mon Sep 17 00:00:00 2001 From: Jeel Mehta Date: Mon, 27 Jan 2025 14:48:53 -0800 Subject: [PATCH] Ubuntu test --- .github/workflows/java-ec2-canary.yml | 31 +++++++-------- .github/workflows/java-ec2-default-retry.yml | 38 +++++++++---------- .github/workflows/java-ec2-ubuntu-test.yml | 7 ++-- terraform/java/ec2/ubuntu/main.tf | 10 ++--- .../PredefinedExpectedTemplate.java | 19 ++++++++++ 5 files changed, 60 insertions(+), 45 deletions(-) diff --git a/.github/workflows/java-ec2-canary.yml b/.github/workflows/java-ec2-canary.yml index 3a52bec42..a53bacc8b 100644 --- a/.github/workflows/java-ec2-canary.yml +++ b/.github/workflows/java-ec2-canary.yml @@ -7,8 +7,8 @@ ## including logs, metrics, and traces. name: Java EC2 Enablement Canary Testing on: - schedule: - - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour + # schedule: + # - cron: '6,31 * * * *' # run the workflow at 6th and 31th minute of every hour workflow_dispatch: # be able to run the workflow on demand permissions: @@ -20,24 +20,21 @@ jobs: strategy: fail-fast: false matrix: - aws-region: ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', - 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', - 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', - 'us-east-1','us-east-2', 'us-west-1', 'us-west-2'] + aws-region: ['us-east-1'] uses: ./.github/workflows/java-ec2-default-retry.yml secrets: inherit with: aws-region: ${{ matrix.aws-region }} caller-workflow-name: 'appsignals-e2e-ec2-canary-test' - java-version: '11' - cpu-architecture: 'x86_64' + # java-version: '11' + # cpu-architecture: 'x86_64' - maven: - uses: ./.github/workflows/java-ec2-default-retry.yml - secrets: inherit - with: - aws-region: 'us-east-1' - caller-workflow-name: 'appsignals-e2e-ec2-maven-canary-test' - otel-source: 'maven' - java-version: '11' - cpu-architecture: 'x86_64' \ No newline at end of file + # maven: + # uses: ./.github/workflows/java-ec2-default-retry.yml + # secrets: inherit + # with: + # aws-region: 'us-east-1' + # caller-workflow-name: 'appsignals-e2e-ec2-maven-canary-test' + # otel-source: 'maven' + # java-version: '11' + # cpu-architecture: 'x86_64' \ No newline at end of file diff --git a/.github/workflows/java-ec2-default-retry.yml b/.github/workflows/java-ec2-default-retry.yml index 77edc7aca..ddbee927a 100644 --- a/.github/workflows/java-ec2-default-retry.yml +++ b/.github/workflows/java-ec2-default-retry.yml @@ -14,17 +14,17 @@ on: caller-workflow-name: required: true type: string - java-version: - required: true - type: string - cpu-architecture: - required: false - type: string - default: "x86_64" - otel-source: - required: false - type: string - default: 'github' + # java-version: + # required: true + # type: string + # cpu-architecture: + # required: false + # type: string + # default: "x86_64" + # otel-source: + # required: false + # type: string + # default: 'github' permissions: id-token: write @@ -32,26 +32,26 @@ permissions: jobs: java-ec2-default-attempt-1: - uses: ./.github/workflows/java-ec2-default-test.yml + uses: ./.github/workflows/java-ec2-ubuntu-test.yml secrets: inherit with: aws-region: ${{ inputs.aws-region }} caller-workflow-name: ${{ inputs.caller-workflow-name }} - java-version: ${{ inputs.java-version }} - otel-source: ${{ inputs.otel-source }} - cpu-architecture: ${{ inputs.cpu-architecture }} + # java-version: ${{ inputs.java-version }} + # otel-source: ${{ inputs.otel-source }} + # cpu-architecture: ${{ inputs.cpu-architecture }} java-ec2-default-attempt-2: needs: [ java-ec2-default-attempt-1 ] if: ${{ needs.java-ec2-default-attempt-1.outputs.job-started != 'true' }} - uses: ./.github/workflows/java-ec2-default-test.yml + uses: ./.github/workflows/java-ec2-ubuntu-test.yml secrets: inherit with: aws-region: ${{ inputs.aws-region }} caller-workflow-name: ${{ inputs.caller-workflow-name }} - java-version: ${{ inputs.java-version }} - otel-source: ${{ inputs.otel-source }} - cpu-architecture: ${{ inputs.cpu-architecture }} + # java-version: ${{ inputs.java-version }} + # otel-source: ${{ inputs.otel-source }} + # cpu-architecture: ${{ inputs.cpu-architecture }} publish-metric-attempt-1: needs: [ java-ec2-default-attempt-1, java-ec2-default-attempt-2 ] diff --git a/.github/workflows/java-ec2-ubuntu-test.yml b/.github/workflows/java-ec2-ubuntu-test.yml index 1ed9d548c..ac27dc7b6 100644 --- a/.github/workflows/java-ec2-ubuntu-test.yml +++ b/.github/workflows/java-ec2-ubuntu-test.yml @@ -28,8 +28,8 @@ permissions: env: E2E_TEST_AWS_REGION: ${{ inputs.aws-region }} CALLER_WORKFLOW_NAME: ${{ inputs.caller-workflow-name }} - SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-main-service-v11.jar - SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-${{ inputs.aws-region }}/java-remote-service-v11.jar + SAMPLE_APP_FRONTEND_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-jeel/java-main-service-v11.jar + SAMPLE_APP_REMOTE_SERVICE_JAR: s3://aws-appsignals-sample-app-prod-jeel/java-remote-service-v11.jar E2E_TEST_ACCOUNT_ID: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ACCOUNT_ID }} E2E_TEST_ROLE_NAME: ${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }} METRIC_NAMESPACE: ApplicationSignals @@ -53,7 +53,7 @@ jobs: - uses: actions/checkout@v4 with: - repository: 'aws-observability/aws-application-signals-test-framework' + repository: 'Jeel-mehta/aws-application-signals-test-framework' ref: ${{ env.CALLER_WORKFLOW_NAME == 'main-build' && 'main' || github.ref }} fetch-depth: 0 @@ -101,7 +101,6 @@ jobs: - name: Set Get CW Agent command environment variable run: | if [ "${{ github.event.repository.name }}" = "amazon-cloudwatch-agent" ]; then - # Reusing the adot-main-build-staging-jar bucket to store the python wheel file echo GET_CW_AGENT_DEB_COMMAND= "aws s3 cp s3://${{ secrets.S3_INTEGRATION_BUCKET }}/integration-test/binary/${{ github.sha }}/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb ./cw-agent.deb" >> $GITHUB_ENV else echo GET_CW_AGENT_DEB_COMMAND="wget -O cw-agent.deb https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb" >> $GITHUB_ENV diff --git a/terraform/java/ec2/ubuntu/main.tf b/terraform/java/ec2/ubuntu/main.tf index db83ae76b..15362c5f8 100644 --- a/terraform/java/ec2/ubuntu/main.tf +++ b/terraform/java/ec2/ubuntu/main.tf @@ -75,7 +75,7 @@ data "aws_ami" "ami" { } resource "aws_instance" "main_service_instance" { - ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier) + ami = data.aws_ami.ami.id instance_type = "t3.micro" key_name = local.ssh_key_name iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE" @@ -140,7 +140,7 @@ resource "null_resource" "main_service_setup" { # Get and run the sample application with configuration aws s3 cp ${var.sample_app_jar} ./main-service.jar - JAVA_TOOL_OPTIONS=' -javaagent:/home/ubuntu/adot.jar' \ + JAVA_TOOL_OPTIONS=' -javaagent:./adot.jar' \ OTEL_METRICS_EXPORTER=none \ OTEL_LOGS_EXPORT=none \ OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \ @@ -177,7 +177,7 @@ resource "null_resource" "main_service_setup" { } resource "aws_instance" "remote_service_instance" { - ami = data.aws_ami.ami.id # Amazon Linux 2 (free tier) + ami = data.aws_ami.ami.id instance_type = "t3.micro" key_name = local.ssh_key_name iam_instance_profile = "APP_SIGNALS_EC2_TEST_ROLE" @@ -244,7 +244,7 @@ resource "null_resource" "remote_service_setup" { # Get and run the sample application with configuration aws s3 cp ${var.sample_remote_app_jar} ./remote-service.jar - JAVA_TOOL_OPTIONS=' -javaagent:/home/ubuntu/adot.jar' \ + JAVA_TOOL_OPTIONS=' -javaagent:./adot.jar' \ OTEL_METRICS_EXPORTER=none \ OTEL_LOGS_EXPORT=none \ OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true \ @@ -303,7 +303,7 @@ resource "null_resource" "traffic_generator_setup" { sudo apt-get install -y awscli unzip tmux # Bring in the traffic generator files to EC2 Instance - aws s3 cp s3://aws-appsignals-sample-app-prod-${var.aws_region}/traffic-generator.zip ./traffic-generator.zip + aws s3 cp s3://aws-appsignals-sample-app-prod-jeel/traffic-generator.zip ./traffic-generator.zip unzip ./traffic-generator.zip -d ./ # Install the traffic generator dependencies diff --git a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java index 9d7ff14d5..f28f11459 100644 --- a/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java +++ b/validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java @@ -96,6 +96,25 @@ public enum PredefinedExpectedTemplate implements FileConfig { JAVA_EC2_ASG_CLIENT_CALL_METRIC("/expected-data-template/java/ec2/asg/client-call-metric.mustache"), JAVA_EC2_ASG_CLIENT_CALL_TRACE("/expected-data-template/java/ec2/asg/client-call-trace.mustache"), + /** Java EC2 Ubuntu Test Case Validations */ + JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_LOG("/expected-data-template/java/ec2/ubuntu/outgoing-http-call-log.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_METRIC( + "/expected-data-template/java/ec2/ubuntu/outgoing-http-call-metric.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_OUTGOING_HTTP_CALL_TRACE( + "/expected-data-template/java/ec2/ubuntu/outgoing-http-call-trace.mustache"), + + JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_LOG("/expected-data-template/java/ec2/ubuntu/aws-sdk-call-log.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_METRIC("/expected-data-template/java/ec2/ubuntu/aws-sdk-call-metric.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_AWS_SDK_CALL_TRACE("/expected-data-template/java/ec2/ubuntu/aws-sdk-call-trace.mustache"), + + JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_LOG("/expected-data-template/java/ec2/ubuntu/remote-service-log.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_METRIC("/expected-data-template/java/ec2/ubuntu/remote-service-metric.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_REMOTE_SERVICE_TRACE("/expected-data-template/java/ec2/ubuntu/remote-service-trace.mustache"), + + JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_LOG("/expected-data-template/java/ec2/ubuntu/client-call-log.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_METRIC("/expected-data-template/java/ec2/ubuntu/client-call-metric.mustache"), + JAVA_EC2_UBUNTU_DEFAULT_CLIENT_CALL_TRACE("/expected-data-template/java/ec2/ubuntu/client-call-trace.mustache"), + /** Java EC2 K8s Test Case Validations */ JAVA_K8S_OUTGOING_HTTP_CALL_LOG("/expected-data-template/java/k8s/outgoing-http-call-log.mustache"), JAVA_K8S_OUTGOING_HTTP_CALL_METRIC("/expected-data-template/java/k8s/outgoing-http-call-metric.mustache"),