Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Remove the dataset indexer images and the indexer.feature + utilize sandbox for algod/indexer/postgres containers #220

Merged
merged 76 commits into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
db785d5
remove the dataset indexer images and the indexer.feature
Aug 3, 2022
c2cbeff
ouch - we're not actually doing any real integration tests with indexer
Aug 4, 2022
43c88ac
no evaldelta so no evaldelta tag either
Aug 4, 2022
fcdb7cf
no indexer v23 image, so no fixtures for it either
Aug 4, 2022
5360256
is util/programs actually used?
Aug 4, 2022
5b05096
more prunings
Aug 4, 2022
8e856ff
sandbox seems to work now
Aug 5, 2022
893df2a
remove source +a
Aug 5, 2022
cc73464
sandbox is working (but haven't tried testing)
Aug 5, 2022
b7ec7d2
pin .env to typical values
Aug 5, 2022
f4734e2
yuck... this should have been a python script. sed is platform dependent
Aug 6, 2022
cceed92
try gin
Aug 6, 2022
c0f4b0f
try gin
Aug 6, 2022
97bcf1e
set sandbox node to archival + builtin v1 indexer
Aug 7, 2022
e6d81b6
indexer active + expose sandbox configuration
Aug 7, 2022
6088931
set -e
Aug 7, 2022
ccbf7b2
small revert
Aug 7, 2022
fde71bd
revert
Aug 7, 2022
65710e9
experiiment
Aug 8, 2022
2dd465c
experimental
Aug 8, 2022
7af3ace
experimental cwd
Aug 8, 2022
ae4a250
verbose sandbox + clean up up.sh echos
Aug 9, 2022
c07d95b
clean up
Aug 9, 2022
06c1810
remove `network_config` in response to CR observation
Aug 10, 2022
b30975a
comment about location of network template
Aug 10, 2022
e6658c9
envsubst intead of sed and other improvements
Aug 12, 2022
a3f6689
envsubst intead of sed and other improvements
Aug 12, 2022
017ec80
better comment
Aug 12, 2022
147bea6
remove NODE_V1_INDEXER config capability
Aug 12, 2022
8ba2782
yes, really remove NODE_V1_INDEXER
Aug 12, 2022
ee2198b
default to non-archival node
Aug 12, 2022
318bcb7
deprecated v1 indexer steps
Aug 12, 2022
722ddd1
updated sourcemap
Aug 12, 2022
35751d2
revert
Aug 12, 2022
a39b0de
try gin
Aug 12, 2022
04ad2ed
Update .env
tzaffi Aug 12, 2022
08b8af6
down.sh has hardcoded env file
tzaffi Aug 12, 2022
df0a149
Update scripts/up.sh
tzaffi Aug 12, 2022
11ed449
more slimming
Aug 12, 2022
8ebf91e
clean up the tags in the README
Aug 12, 2022
a73c2c0
oops... we should still be asserting that $TYPE is either channel or …
Aug 12, 2022
03cead5
revert to channel default
Aug 12, 2022
6f1b52c
indexer url was missing
Aug 12, 2022
3366eb6
point sandbox to main branch now that configurable-ports has been merged
Aug 12, 2022
44b5258
don't overwrite sandboxe's SANDBOX_DIR with it's sourcing bugfix in p…
Aug 12, 2022
a3f04af
revert sandbox branch to master after the bugfix was merged
Aug 12, 2022
64894c0
Update scripts/up.sh
tzaffi Aug 16, 2022
4db2f80
Update features/integration/algod.feature
tzaffi Aug 16, 2022
f0e20df
Update features/integration/algod.feature
tzaffi Aug 16, 2022
18b7a70
Update features/integration/algod.feature
tzaffi Aug 16, 2022
686b062
Merge branch 'master' into trim-indexer
tzaffi Aug 16, 2022
9a834fa
per CR: configure verbosity and default to false
Aug 16, 2022
3718bdf
Merge branch 'trim-indexer' of https://github.com/algorand/algorand-s…
Aug 16, 2022
753f51b
per CR suggestion: don't hardcode script name in echo's
Aug 16, 2022
a479075
per CR: don't overwrite sourced variable
Aug 16, 2022
059003a
per CR: more precision in sourcing all
Aug 16, 2022
60a882b
per cr suggestion: -euo pipefail
Aug 16, 2022
98a25e5
per CR: less cruddy time stamps
Aug 16, 2022
8e2bec3
sourcemap duplicate key - fixes tests? -
Aug 16, 2022
ef78e1f
mapping[s]
Aug 16, 2022
ca40915
update diagram
Aug 16, 2022
8ce32e9
less ugly diagrams
Aug 16, 2022
6a847c2
update the README
Aug 16, 2022
eb03dba
revert
Aug 16, 2022
63f0947
introduce sourcemap2.json bc unit/integration compile features are st…
Aug 16, 2022
2378496
sourcemap2 tweak
Aug 16, 2022
3d2db01
Update README.md
tzaffi Aug 16, 2022
e4c6998
per CR suggestion. Show full path of .env
Aug 16, 2022
781bd67
Merge branch 'trim-indexer' of https://github.com/algorand/algorand-s…
Aug 16, 2022
3d71ed4
echo full paths for clarity
Aug 19, 2022
35b5bc5
try and make dryrun_testing.feature var templating COMPLIANT
Aug 21, 2022
d460d1f
oops - try and make dryrun_testing.feature var templating COMPLIANT
Aug 21, 2022
b20f2ef
make the remaining features var templating COMPLIANT
Aug 21, 2022
4f26dbf
Unused Steps Analysis notebook
Aug 22, 2022
c4d9ada
clean up the notebook and use a small sample
Aug 22, 2022
eaf31ff
Merge branch 'master' into trim-indexer
Aug 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Build configuration
VERBOSE_HARNESS=0

# Used to determine sandbox build type:
tzaffi marked this conversation as resolved.
Show resolved Hide resolved
TYPE="channel" # OR "source"

# Used when TYPE==channel:
ALGOD_CHANNEL="nightly"

# Used when TYPE==source:
ALGOD_URL="https://github.com/algorand/go-algorand"
ALGOD_BRANCH="master"
ALGOD_SHA=""

# Used regardless of TYPE:
NETWORK_TEMPLATE="images/algod/DevModeNetwork.json" # refers to the ./images directory in the sandbox repo
NETWORK_NUM_ROUNDS=30000
INDEXER_URL="https://github.com/algorand/indexer"
NODE_ARCHIVAL="False"
INDEXER_BRANCH="develop"
INDEXER_SHA=""

# Sandbox configuration:
SANDBOX_URL="https://github.com/algorand/sandbox"
SANDBOX_BRANCH="master"
LOCAL_SANDBOX_DIR=".sandbox"

# replacement values for Sandbox's docker-compose:
ALGOD_CONTAINER=sdk-harness-algod
KMD_PORT=60001
ALGOD_PORT=60000
INDEXER_CONTAINER=sdk-harness-indexer
INDEXER_PORT=59999
POSTGRES_CONTAINER=sdk-harness-postgres
POSTGRES_PORT=65432
8 changes: 0 additions & 8 deletions .up-env

This file was deleted.

35 changes: 20 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ These reside in the [unit features directory](features/unit)
| @unit.algod.ledger_refactoring | |
| @unit.applications | Application endpoints added to Algod and Indexer. |
| @unit.atomic_transaction_composer | ABI / atomic transaction construction unit tests. |
| @unit.atc_method_args | Test that algod's Atomic Transaction Composer assserts that the same number of arguments given as expected |
| @unit.c2c | Test for contract to contract calling |
| @unit.dryrun | Dryrun endpoint added to Algod. |
| @unit.dryrun.trace.application | DryrunResult formatting tests. |
| @unit.feetest | Fee transaction encoding tests. |
| @unit.indexer | Indexer REST API unit tests. |
| @unit.indexer.ledger_refactoring | Assertions for indexer after ledger refactoring. |
| @unit.indexer.logs | Application logs endpoints added to Indexer. |
| @unit.indexer.rekey | Rekey endpoints added to Algod and Indexer |
| @unit.offline | The first unit tests we wrote for cucumber. |
Expand All @@ -36,14 +40,14 @@ These reside in the [unit features directory](features/unit)
| @unit.responses.genesis | REST Client Unit Tests for GetGenesis endpoint |
| @unit.responses.messagepack | REST Client MessagePack Unit Tests |
| @unit.responses.messagepack.231 | REST Client MessagePack Unit Tests for Indexer 2.3.1+ |
| @unit.sourcemap | Test the sourcemap endpoint. |
| @unit.stateproof.responses | REST Client Response Tests for State Proof. |
| @unit.stateproof.responses.msgp | REST Client MessagePack Tests for State Proofs. |
| @unit.stateproof.paths | REST Client Unit Tests for State Proof feature. |
| @unit.tealsign | Test TEAL signature utilities. |
| @unit.transactions | Transaction encoding tests. |
| @unit.transactions.keyreg | Keyreg encoding tests. |
| @unit.transactions.payment | Payment encoding tests. |
| @unit.dryrun.trace.application | DryrunResult formatting tests. |

### Integration Tests
tzaffi marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -53,17 +57,14 @@ These reside in the [integration features directory](features/integration)
| ---------------------- | -------------------------------------------------------------------------------------- |
| @abi | Test the Application Binary Interface (ABI) with atomic txn composition and execution. |
| @algod | General tests against algod REST endpoints. |
| @application.evaldelta | Test that eval delta fields are included in algod and indexer. |
tzaffi marked this conversation as resolved.
Show resolved Hide resolved
| @applications.verified | Submit all types of application transactions and verify account state. |
| @assets | Submit all types of asset transactions. |
| @auction | Encode and decode bids for an auction. |
| @c2c | Test Contract to Contract invocations and injestion. |
| @compile | Test the algod compile endpoint. |
| @compile.sourcemap | Test the algod compile endpoint returns a valid Source Map |
| @dryrun | Test the algod dryrun endpoint. |
| @dryrun.testing | Test the testing harness that relies on dryrun endpoint. Python only. |
| @indexer | Test all types of indexer queries and parameters against a static dataset. |
| @indexer.231 | REST Client Integration Tests for Indexer 2.3.1+ |
| @indexer.applications | Endpoints and parameters added to support applications. |
tzaffi marked this conversation as resolved.
Show resolved Hide resolved
| @kmd | Test the kmd REST endpoints. |
| @rekey_v1 | Test the rekeying transactions. |
| @send | Test the ability to submit transactions to algod. |
Expand All @@ -76,9 +77,9 @@ However, a few are not fully supported:

| tag | SDK's which implement |
| ------------------------------- | ---------------------------- |
| @application.evaldelta | Java only |
tzaffi marked this conversation as resolved.
Show resolved Hide resolved
| @dryrun.testing | Python only |
| @indexer.rekey | missing from Python and JS |
| @unit.c2c | missing from Python |
| @unit.indexer.rekey | missing from Python and JS |
| @unit.responses.genesis | missing from Python and Java |
| @unit.responses.messagepack | missing from Python |
| @unit.responses.messagepack.231 | missing from Python and JS |
Expand Down Expand Up @@ -167,14 +168,15 @@ The SDKs come with a Makefile to coordinate running the cucumber test suites. Th

- **unit**: runs all of the short unit tests.
- **integration**: runs all integration tests.
- **harness**: downloads this repo and calls `up.sh` to stand up a sandbox ready for running tests
- **docker-test**: installs feature file dependencies, starts the test environment, and runs the SDK tests in a docker container.

At a high level, the **docker-test** target is required to:

1. clone `algorand-sdk-testing`.
2. copy supported feature files from the `features` directory into the SDK.
3. build and start the test environment by calling `./scripts/up.sh`
4. launch an SDK container using `--network host` which runs the cucumber test suite.
1. clone `algorand-sdk-testing`
2. copy supported feature files from the `features` directory into the SDK
3. build and start the test environment by calling `./scripts/up.sh` which clones `sandbox` and stands it up
4. run all cucumber tests against the `sandbox` containers

### Running tests during development

Expand All @@ -186,12 +188,15 @@ Once the test environment is running you can use `make unit` and `make integrati

## Integration test environment

Docker compose is used to manage several containers which work together to provide the test environment. Currently that includes algod, kmd, indexer and a postgres database. The services run on specific ports with specific API tokens. Refer to [docker-compose.yml](docker-compose.yml) and the [docker](docker/) directory for how this is configured.
Algorand's [sandbox](https://github.com/algorand/sandbox) is used to manage several containers which work together to provide the test environment. This includes `algod`, `kmd`, `indexer` and a `postgres` database. The services run on specific ports with specific API tokens. Refer to [.env](.env) and to [sandbox'es docker-compose.yml](https://github.com/algorand/sandbox/blob/master/docker-compose.yml) for how these are configured.

![Integration Test Environment](docs/SDK%20Test%20Environment.png)

### Start the test environment
### Managing the test environment

[up.sh](scripts/up.sh) is used to bring up the test environment. Not surprisingly, [down.sh](scripts/down.sh) brings it all down.

There are a number of [scripts](scripts/) to help with managing the test environment. The names should help you understand what they do, but to get started simply run **up.sh** to bring up a new environment, and **down.sh** to shut it down.
When starting the environment, we default to using `go-algorand`'s nightly build. If you're interested in running tests against a specific branch of `go-algorand`, you should set `TYPE="source"` in `.env`
and set `ALGOD_URL`, and either `ALGOD_BRANCH` or `ALGOD_SHA` appropriately.

When starting the environment we avoid using the cache intentionally. It uses the go-algorand nightly build, and we want to ensure that the containers are always running against the most recent nightly build. In the future these scripts should be improved, but for now we completely avoid using cached docker containers to ensure that we don't accidentally run against a stale environment.
`indexer` and even the `sandbox` itself can be configured similarly through `.env`.
15 changes: 15 additions & 0 deletions config.harness
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export ALGOD_CHANNEL="$ALGOD_CHANNEL"
tzaffi marked this conversation as resolved.
Show resolved Hide resolved
export ALGOD_URL="$ALGOD_URL"
export ALGOD_BRANCH="$ALGOD_BRANCH"
export ALGOD_SHA="$ALGOD_SHA"
export NETWORK=""
export NETWORK_TEMPLATE="$NETWORK_TEMPLATE"
export NETWORK_BOOTSTRAP_URL=""
export NETWORK_GENESIS_FILE=""
export NETWORK_NUM_ROUNDS=$NETWORK_NUM_ROUNDS
export NODE_ARCHIVAL="$NODE_ARCHIVAL"
export INDEXER_URL="$INDEXER_URL"
export INDEXER_BRANCH="$INDEXER_BRANCH"
export INDEXER_SHA="$INDEXER_SHA"
export INDEXER_DISABLED=""
export INDEXER_ENABLE_ALL_PARAMETERS="false"
154 changes: 0 additions & 154 deletions docker-compose.yml

This file was deleted.

33 changes: 0 additions & 33 deletions docker/algod/channel/Dockerfile

This file was deleted.

Loading