Skip to content

Commit

Permalink
Enhancement: Use Sandbox for Testing (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzaffi authored Aug 22, 2022
1 parent 28f4353 commit dc9a4b7
Show file tree
Hide file tree
Showing 11 changed files with 155 additions and 854 deletions.
14 changes: 14 additions & 0 deletions .test-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Configs for testing repo download:
SDK_TESTING_URL="https://github.com/algorand/algorand-sdk-testing"
SDK_TESTING_BRANCH="master"
SDK_TESTING_HARNESS="test-harness"

VERBOSE_HARNESS=0

# WARNING: If set to 1, new features will be LOST when downloading the test harness.
# REGARDLESS: modified features are ALWAYS overwritten.
REMOVE_LOCAL_FEATURES=0

# WARNING: Be careful when turning on the next variable.
# In that case you'll need to provide all variables expected by `algorand-sdk-testing`'s `.env`
OVERWRITE_TESTING_ENVIRONMENT=0
26 changes: 20 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
UNIT_TAGS := "$(subst :, or ,$(shell awk '{print $2}' src/test/unit.tags | paste -s -d: -))"
INTEGRATION_TAGS := "$(subst :, or ,$(shell awk '{print $2}' src/test/integration.tags | paste -s -d: -))"

unit:
mvn test -Dcucumber.filter.tags="@unit.offline or @unit.algod or @unit.indexer or @unit.rekey or @unit.indexer.rekey or @unit.transactions or @unit.transactions.keyreg or @unit.responses or @unit.applications or @unit.dryrun or @unit.tealsign or @unit.responses.messagepack or @unit.responses.231 or @unit.responses.messagepack.231 or @unit.feetest or @unit.indexer.logs or @unit.abijson or @unit.abijson.byname or @unit.atomic_transaction_composer or @unit.transactions.payment or @unit.responses.unlimited_assets or @unit.algod.ledger_refactoring or @unit.indexer.ledger_refactoring or @unit.dryrun.trace.application or @unit.sourcemap"
mvn test -Dcucumber.filter.tags=$(UNIT_TAGS)

integration:
mvn test \
-Dtest=com.algorand.algosdk.integration.RunCucumberIntegrationTest \
-Dcucumber.filter.tags="@algod or @assets or @auction or @kmd or @send or @send.keyregtxn or @indexer or @rekey_v1 or @applications.verified or @applications or @compile or @dryrun or @indexer.applications or @indexer.231 or @abi or @c2c or @compile.sourcemap"
mvn test -Dtest=com.algorand.algosdk.integration.RunCucumberIntegrationTest -Dcucumber.filter.tags=$(INTEGRATION_TAGS)

display-all-java-steps:
find src/test/java/com/algorand/algosdk -name "*.java" | xargs grep "io.cucumber.java.en" 2>/dev/null | grep -v Binary | cut -d: -f1 | sort | uniq | xargs grep -E "@(Given|Then|When)"

harness:
./test-harness.sh

docker-javasdk-build:
# Build SDK testing environment
docker build -t java-sdk-testing .

docker-javasdk-run:
# Launch SDK testing
docker run -it --network host java-sdk-testing:latest

docker-test:
./run_integration_tests.sh
docker-test: harness docker-javasdk-build docker-javasdk-run
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@ There is also a special integration test environment, and shared tests. To run t
~$ make docker-test
```

To stand up the test harness, without running the entire test suite use the Makefile:
```
~$ make harness
```
You can then run specific cucumber-based unit and integration tests directly.


## deploying artifacts

The generated pom file provides maven compatibility and deploy capabilities.
Expand Down
82 changes: 0 additions & 82 deletions run_integration_tests.sh

This file was deleted.

14 changes: 14 additions & 0 deletions src/test/integration.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@abi
@algod
@applications
@applications.verified
@assets
@auction
@c2c
@compile
@compile.sourcemap
@dryrun
@kmd
@rekey_v1
@send
@send.keyregtxn
5 changes: 0 additions & 5 deletions src/test/java/com/algorand/algosdk/integration/Clients.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,4 @@ public class Clients {
public void an_algod_v2_client_connected_to_port_with_token(String host, Integer port, String token) {
v2Client = new AlgodClient(host, port, token);
}

@Given("indexer client {int} at {string} port {int} with token {string}")
public void indexer_client_at_port_with_token(Integer index, String uri, Integer port, String token) {
indexerClients.put(index, new IndexerClient(uri, port, ""));
}
}
117 changes: 0 additions & 117 deletions src/test/java/com/algorand/algosdk/integration/EvalDelta.java

This file was deleted.

Loading

0 comments on commit dc9a4b7

Please sign in to comment.