Skip to content

Commit

Permalink
[ANCHOR-459] Split SEP Tests of AnchorPlatformIntegrationTest (#1185)
Browse files Browse the repository at this point in the history
### Description

- Split SEP Tests of AnchorPlatformIntegrationTest
- Replace `SepClient` classes with wallet sdk for some of the SEP tests.
- Disable the tests that requires non-`default` test configuration.
- Enable integration test concurrency.
- Add Mutex to reference server transaction submission function.

### Context

- Test improvements.

### Testing

- `./gradlew test`

### Known Limitaions
- Tests with non-`default` configurations will be moved to
`extended-tests` subproject.
  • Loading branch information
lijamie98 authored Nov 3, 2023
1 parent fd7b651 commit c0eb22b
Show file tree
Hide file tree
Showing 54 changed files with 1,215 additions and 1,682 deletions.
60 changes: 28 additions & 32 deletions .github/workflows/sub_gradle_test_and_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
gradle_test_and_build:
name: Gradle Test and Build
name: Gradle Build, Tests and Code Coverage
runs-on: ubuntu-latest-16-cores
# write to PR permission is required for jacocoTestReport Action to update comment
permissions:
Expand All @@ -31,7 +31,7 @@ jobs:
sudo echo "127.0.0.1 custody-server" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts
- name: Build and run the stack with docker compose
- name: Run Zookeeper, Kafka, Postgres, and Sep24 UI with docker compose
env:
TEST_PROFILE_NAME: default
run: docker-compose -f service-runner/src/main/resources/docker-compose-test.yaml up -d --build
Expand All @@ -53,44 +53,21 @@ jobs:

# Gradle test is now printing the test messages to GitHub Actions log.
# It is not necessary to print the reports.
- name: Gradle test and build. (unit tests, integration tests, end-2-end tests and build)
- name: Gradle Build. (unit tests only)
env:
run_docker: false
run: ./gradlew clean build jacocoTestReport --no-daemon --stacktrace -x spotlessApply -x spotlessKotlinApply -x javadoc -x javadocJar -x sourcesJar
run: ./gradlew clean build jacocoTestReport -x integration-tests:test --no-daemon --stacktrace -x spotlessApply -x spotlessKotlinApply -x javadoc -x javadocJar -x sourcesJar

- name: Add coverage to PR
id: jacoco
uses: madrapps/[email protected]
with:
paths: ${{ github.workspace }}/**/build/reports/jacoco/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 40
min-coverage-changed-files: 60
title: Code Coverage
update-comment: true

- name: Stop docker containers
env:
TEST_PROFILE_NAME: default
run: docker-compose -f service-runner/src/main/resources/docker-compose-test.yaml down

- name: Start docker containers
env:
TEST_PROFILE_NAME: default
run: docker-compose -f service-runner/src/main/resources/docker-compose-test.yaml up -d

- name: Run sep server, observer, java reference server and kotlin reference server
- name: Run sep server, platform server, observer, and reference servers for integration tests
env:
run_docker: false
run_all_servers: false
run_sep_server: true
run_platform_server: true
run_observer: true
run_kotlin_reference_server: true
# Running wallet server is not required for sep tests. However, running wallet server
# and kotlin reference server at the same time causes `ktor` to block the JVM.
# If we need to run both `ktor` servers, we will need to run them in separate JVMs.
run_wallet_server: false
run_event_processing_server: true
run_wallet_server: true

SEP1_TOML_VALUE: service-runner/src/main/resources/config/stellar.host.docker.internal.toml
SEP10_HOME_DOMAIN: host.docker.internal:8080
Expand All @@ -99,18 +76,37 @@ jobs:
cp service-runner/build/libs/anchor-platform-runner-*.jar service-runner/build/libs/anchor-platform-runner.jar
java -jar service-runner/build/libs/anchor-platform-runner.jar -t &
- name: Wait for sep server to start and get ready
- name: Wait for the sep server to start and get ready
uses: mydea/action-wait-for-api@v1
with:
url: "http://localhost:8080/.well-known/stellar.toml"
expected-status: "200"
timeout: "300"
interval: "1"

- name: Run the integration tests and end-2-end tests
env:
run_docker: false
ANCHOR_DOMAIN: http://host.docker.internal:8080

run: ./gradlew integration-tests:test

- name: Run Stellar validation tool
run: |
docker run --network host -v ${GITHUB_WORKSPACE}/platform/src/test/resources://config stellar/anchor-tests:v0.6.9 --home-domain http://host.docker.internal:8080 --seps 1 6 10 12 24 31 38 --sep-config //config/stellar-anchor-tests-sep-config.json --verbose
- name: Add coverage to PR
id: jacoco
uses: madrapps/[email protected]
with:
paths: ${{ github.workspace }}/**/build/reports/jacoco/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 40
min-coverage-changed-files: 60
title: Code Coverage
update-comment: true

- name: Upload Artifacts
if: always()
uses: actions/upload-artifact@v3
Expand All @@ -134,7 +130,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'java', 'python' ]
language: [ 'java-kotlin' ]

steps:
- name: Checkout repository
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package org.stellar.anchor.util;

import com.google.gson.*;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.time.Duration;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.HashMap;
import java.util.Map;

public class GsonUtils {
private static Gson instance = null;
Expand All @@ -21,6 +24,10 @@ public static Gson getInstance() {
if (instance == null) instance = builder().create();
return instance;
}

public static Map<String, String> fromJsonToMap(String json) {
return getInstance().fromJson(json, new TypeToken<HashMap<String, String>>() {}.getType());
}
}

class DurationConverter implements JsonSerializer<Duration>, JsonDeserializer<Duration> {
Expand Down
10 changes: 0 additions & 10 deletions end-to-end-tests/Dockerfile

This file was deleted.

43 changes: 0 additions & 43 deletions end-to-end-tests/README.md

This file was deleted.

Loading

0 comments on commit c0eb22b

Please sign in to comment.