Skip to content

Commit

Permalink
test: add e2e-test project
Browse files Browse the repository at this point in the history
- Include Playwright and add some starter e2e API tests
- Create testing workflow to execute tests in GH Actions
- Report all test results as GH Action artifacts
  • Loading branch information
camargo committed Apr 1, 2022
1 parent 6b349dd commit f3495dc
Show file tree
Hide file tree
Showing 20 changed files with 4,361 additions and 26 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = true
ij_smart_tabs = false

[*.md]
max_line_length = off
trim_trailing_whitespace = false

[*.java]
ij_continuation_indent_size = 4
ij_java_align_consecutive_assignments = false
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/pr.yml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: test

on:
pull_request:
branches:
- develop
push:
branches:
- develop
tags:
- v*

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
- name: Setup Postgres Client (psql)
run: sudo apt-get install --yes postgresql-client
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build Classes
run: ./gradlew classes
- name: Assemble
run: ./gradlew assemble
- name: Start Services
run: |
docker compose -f ./e2e-tests/docker-compose-test.yml up -d --build
docker images
docker ps -a
- name: Sleep for 30 Seconds
run: sleep 30s
shell: bash
- name: Run Unit Tests
run: ./gradlew test
- name: Run E2E Tests
run: ./gradlew e2eTest
- name: Report JUnit Test Results
uses: dorny/test-reporter@v1
if: always()
with:
name: ☕ JUnit Results
path: "**/build/test-results/**/TEST-*.xml"
reporter: java-junit
- name: Upload JUnit Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: ☕ JUnit Results
path: "**/build/test-results/**/TEST-*.xml"
- name: Upload Playwright Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: 🎭 Playwright Results
path: ./e2e-tests/test-results
- name: Print Logs for Services
run: docker compose -f ./e2e-tests/docker-compose-test.yml logs -t
- name: Stop Services
run: |
docker ps -a
docker compose -f ./e2e-tests/docker-compose-test.yml down
docker ps -a
- name: Prune Volumes
run: docker volume prune --force
2 changes: 1 addition & 1 deletion db-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ java {
}
}

test {
task e2eTest(type: Test) {
useJUnitPlatform()
}

Expand Down
2 changes: 2 additions & 0 deletions e2e-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
test-results
7 changes: 7 additions & 0 deletions e2e-tests/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"arrowParens": "avoid",
"printWidth": 120,
"semi": true,
"singleQuote": true,
"trailingComma": "all"
}
10 changes: 10 additions & 0 deletions e2e-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# aerie-e2e-tests

This directory contains automated end-to-end tests for Aerie.

## Getting Started

```sh
npm install
npm test
```
22 changes: 22 additions & 0 deletions e2e-tests/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugins {
id 'com.github.node-gradle.node' version '3.1.1'
}

node {
version = '16.4.0'
npmVersion = '8.5.0'
download = true
}

task assemble {
dependsOn npmInstall
}

task build {
dependsOn assemble
}

task e2eTest(type: NpmTask) {
dependsOn npmInstall
args = ['run', 'test']
}
135 changes: 135 additions & 0 deletions e2e-tests/docker-compose-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# This compose file is used for end-to-end testing the Aerie services.
# See .github/workflows/test.yml for how this file is utilized.

version: '3.7'
services:
aerie_commanding:
build:
context: ./../command-expansion-server
dockerfile: Dockerfile
container_name: aerie_commanding
depends_on: ['postgres']
environment:
LOG_FILE: console
LOG_LEVEL: debug
MERLIN_GRAPHQL_URL: http://hasura:8080/v1/graphql
COMMANDING_SERVER_PORT: 3000
COMMANDING_DB: aerie_commanding
COMMANDING_DB_PASSWORD: aerie
COMMANDING_DB_PORT: 5432
COMMANDING_DB_SERVER: postgres
COMMANDING_DB_USER: aerie
COMMANDING_LOCAL_STORE: /usr/src/app/commanding_file_store
image: aerie_commanding
ports: ['3000:3000']
restart: always
volumes:
- ./../command-expansion-server:/app:cached
- aerie_file_store:/usr/src/app/commanding_file_store
aerie_gateway:
container_name: aerie_gateway
depends_on: ['postgres']
environment:
AUTH_TYPE: none
GQL_API_URL: http://localhost:8080/v1/graphql
LOG_FILE: console
LOG_LEVEL: debug
NODE_TLS_REJECT_UNAUTHORIZED: '0'
PORT: 9000
POSTGRES_AERIE_MERLIN_DB: aerie_merlin
POSTGRES_AERIE_SCHEDULER_DB: aerie_scheduler
POSTGRES_AERIE_UI_DB: aerie_ui
POSTGRES_HOST: postgres
POSTGRES_PASSWORD: aerie
POSTGRES_PORT: 5432
POSTGRES_USER: aerie
image: 'ghcr.io/nasa-ammos/aerie-gateway:develop'
ports: ['9000:9000']
restart: always
volumes:
- aerie_file_store:/app/files
aerie_merlin:
build:
context: ./../merlin-server
dockerfile: Dockerfile
container_name: aerie_merlin
depends_on: ['postgres']
environment:
MERLIN_DB: 'aerie_merlin'
MERLIN_DB_PASSWORD: 'aerie'
MERLIN_DB_PORT: 5432
MERLIN_DB_SERVER: 'postgres'
MERLIN_DB_USER: 'aerie'
MERLIN_LOCAL_STORE: /usr/src/app/merlin_file_store
MERLIN_PORT: 27183
JAVA_OPTS: >
-Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG
-Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=INFO
-Dorg.slf4j.simpleLogger.logFile=System.err
image: aerie_merlin
ports: ['27183:27183', '5005:5005']
restart: always
volumes:
- aerie_file_store:/usr/src/app/merlin_file_store
aerie_scheduler:
build:
context: ./../scheduler-server
dockerfile: Dockerfile
container_name: aerie_scheduler
depends_on: ['aerie_merlin', 'postgres']
environment:
MERLIN_GRAPHQL_URL: http://hasura:8080/v1/graphql
MERLIN_LOCAL_STORE: /usr/src/app/merlin_file_store
SCHEDULER_DB: 'aerie_scheduler'
SCHEDULER_DB_PASSWORD: 'aerie'
SCHEDULER_DB_PORT: 5432
SCHEDULER_DB_SERVER: 'postgres'
SCHEDULER_DB_USER: 'aerie'
SCHEDULER_LOCAL_STORE: /usr/src/app/scheduler_file_store
SCHEDULER_LOGGING: 'true'
SCHEDULER_OUTPUT_MODE: UpdateInputPlanWithNewActivities
SCHEDULER_PORT: 27193
SCHEDULER_RULES_JAR: /usr/src/app/merlin_file_store/scheduler_rules.jar
JAVA_OPTS: >
-Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG
-Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=INFO
-Dorg.slf4j.simpleLogger.logFile=System.err
image: aerie_scheduler
ports: ['27193:27193', '5006:5005']
restart: always
volumes:
- aerie_file_store:/usr/src/app/merlin_file_store
hasura:
container_name: hasura
depends_on: ['postgres']
environment:
AERIE_MERLIN_DATABASE_URL: postgres://aerie:aerie@postgres:5432/aerie_merlin
AERIE_SCHEDULER_DATABASE_URL: postgres://aerie:aerie@postgres:5432/aerie_scheduler
AERIE_UI_DATABASE_URL: postgres://aerie:aerie@postgres:5432/aerie_ui
HASURA_GRAPHQL_DEV_MODE: 'true'
HASURA_GRAPHQL_ENABLE_CONSOLE: 'true'
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
HASURA_GRAPHQL_LOG_LEVEL: info
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://aerie:aerie@postgres:5432/aerie_hasura
HASURA_GRAPHQL_METADATA_DIR: /hasura-metadata
image: 'hasura/graphql-engine:v2.2.0.cli-migrations-v3'
ports: ['8080:8080']
restart: always
volumes:
- ./../deployment/hasura/metadata:/hasura-metadata
postgres:
container_name: postgres
environment:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
image: postgres:14.1
ports: ['5432:5432']
restart: always
volumes:
- postgres_data:/var/lib/postgresql/data
- ./../deployment/postgres-init-db:/docker-entrypoint-initdb.d

volumes:
aerie_file_store:
postgres_data:
Loading

0 comments on commit f3495dc

Please sign in to comment.