Skip to content

Latest commit

 

History

History
86 lines (57 loc) · 2.61 KB

run-mock-test.md

File metadata and controls

86 lines (57 loc) · 2.61 KB

run mock test

Steps

  1. Clone repos

Clone this repo:

git clone [email protected]:aws-observability/aws-otel-test-framework.git

Clone the AWS OpenTelemetry Collector repo:

git clone [email protected]:aws-observability/aws-otel-collector.git
  1. Install Terraform
Install Terraform: https://learn.hashicorp.com/tutorials/terraform/install-cli
  1. Install Docker compose
Install Docker compose: https://docs.docker.com/compose/install/
  1. Run one of the test cases:
cd aws-otel-test-framework/terraform/mock
terraform init
terraform apply -var="testcase=../testcases/otlp_mock" -var-file=../testcases/otlp_mock/parameters.tfvars
terraform destroy

hint: this test might take 20 minutes as it builds the image of collector in place.

Explain the test

This test runs fours containers:

  1. Sample app container
  2. Collector container
  3. Mock server container
  4. Validator container.

as per showing in the diagram.

logic diagram

Validator container calls sample app container so that it generate metric/trace to collector, then collector sends data to the mock server. Validator then calls mock server to check if it receives data from collector. there's no data accuracy checking.

You can find a docker_compose.yml file, which is generated by the test, runs three containers including sample app, collector and mock server. Validator container is started here, and fails the terraform process if the conainer exit with 1.

Debugging

If the test fails,

you can try to list the containers by using

docker ps

the output will be

CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                    NAMES
8a48f60534cf        mock_validator          "/app/bin/app -c=def…"   12 seconds ago      Up 10 seconds                                mock_validator_1
443ee2e388ea        mock_sample_app         "/app/bin/spark-samp…"   32 seconds ago      Up 31 seconds       0.0.0.0:4567->4567/tcp   mock_sample_app_1
67f401637b67        mock_aws-ot-collector   "/awscollector --con…"   34 seconds ago      Up 32 seconds       4317-4318/tcp          mock_aws-ot-collector_1
db75def68bb0        mock_mocked-server      "docker-entrypoint.s…"   36 seconds ago      Up 34 seconds       0.0.0.0:80->8080/tcp     mock_mocked-server_1

then you can try to get logs for each containers. For example.

docker logs -f mock_aws-ot-collector_1