Skip to content

Commit

Permalink
Merge branch 'terraform' into update-apps
Browse files Browse the repository at this point in the history
  • Loading branch information
Aneurysm9 authored Dec 2, 2022
2 parents d4504d5 + a2bb600 commit 12b6563
Show file tree
Hide file tree
Showing 288 changed files with 21,177 additions and 1,815 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
# Learn about CODEOWNERS file format:
# https://help.github.com/en/articles/about-code-owners
#

* @aws-observability/adot-collector-maintainers
* @aws-observability/adot-collector-maintainers
/centralized-sampling-tests/ @willarmiros @wangzlei
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@ updates:
directory: "/trace-java-client"
schedule:
interval: "weekly"

- package-ecosystem: "npm"
directory: "/cdk_infra"
schedule:
interval: "weekly"
1 change: 1 addition & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- Thank you for contributing the ADOT Community. Please note that as per policy, we're providing support via GitHub on a best effort basis. However, if you have AWS Enterprise Support you can create a ticket and we will provide direct support within the respective SLAs. -->
4 changes: 4 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ Ex. Adding a feature - Explain what this achieves.-->
**Testing:** <Describe what testing was performed and which tests were added.>

**Documentation:** <Describe the documentation added.>

<!-- DO NOT DELETE -->
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

49 changes: 49 additions & 0 deletions .github/workflows/cdk-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy cdk infra
on:
workflow_dispatch:
push:
branches: ['terraform']
# List of paths that should be considered when triggering the workflow
paths: ['cdk_infra/**']

permissions:
id-token: write
contents: read

concurrency: cdk_infra_deploy
jobs:
run-cdk-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: ${{ secrets.TEST_FW_ASSUMABLE_ROLE_ARN }}
aws-region: us-west-2
role-duration-seconds: 21600
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: install cdk
run: |
npm install -g aws-cdk
- name: npm install
working-directory: cdk_infra
run: |
npm i
- name: run cdk deploy
working-directory: cdk_infra
run: |
make deploy-infra
45 changes: 45 additions & 0 deletions .github/workflows/centralized-sampling-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Centralized Sampling Integration Tests

on:
push:
paths:
- 'centralized-sampling-tests/**'
workflow_dispatch:

permissions:
id-token: write

jobs:
run_tests:
name: Run centralized sampling integration tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v1
with:
java-version: 17
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_CENTRALIZED_SAMPLING_ROLE }}
role-duration-seconds: 1200
aws-region: us-west-2
- name: Build with Gradle Spring Boot App
run: ./gradlew :centralized-sampling-tests:sample-apps:spring-boot:build
- name: Build with Gradle Integration Tests
run: ./gradlew :centralized-sampling-tests:integration-tests:build
- name: Run test containers
run: docker-compose up --abort-on-container-exit
working-directory: centralized-sampling-tests
env:
INSTANCE_ID: ${{ github.run_id }}-${{ github.run_number }}
LISTEN_ADDRESS: 0.0.0.0:8080
26 changes: 0 additions & 26 deletions .github/workflows/gradle.yml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: PR Build
on:
pull_request:
branches:
- terraform
- release/v*
- dev/*

jobs:
validator-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew :validator:build
go-test:
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: '~1.18.6'
- name: Checkout repo
uses: actions/checkout@v3
- name: Unit test
run: make go-test
cdk-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v3
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: test
working-directory: cdk_infra/
run: |
npm install
npm run test
42 changes: 42 additions & 0 deletions .github/workflows/update-test-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Update Test Images

# We should execute only one workflow run at a time
concurrency: test_images_concurrency

on:
workflow_dispatch:
push:
branches: ['terraform']

# List of paths that should be considered when triggering the workflow
paths: ['mocked_servers/**', 'sample-apps/**']

permissions:
id-token: write
contents: read

jobs:
run-image-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
role-to-assume: ${{ secrets.TEST_FW_ASSUMABLE_ROLE_ARN }}
aws-region: us-west-2
role-duration-seconds: 7200
- uses: actions/setup-java@v1
with:
java-version: 17
- uses: gradle/wrapper-validation-action@v1
- name: Build locally with gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build
- name: Set up terraform
uses: hashicorp/setup-terraform@v2
- name: run imagebuild
working-directory: terraform/imagebuild
run: |
terraform init && terraform apply --auto-approve
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,18 @@ terraform.rc
!gradle/wrapper/gradle-wrapper.jar

**/.DS_Store

# ignore built binary
tools/batchTestGenerator/batchTestGenerator
# ignore any generated test-case-batch files
test-case-batch

# ignore java validator bin
validator/bin

.vscode

#reports
coverage.txt

*.class
18 changes: 17 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
CMD_DIR := $(abspath ./cmd)
ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)

GOTEST_OPT?= -short -coverprofile coverage.txt -v -race -timeout 180s
GOTEST=go test

build-aotutil:
cd ${CMD_DIR}/aotutil && make build
cd ${CMD_DIR}/aotutil && make build

.PHONY: list-mod
list-mod:
@echo ${ALL_GO_SRC}

.PHONY: go-test
go-test:
@set -e; for dir in $(ALL_GO_MOD_DIRS); do \
(cd "$${dir}" && \
go list ./... \
| xargs -n 10 $(GOTEST) $(GOTEST_OPT)) ; \
done
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AOT Testing Framework
# ADOT Testing Framework

Before adding a new component into AWS Otel Collector, we require contributors to add related end-to-end test cases, this project is a testing framework which helps contributors to easily add testing into AWS Otel Collector.
Before adding a new component into ADOT Collector, we require contributors to add related end-to-end test cases, this project is a testing framework which helps contributors to easily add testing into AWS Otel Collector.

* Contributors won't need to run the test locally to provide the testing result, instead, just define it. The test case will be automatically picked by the github workflow in AWS Otel Collector repo to run integration test and soaking test on different platforms. We will notify contributors if a certain test case is failed.

Expand All @@ -10,9 +10,9 @@ Before adding a new component into AWS Otel Collector, we require contributors t

Any questions could be asked on [gitter](https://gitter.im/aws-observability-aws-otel-test-framework/community)

## 1. Two PRs to contribute your component to [AWS Otel Collector](https://github.com/aws-observability/aws-otel-collector)
## 1. Two PRs to contribute your component to [ADOT Collector](https://github.com/aws-observability/aws-otel-collector)

Below are the steps to add a new component to AWS Otel Collector. Before doing this, please ensure your component is already merged into [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib)
Below are the steps to add a new component to ADOT Collector. Before doing this, please ensure your component is already merged into [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib)

### 1.1 Create a PR to Define test case in testing framework Repo

Expand All @@ -31,7 +31,7 @@ there're three placeholders could be used:

* `${mocked_endpoint}`, which refers to the mocked_endpoint provided in the testing framework. [An example to use mock_endpoint to override the real backend](https://github.com/aws-observability/aws-otel-test-framework/blob/terraform/terraform/testcases/otlp_http_exporter_metric_mock/otconfig.tpl#L17)

* `${grpc_port}`, which refers to the recevier grpc port allocated in the testing framework so that the throughput could be sent into the collector. [An example to use grpc_port](https://github.com/aws-observability/aws-otel-test-framework/blob/terraform/terraform/testcases/otlp_http_exporter_metric_mock/otconfig.tpl#L7)
* `${grpc_port}`, which refers to the receiver grpc port allocated in the testing framework so that the throughput could be sent into the collector. [An example to use grpc_port](https://github.com/aws-observability/aws-otel-test-framework/blob/terraform/terraform/testcases/otlp_http_exporter_metric_mock/otconfig.tpl#L7)

* `${region}`, which refers to the region where the test case will be running and validate. in normal case, region should be auto-detected so this placeholder might not be used in the config. [an example to use region](https://github.com/aws-observability/aws-otel-test-framework/blob/terraform/terraform/testcases/otlp_metric/otconfig.tpl#L17)

Expand All @@ -46,15 +46,15 @@ You will need to place a `parameters.tfvars` file under the test case folder to
* `soaking_data_mode`: which tells the testing framework to send which types of data to collector for soaking test, the optional values are: `metric`, `trace`. Default value is `metric`. [An example to configure the data mode](https://github.com/aws-observability/aws-otel-test-framework/blob/terraform/terraform/testcases/otlp_http_exporter_trace_mock/parameters.tfvars#L2)


### 1.2 Create a PR to Link test case to AWS Otel Collector Repo
### 1.2 Create a PR to Link test case to ADOT Collector Repo

[Example PR for http exporter](https://github.com/aws-observability/aws-otel-collector/pull/124)

Before creating the PR, please follow [get-performance-model](docs/get-performance-model.md) to get your performance model and put it into the PR description.

Once the first PR get merged, you will need to create a PR to AWS Otel Collector Repo, this PR needs to build the component and link test cases in one shot, which includes
Once the first PR get merged, you will need to create a PR to [ADOT Collector](https://github.com/aws-observability/aws-otel-collector) repo, this PR needs to build the component and link test cases in one shot, which includes

* the changes to build the new component into AWS Otel Collector.
* the changes to build the new component into ADOT Collector.
* the changes to link the test cases.

You will need to add a block in the [testcases.json](https://github.com/aws-observability/aws-otel-collector/blob/main/e2etest/testcases.json)
Expand All @@ -78,7 +78,7 @@ You will need to add a block in the [testcases.json](https://github.com/aws-obse

## 2. Run testing framework

If a certain test case is failed in the github workflow of AWS Otel Collector, you might need to debug the test case locally.
If a certain test case is failed in the github workflow of ADOT Collector, you might need to debug the test case locally.

* [run the local test](docs/run-mock-test.md)
* [run the ec2 test](docs/run-testing-framework.md#22-run-in-ec2)
Expand All @@ -101,3 +101,7 @@ See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more inform

This project is licensed under the Apache-2.0 License.

## Support

Please note that as per policy, we're providing support via GitHub on a best effort basis. However, if you have AWS Enterprise Support you can create a ticket and we will provide direct support within the respective SLAs.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repositories {

dependencies {
// This dependency is used by the application.
implementation 'com.google.guava:guava:29.0-jre'
implementation 'com.google.guava:guava:31.1-jre'

// Use JUnit test framework
testImplementation 'junit:junit:4.13.2'
Expand Down
3 changes: 3 additions & 0 deletions cdk_infra/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
jest.config.js
17 changes: 17 additions & 0 deletions cdk_infra/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-var-requires": 0,
"eslint-disable no-undef": 0
}
}

Loading

0 comments on commit 12b6563

Please sign in to comment.