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

Testkit #102

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
57 changes: 30 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ SHELL=/bin/bash
.SHELLFLAGS += -e
PROJECTNAME=$(shell basename "$(PWD)")
DIR_FULLPATH=$(shell pwd)
TGPATH=
ifeq (${TGPATH},)
TGPATH := /usr/local/testground
endif

RUNNER ?=local-docker
# RUNNER can also be cluster-k8s
TG ?=$(HOME)/go/bin/testground

## help: Get more info on make commands.
help: Makefile
Expand Down Expand Up @@ -38,7 +36,7 @@ ifeq (,$(shell which gcc))
@echo "gcc is not installed, you must install go first."
exit 1;
endif
.PHONY: check-go
.PHONY: check-gcc

## check-docker: Check if docker is installed on the machine
check-docker:
Expand All @@ -51,24 +49,25 @@ ifeq (/snap/bin/docker,$(shell which docker))
exit 1;
endif
endif
.PHONY: check-go
.PHONY: check-docker

check: check-git check-go check-gcc check-docker
@echo > /dev/null
.PHONY: check

## install-tg: Install testground into the $TGPATH.
install-tg: check-git check-go check-gcc check-docker
@echo "Do you want to install to ${TGPATH}? (y/n):"
@read line; if [ $$line = "n" ]; then echo "Please retry with TGPATH set to your desired installation path."; exit 1 ; fi
@echo "Installing testground to the following path: ${TGPATH}"
@git clone https://github.com/testground/testground.git ${TGPATH}
@cd ${TGPATH}
echo $(pwd)
$(TG): check
@echo "Do you want to install to ${HOME}/go/bin/testground? (y/n):"
@read line; if [ $$line != "y" ]; then echo "Abandoned testground install"; exit 1 ; fi
@git clone --depth 1 https://github.com/testground/testground.git /tmp/testground
@cd /tmp/testground
@make install
@rm -rf /tmp/testground
@echo "Done."
.PHONY: install-tg

## check-composition-arg: Check if COMPOSITION env var was provided
check-testplan-arg:
ifeq (,${TESTPLAN})
@printf "You must specify a testplan, example:\n\t make COMMAND TESTPLAN=local-docker\n\n"
@printf "You must specify a testplan, example:\n\t make COMMAND TESTPLAN=001-big-blocks\n\n"
exit 1
endif
.PHONY: check-testplan-arg
Expand Down Expand Up @@ -97,27 +96,31 @@ ifeq (,${NAME})
endif
.phony: check-composition-arg

## tg-start: Start the testground deamon
## tg-start: Start the deamon
tg-start:
testground daemon
$(TGPATH) daemon
.PHONY: tg-start

## tg-create-testplan: Create test plan under ./plans/ of this repository
tg-create-testplan: check-name-arg
TESTGROUND_HOME=${DIR_FULLPATH} testground plan create --plan=${NAME}
tg-create-testplan: $(TG) check-name-arg
TESTGROUND_HOME=${DIR_FULLPATH} $(TG) plan create --plan=${NAME}
@rm -rf ./data ./sdks
@mkdir ./docs/test-plans/${NAME}
@cp ./docs/test-plans/tp-template.md ./docs/test-plans/${NAME}/${NAME}.md
.PHONY: tg-create-testplan

## tg-import-testplan Import testplan to TESTGROUND_HOME
tg-import-testplan: check-testplan-arg check-name-arg
testground plan import --from ./plans/${TESTPLAN} --name ${NAME}
## tg-import-testplan: Import testplan to TESTGROUND_HOME
tg-import-testplan: $(TG) check-testplan-arg check-name-arg
$(TG) plan import --from ./plans/${TESTPLAN} --name ${NAME}
.PHONY: tg-import-testplan

## tg-run-composition: runs a specific composition by name given a testplan and a runner
tg-run-composition: check-testplan-arg check-runner-arg check-composition-arg
@testground run composition \
tg-run-composition: $(TG) check-testplan-arg check-runner-arg check-composition-arg
$(TG) run composition \
-f plans/${TESTPLAN}/compositions/${RUNNER}/${COMPOSITION}.toml \
--wait
.PHONY: tg-run-testplan
.PHONY: tg-run-composition

## tg-run: alias to tg-run-composition
tg-run: tg-run-composition
.PHONY: tg-run
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,26 @@ This will create a new go module with a `manifest.toml` under `./plans/YOUR_DESI
1. Import your desired test plan into `TESTGROUND_HOME`
```bash
$ cd test-infra
$ make tg-testplan-import NAME=YOUR_TEST_PLAN
$ make tg-import-testplan NAME=001-big-blocks TESTPLAN=001-big-blocks
```
Available plans are in `./plans`

2. Launch the testground daemon
```bash
# This command should be executed in the 1st terminal
$ testground daemon
```

3. Run a composition of your testplan
3. In another terminal, run a composition of your testplan
```
# This command should be executed in the 2nd terminal
$ make tg-run-composition TESTPLAN=YOUR_TEST_PLAN RUNNER=DESIRED_RUNNER COMPOSITION=COMPOSITION_NAME
```
Note: `COMPOSITION` should only include the composition's filename, without the `.toml` extension
`RUNNER` by default is `local-docker`. Another possible value is `cluster-k8s`

Example:
```
$ make tg-run-composition RUNNER=local-docker TESTPLAN=001-big-blocks COMPOSITION=002-da-sync-12
```

## Code of Conduct

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
author = "Bidon15"

[global]
plan = "001-big-blocks
plan = "001-big-blocks"
case = "002-da-sync"
total_instances = 12
total_instances = 8
builder = "docker:generic"
runner = "local:docker"
disable_metrics = false

[global.run.test_params]
execution-time = "10"
persistent-peers = "3"
submit-times = "12"
submit-times = "8"
msg-size = "100000"
validator = "3"
bridge = "3"
full = "3"
light = "3"
full = "1"
light = "1"

[[groups]]
id = "validators"
Expand Down Expand Up @@ -70,7 +70,7 @@
memory = ""
cpu = ""
[groups.instances]
count = 3
count = 1
percentage = 0.0
[groups.build_config]
build_base_image = "golang:1.19.1"
Expand All @@ -92,7 +92,7 @@
memory = ""
cpu = ""
[groups.instances]
count = 3
count = 1
percentage = 0.0
[groups.build_config]
build_base_image = "golang:1.19.1"
Expand Down
12 changes: 7 additions & 5 deletions plans/001-big-blocks/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ module github.com/celestiaorg/test-infra/plans/001-big-blocks

go 1.19

require github.com/celestiaorg/test-infra/testkit v0.0.0-20221020113323-2f2873f97406

replace (
github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76
github.com/celestiaorg/celestia-app => github.com/Bidon15/lazyledger-app v1.5.0-dirty-app
Expand All @@ -18,15 +16,15 @@ replace (
require (
cosmossdk.io/errors v1.0.0-beta.7 // indirect
github.com/celestiaorg/celestia-app v0.7.0 // indirect
github.com/cosmos/cosmos-sdk v0.46.2 // indirect
github.com/cosmos/cosmos-sdk v0.46.0 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/libp2p/go-libp2p-core v0.19.1 // indirect
github.com/spf13/cobra v1.6.0 // indirect
github.com/spf13/viper v1.13.0 // indirect
github.com/testground/sdk-go v0.3.0
)

require github.com/celestiaorg/celestia-node v0.4.0
require github.com/celestiaorg/celestia-node v0.4.2-0.20221028203714-c4ad2778f994

require (
cloud.google.com/go v0.104.0 // indirect
Expand Down Expand Up @@ -55,6 +53,8 @@ require (
github.com/celestiaorg/nmt v0.10.0 // indirect
github.com/celestiaorg/quantum-gravity-bridge v1.2.0 // indirect
github.com/celestiaorg/rsmt2d v0.6.0 // indirect
github.com/celestiaorg/test-infra v0.0.0-20221028204004-6bc1cca8c56e // indirect
github.com/celestiaorg/test-infra/testkit v0.0.0-20221028204235-b3e7beabb71e // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
Expand Down Expand Up @@ -90,6 +90,7 @@ require (
github.com/elastic/gosigar v0.14.2 // indirect
github.com/ethereum/go-ethereum v1.10.21 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/filecoin-project/go-jsonrpc v0.1.8 // indirect
github.com/flynn/noise v1.0.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
Expand Down Expand Up @@ -167,6 +168,7 @@ require (
github.com/ipfs/go-metrics-interface v0.0.1 // indirect
github.com/ipfs/go-peertaskqueue v0.7.0 // indirect
github.com/ipfs/go-verifcid v0.0.1 // indirect
github.com/ipld/go-car v0.5.0 // indirect
github.com/ipld/go-codec-dagpb v1.3.1 // indirect
github.com/ipld/go-ipld-prime v0.16.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
Expand Down Expand Up @@ -268,7 +270,7 @@ require (
github.com/tendermint/btcd v0.1.1 // indirect
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tendermint/tendermint v0.35.9 // indirect
github.com/tendermint/tendermint v0.34.20 // indirect
github.com/tendermint/tm-db v0.6.7 // indirect
github.com/testground/sync-service v0.1.0 // indirect
github.com/testground/testground v0.5.3 // indirect
Expand Down
25 changes: 25 additions & 0 deletions plans/001-big-blocks/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ github.com/celestiaorg/celestia-core v1.5.0-tm-v0.34.20 h1:BqlcOQqL2UqdDTcdCtrOL
github.com/celestiaorg/celestia-core v1.5.0-tm-v0.34.20/go.mod h1:f4R8qNJrP1CDH0SNwj4jA3NymBLQM4lNdx6Ijmfllbw=
github.com/celestiaorg/celestia-node v0.4.0 h1:xxExCC4l8YCgrk178QbhrHbhQXbCSTV6E4DdSw90K54=
github.com/celestiaorg/celestia-node v0.4.0/go.mod h1:tBXn+ddZHBj0925y7ydYDnVCsJuzP6PFW/i1c+Ewe9k=
github.com/celestiaorg/celestia-node v0.4.2-0.20221028192948-6955feab214d h1:oYOsuwPHUDWewuuWs3x18z7UWkXKd40SkvI/LXpAvaQ=
github.com/celestiaorg/celestia-node v0.4.2-0.20221028192948-6955feab214d/go.mod h1:T+Oe8I8MSTzXhLg3/5ZjxRNhEI7v1A0clPECWozK/98=
github.com/celestiaorg/celestia-node v0.4.2-0.20221028203714-c4ad2778f994 h1:JNcml2fWxuFv6TOBixQ6m8ilV5Be0eY247EFvHIb6wc=
github.com/celestiaorg/celestia-node v0.4.2-0.20221028203714-c4ad2778f994/go.mod h1:T+Oe8I8MSTzXhLg3/5ZjxRNhEI7v1A0clPECWozK/98=
github.com/celestiaorg/go-leopard v0.1.1 h1:BustWqKRulKam5lAIT4VrgYKNBeTb+XVD1nP1l+A1pg=
github.com/celestiaorg/go-leopard v0.1.1/go.mod h1:NtO/rjlB8dw2aq7jr06vZFKGvryQcTDXaNHelmPNOAM=
github.com/celestiaorg/go-libp2p-messenger v0.1.0 h1:rFldTa3ZWcRRn8E2bRWS94Qp1GFYXO2a0uvqpIey1B8=
Expand All @@ -192,8 +196,24 @@ github.com/celestiaorg/quantum-gravity-bridge v1.2.0 h1:l/LEEUP+x8MhhXB8rrWkyUVF
github.com/celestiaorg/quantum-gravity-bridge v1.2.0/go.mod h1:6WOajINTDEUXpSj5UZzod16UZ96ZVB/rFNKyM+Mt1gI=
github.com/celestiaorg/rsmt2d v0.6.0 h1:32Eq5t7lPNbhftPFFjxwCUeEjWg/yGgeMbshxnGw03c=
github.com/celestiaorg/rsmt2d v0.6.0/go.mod h1:EZ+O2KdCq8xI7WFwjATLdhtMdrdClmAs2w7zENDr010=
github.com/celestiaorg/test-infra v0.0.0-20221028193838-683783009110 h1:ATudsAOSz03PtiUtRHwRr5f0VK+P1K4G89qaKka5yp4=
github.com/celestiaorg/test-infra v0.0.0-20221028193838-683783009110/go.mod h1:5V23smGkEmqotOlwMeAPHZzbTrhAltPPBY5VuBFSPSA=
github.com/celestiaorg/test-infra v0.0.0-20221028200744-e7da4d7d86a7 h1:HosFqiT3SNm4Ca11vlFdp1FCKVdQSxlcK+6gIJ3o4js=
github.com/celestiaorg/test-infra v0.0.0-20221028200744-e7da4d7d86a7/go.mod h1:5V23smGkEmqotOlwMeAPHZzbTrhAltPPBY5VuBFSPSA=
github.com/celestiaorg/test-infra v0.0.0-20221028204004-6bc1cca8c56e h1:UCvmn4vgeVvC2cI0fEfsrnn1qxnSoQA0UBaGWTPJmsg=
github.com/celestiaorg/test-infra v0.0.0-20221028204004-6bc1cca8c56e/go.mod h1:5V23smGkEmqotOlwMeAPHZzbTrhAltPPBY5VuBFSPSA=
github.com/celestiaorg/test-infra/testkit v0.0.0-20221020113323-2f2873f97406 h1:2yl7mMRe67wRycbyI/wvVYSKDbDh441W2ddw112jTU0=
github.com/celestiaorg/test-infra/testkit v0.0.0-20221020113323-2f2873f97406/go.mod h1:dqY1h5SWVvqGDvYrxkGQvv4987V/hHzux8YUZelBMrM=
github.com/celestiaorg/test-infra/testkit v0.0.0-20221028194537-bded55d1c108 h1:tXvTTBU3jG0q+43TvrdRj3VGO/TDa1+FkYra4yX+6no=
github.com/celestiaorg/test-infra/testkit v0.0.0-20221028194537-bded55d1c108/go.mod h1:HJnE8RfGLNIMg3rRIL0Uy02ReeW4GW6tRW7lJ/+O4fU=
github.com/celestiaorg/test-infra/testkit v0.0.0-20221028195730-21f2cfbf4c17 h1:klF530CbbQEplEK8RxkpQt+sjJIA5zRejxEKod0xYho=
github.com/celestiaorg/test-infra/testkit v0.0.0-20221028195730-21f2cfbf4c17/go.mod h1:HJnE8RfGLNIMg3rRIL0Uy02ReeW4GW6tRW7lJ/+O4fU=
github.com/celestiaorg/test-infra/testkit v0.0.0-20221028200744-e7da4d7d86a7 h1:F8bCL/P1KM1ePbuLy5F508uuRNRi2rp6OnddnaZoLtY=
github.com/celestiaorg/test-infra/testkit v0.0.0-20221028200744-e7da4d7d86a7/go.mod h1:HJnE8RfGLNIMg3rRIL0Uy02ReeW4GW6tRW7lJ/+O4fU=
github.com/celestiaorg/test-infra/testkit v0.0.0-20221028204004-6bc1cca8c56e h1:jZpjglw+t5pgiIR/rZXSc0cMCH3YS43EX9qX2mjezrs=
github.com/celestiaorg/test-infra/testkit v0.0.0-20221028204004-6bc1cca8c56e/go.mod h1:mKT+VN1UVpGt1fJOUW5GaYtB5yApxqsj+VTX1E7tk2M=
github.com/celestiaorg/test-infra/testkit v0.0.0-20221028204235-b3e7beabb71e h1:YubElQPG6mqlj9PVj/XtHcdlhK/1rx46/g05f5IJvJs=
github.com/celestiaorg/test-infra/testkit v0.0.0-20221028204235-b3e7beabb71e/go.mod h1:mKT+VN1UVpGt1fJOUW5GaYtB5yApxqsj+VTX1E7tk2M=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
Expand Down Expand Up @@ -385,6 +405,8 @@ github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/filecoin-project/go-jsonrpc v0.1.8 h1:uXX/ikAk3Q4f/k8DRd9Zw+fWnfiYb5I+UI1tzlQgHog=
github.com/filecoin-project/go-jsonrpc v0.1.8/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/flynn/noise v1.0.0 h1:DlTHqmzmvcEiKj+4RYo/imoswx/4r6iBlCMfVtrMXpQ=
github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag=
Expand Down Expand Up @@ -597,6 +619,7 @@ github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH
github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
Expand Down Expand Up @@ -788,6 +811,8 @@ github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fG
github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY=
github.com/ipfs/go-peertaskqueue v0.7.0 h1:VyO6G4sbzX80K58N60cCaHsSsypbUNs1GjO5seGNsQ0=
github.com/ipfs/go-peertaskqueue v0.7.0/go.mod h1:M/akTIE/z1jGNXMU7kFB4TeSEFvj68ow0Rrb04donIU=
github.com/ipld/go-car v0.5.0 h1:kcCEa3CvYMs0iE5BzD5sV7O2EwMiCIp3uF8tA6APQT8=
github.com/ipld/go-car v0.5.0/go.mod h1:ppiN5GWpjOZU9PgpAZ9HbZd9ZgSpwPMr48fGRJOWmvE=
github.com/ipld/go-codec-dagpb v1.3.1 h1:yVNlWRQexCa54ln3MSIiUN++ItH7pdhBFhh0hSgZu1w=
github.com/ipld/go-codec-dagpb v1.3.1/go.mod h1:ErNNglIi5KMur/MfFE/svtgQthzVvf+43MrzLbpcIZY=
github.com/ipld/go-ipld-prime v0.9.0/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
Expand Down
2 changes: 1 addition & 1 deletion plans/001-big-blocks/tests/node-sync/run_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func RunFullNode(runenv *runtime.RunEnv, initCtx *run.InitContext) error {
)
defer cancel()

err := nodekit.SetLoggersLevel("INFO")
err := nodekit.SetLoggersLevel("DEBUG")
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion plans/001-big-blocks/tests/node-sync/run_light.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func RunLightNode(runenv *runtime.RunEnv, initCtx *run.InitContext) error {
)
defer cancel()

err := nodekit.SetLoggersLevel("INFO")
err := nodekit.SetLoggersLevel("DEBUG")
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions testkit/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ replace (

require (
github.com/celestiaorg/celestia-app v0.7.0
github.com/celestiaorg/celestia-node v0.4.0
github.com/cosmos/cosmos-sdk v0.46.2
github.com/celestiaorg/celestia-node v0.4.2-0.20221028203714-c4ad2778f994
github.com/cosmos/cosmos-sdk v0.46.0
github.com/ipfs/go-log/v2 v2.5.1
github.com/libp2p/go-libp2p-core v0.19.1
github.com/spf13/cobra v1.6.0
github.com/spf13/viper v1.13.0
github.com/tendermint/tendermint v0.35.9
github.com/tendermint/tendermint v0.34.20
github.com/testground/sdk-go v0.3.0
go.uber.org/fx v1.18.2
)
Expand Down
Loading