From d908e59a53dea313dc1b645b8b2d83ad8b7c708a Mon Sep 17 00:00:00 2001 From: Nhu Viet Nguyen Date: Wed, 31 Aug 2022 10:27:13 +0200 Subject: [PATCH 1/8] feat: implementation of test-case #001 - compositions are ordered by test-case -> data-sets - adding a readme - adapt manifest.toml --- README.md | 56 ++++++++++++++++--- .../100-vals-40kb-pfd/320mib-0ms.toml | 36 ++++++++++++ .../100-vals-40kb-pfd/320mib-100ms.toml | 36 ++++++++++++ .../100-vals-40kb-pfd/320mib-200ms.toml | 36 ++++++++++++ .../40-vals-100kb-pfd/256mib-0ms.toml | 36 ++++++++++++ .../40-vals-100kb-pfd/320mib-100ms.toml | 36 ++++++++++++ .../40-vals-100kb-pfd/320mib-200ms.toml | 36 ++++++++++++ .../80-vals-50kb-pfd/320mib-0ms.toml} | 6 +- .../80-vals-50kb-pfd/320mib-100ms.toml | 36 ++++++++++++ .../80-vals-50kb-pfd/320mib-200ms.toml | 36 ++++++++++++ ...lidators.toml => 001-val-large-txs-3.toml} | 4 +- main.go | 4 +- manifest.toml | 4 +- tests/app-sync/run_validator.go | 6 +- tests/init_validators.go | 29 ---------- tests/tc-001-val-large-txs.go | 23 ++++++++ 16 files changed, 374 insertions(+), 46 deletions(-) create mode 100644 compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-0ms.toml create mode 100644 compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-100ms.toml create mode 100644 compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-200ms.toml create mode 100644 compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/256mib-0ms.toml create mode 100644 compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-100ms.toml create mode 100644 compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-200ms.toml rename compositions/cluster-k8s/{gen-validators.toml => tc-001-val-large-txs/80-vals-50kb-pfd/320mib-0ms.toml} (85%) create mode 100644 compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-100ms.toml create mode 100644 compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-200ms.toml rename compositions/local-docker/{gen-validators.toml => 001-val-large-txs-3.toml} (91%) delete mode 100644 tests/init_validators.go create mode 100644 tests/tc-001-val-large-txs.go diff --git a/README.md b/README.md index 6ff88f3b..26a867a9 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,59 @@ -# test-infra -Testing infrastructure for the Celestia Network +# Testing & Infrastructure :microscope: :globe_with_meridians: -Please install testground before executing the test-plan +Testing scenarios and network infrastructure for the Celestia Network -After installing, follow these commands +## Pre-Requisites + +Please install `docker` and [testground](https://docs.testground.ai/v/master/getting-started) +to execute network tests. + +## Go requirements + +| Requirement | Notes | +| ----------- | -------------- | +| Go version | 1.18 or higher | + +## System Requirements + +We have compositions that are separated into 2 environments: + +1. `local:docker` +2. `cluster:k8s` + +| Environment | CPU (cores) | RAM (Gib) | +| ------------ | :---------: | :-------: | +| local:docker | 8~16 | 16~32 | +| cluster:k8s | 3000~4000 | 4000~5000 | + +At the moment, we are only using `docker:generic` as a builder. +Please, check our `Dockerfile` for more information. + +## Repo Navigation + +The repository is divided into 4 main directories: + +1. `docs` +2. `compositions` +3. `tests` +4. `testkit` + +The order of directories above :point_up: is how the repo should be read +if you want to get acquinted with test plans/cases design and their further implementations. +Each of the directories contains its own `README.md` + +## Test Execution ```bash cd test-infra testground plan --import . --name celestia -# This command should be executed in the 1st terminal +# This command should be executed in the 1st terminal testground daemon # This command should be executed in the 2nd terminal -testground run composition -f local-compositions/gen-validators.toml --wait -``` \ No newline at end of file +testground run composition -f compositions/local-docker/001-val-large-txs-3.toml --wait +``` + +## Code of Conduct + +See our Code of Conduct [here](https://docs.celestia.org/community/coc). diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-0ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-0ms.toml new file mode 100644 index 00000000..5035073b --- /dev/null +++ b/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-0ms.toml @@ -0,0 +1,36 @@ +[metadata] + name = "001-val-large-txs-100-set" + author = "Bidon15" + +[global] + plan = "celestia" + case = "001-val-large-txs" + total_instances = 100 + builder = "docker:generic" + runner = "cluster:k8s" + disable_metrics = false + +[global.run.test_params] + latency = "0" + bandwidth = "320Mib" + persistent-peers = "10" + submit-times = "10" + msg-size = "40000" + +[[groups]] + id = "validators" + builder = "docker:generic" + [groups.resources] + memory = "4Gi" + cpu = "3" + [groups.instances] + count = 80 + percentage = 0.0 + [groups.build_config] + build_base_image = "golang:1.18.3" + enable_go_build_cache = true + enabled = true + go_version = "1.18" + [groups.build] + [groups.run] + artifact = "" diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-100ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-100ms.toml new file mode 100644 index 00000000..5035073b --- /dev/null +++ b/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-100ms.toml @@ -0,0 +1,36 @@ +[metadata] + name = "001-val-large-txs-100-set" + author = "Bidon15" + +[global] + plan = "celestia" + case = "001-val-large-txs" + total_instances = 100 + builder = "docker:generic" + runner = "cluster:k8s" + disable_metrics = false + +[global.run.test_params] + latency = "0" + bandwidth = "320Mib" + persistent-peers = "10" + submit-times = "10" + msg-size = "40000" + +[[groups]] + id = "validators" + builder = "docker:generic" + [groups.resources] + memory = "4Gi" + cpu = "3" + [groups.instances] + count = 80 + percentage = 0.0 + [groups.build_config] + build_base_image = "golang:1.18.3" + enable_go_build_cache = true + enabled = true + go_version = "1.18" + [groups.build] + [groups.run] + artifact = "" diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-200ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-200ms.toml new file mode 100644 index 00000000..e3d631b4 --- /dev/null +++ b/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-200ms.toml @@ -0,0 +1,36 @@ +[metadata] + name = "001-val-large-txs-100-set" + author = "Bidon15" + +[global] + plan = "celestia" + case = "001-val-large-txs" + total_instances = 100 + builder = "docker:generic" + runner = "cluster:k8s" + disable_metrics = false + +[global.run.test_params] + latency = "200" + bandwidth = "320Mib" + persistent-peers = "10" + submit-times = "10" + msg-size = "40000" + +[[groups]] + id = "validators" + builder = "docker:generic" + [groups.resources] + memory = "4Gi" + cpu = "3" + [groups.instances] + count = 80 + percentage = 0.0 + [groups.build_config] + build_base_image = "golang:1.18.3" + enable_go_build_cache = true + enabled = true + go_version = "1.18" + [groups.build] + [groups.run] + artifact = "" diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/256mib-0ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/256mib-0ms.toml new file mode 100644 index 00000000..e2add8c4 --- /dev/null +++ b/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/256mib-0ms.toml @@ -0,0 +1,36 @@ +[metadata] + name = "001-val-large-txs-40-set" + author = "Bidon15" + +[global] + plan = "celestia" + case = "001-val-large-txs" + total_instances = 40 + builder = "docker:generic" + runner = "cluster:k8s" + disable_metrics = false + +[global.run.test_params] + latency = "0" + bandwidth = "256Mib" + persistent-peers = "10" + submit-times = "10" + msg-size = "100000" + +[[groups]] + id = "validators" + builder = "docker:generic" + [groups.resources] + memory = "4Gi" + cpu = "3" + [groups.instances] + count = 40 + percentage = 0.0 + [groups.build_config] + build_base_image = "golang:1.18.3" + enable_go_build_cache = true + enabled = true + go_version = "1.18" + [groups.build] + [groups.run] + artifact = "" diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-100ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-100ms.toml new file mode 100644 index 00000000..aae9af21 --- /dev/null +++ b/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-100ms.toml @@ -0,0 +1,36 @@ +[metadata] + name = "001-val-large-txs-40-set" + author = "Bidon15" + +[global] + plan = "celestia" + case = "001-val-large-txs" + total_instances = 40 + builder = "docker:generic" + runner = "cluster:k8s" + disable_metrics = false + +[global.run.test_params] + latency = "100" + bandwidth = "320Mib" + persistent-peers = "10" + submit-times = "10" + msg-size = "100000" + +[[groups]] + id = "validators" + builder = "docker:generic" + [groups.resources] + memory = "4Gi" + cpu = "3" + [groups.instances] + count = 40 + percentage = 0.0 + [groups.build_config] + build_base_image = "golang:1.18.3" + enable_go_build_cache = true + enabled = true + go_version = "1.18" + [groups.build] + [groups.run] + artifact = "" diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-200ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-200ms.toml new file mode 100644 index 00000000..bf43590e --- /dev/null +++ b/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-200ms.toml @@ -0,0 +1,36 @@ +[metadata] + name = "001-val-large-txs-40-set" + author = "Bidon15" + +[global] + plan = "celestia" + case = "001-val-large-txs" + total_instances = 40 + builder = "docker:generic" + runner = "cluster:k8s" + disable_metrics = false + +[global.run.test_params] + latency = "200" + bandwidth = "320Mib" + persistent-peers = "10" + submit-times = "10" + msg-size = "100000" + +[[groups]] + id = "validators" + builder = "docker:generic" + [groups.resources] + memory = "4Gi" + cpu = "3" + [groups.instances] + count = 40 + percentage = 0.0 + [groups.build_config] + build_base_image = "golang:1.18.3" + enable_go_build_cache = true + enabled = true + go_version = "1.18" + [groups.build] + [groups.run] + artifact = "" diff --git a/compositions/cluster-k8s/gen-validators.toml b/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-0ms.toml similarity index 85% rename from compositions/cluster-k8s/gen-validators.toml rename to compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-0ms.toml index 0c79a965..56e61f9b 100644 --- a/compositions/cluster-k8s/gen-validators.toml +++ b/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-0ms.toml @@ -1,10 +1,10 @@ [metadata] - name = "app-validator" + name = "001-val-large-txs-80-set" author = "Bidon15" [global] plan = "celestia" - case = "init-val" + case = "001-val-large-txs" total_instances = 80 builder = "docker:generic" runner = "cluster:k8s" @@ -15,6 +15,8 @@ bandwidth = "320Mib" validator = "80" persistent-peers = "10" + submit-times = "10" + msg-size = "50000" [[groups]] id = "validators" diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-100ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-100ms.toml new file mode 100644 index 00000000..349582ca --- /dev/null +++ b/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-100ms.toml @@ -0,0 +1,36 @@ +[metadata] + name = "001-val-large-txs-80-set" + author = "Bidon15" + +[global] + plan = "celestia" + case = "001-val-large-txs" + total_instances = 80 + builder = "docker:generic" + runner = "cluster:k8s" + disable_metrics = false + +[global.run.test_params] + latency = "100" + bandwidth = "320Mib" + persistent-peers = "10" + submit-times = "10" + msg-size = "50000" + +[[groups]] + id = "validators" + builder = "docker:generic" + [groups.resources] + memory = "4Gi" + cpu = "3" + [groups.instances] + count = 80 + percentage = 0.0 + [groups.build_config] + build_base_image = "golang:1.18.3" + enable_go_build_cache = true + enabled = true + go_version = "1.18" + [groups.build] + [groups.run] + artifact = "" diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-200ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-200ms.toml new file mode 100644 index 00000000..e4d0b351 --- /dev/null +++ b/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-200ms.toml @@ -0,0 +1,36 @@ +[metadata] + name = "001-val-large-txs-80-set" + author = "Bidon15" + +[global] + plan = "celestia" + case = "001-val-large-txs" + total_instances = 80 + builder = "docker:generic" + runner = "cluster:k8s" + disable_metrics = false + +[global.run.test_params] + latency = "200" + bandwidth = "320Mib" + persistent-peers = "10" + submit-times = "10" + msg-size = "50000" + +[[groups]] + id = "validators" + builder = "docker:generic" + [groups.resources] + memory = "4Gi" + cpu = "3" + [groups.instances] + count = 80 + percentage = 0.0 + [groups.build_config] + build_base_image = "golang:1.18.3" + enable_go_build_cache = true + enabled = true + go_version = "1.18" + [groups.build] + [groups.run] + artifact = "" diff --git a/compositions/local-docker/gen-validators.toml b/compositions/local-docker/001-val-large-txs-3.toml similarity index 91% rename from compositions/local-docker/gen-validators.toml rename to compositions/local-docker/001-val-large-txs-3.toml index 056a4e5c..0a504ea5 100644 --- a/compositions/local-docker/gen-validators.toml +++ b/compositions/local-docker/001-val-large-txs-3.toml @@ -1,10 +1,10 @@ [metadata] - name = "app-validator" + name = "001-val-large-txs" author = "Bidon15" [global] plan = "celestia" - case = "init-val" + case = "001-val-large-txs" total_instances = 3 builder = "docker:generic" runner = "local:docker" diff --git a/main.go b/main.go index 1e3b4b6e..8aed691c 100644 --- a/main.go +++ b/main.go @@ -6,8 +6,8 @@ import ( ) var testcases = map[string]interface{}{ - "init-val": run.InitializedTestCaseFn(tests.InitVal), - "node-sync": run.InitializedTestCaseFn(tests.SyncNodes), + "001-val-large-txs": run.InitializedTestCaseFn(tests.ValSubmitLargeTxs), + "node-sync": run.InitializedTestCaseFn(tests.SyncNodes), } func main() { diff --git a/manifest.toml b/manifest.toml index 1735f530..2d147671 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,13 +17,15 @@ enabled = true enabled = true [[testcases]] -name = "init-val" +name = "001-val-large-txs" instances = { min = 1, max = 100, default = 3 } [testcases.params] latency = { type = "int", default = 0} bandwidth = { type = "string", default = "256Mib"} validator = { type = "int", default = 3} persistent-peers = { type = "int", default = 3} + submit-times = { type = "int", default = 4} + msg-size = { type = "int", default = 10000} [[testcases]] name = "node-sync" diff --git a/tests/app-sync/run_validator.go b/tests/app-sync/run_validator.go index dd18e333..90f12121 100644 --- a/tests/app-sync/run_validator.go +++ b/tests/app-sync/run_validator.go @@ -58,11 +58,11 @@ func RunValidator(runenv *runtime.RunEnv, initCtx *run.InitContext) error { time.Sleep(1 * time.Minute) // If all 3 validators submit pfd - it will take too long to produce a new block - for i := 0; i < 10; i++ { - runenv.RecordMessage("Submitting PFD with 90k bytes random data") + for i := 0; i < runenv.IntParam("submit-times"); i++ { + runenv.RecordMessage("Submitting PFD with %d bytes random data", runenv.IntParam("msg-size")) err = appcmd.PayForData( appcmd.AccountAddress, - 50000, + runenv.IntParam("msg-size"), "test", appcmd.GetHomePath(), ) diff --git a/tests/init_validators.go b/tests/init_validators.go deleted file mode 100644 index ec9c310c..00000000 --- a/tests/init_validators.go +++ /dev/null @@ -1,29 +0,0 @@ -package tests - -import ( - appsync "github.com/celestiaorg/test-infra/tests/app-sync" - "github.com/testground/sdk-go/run" - "github.com/testground/sdk-go/runtime" -) - -// This test-case is a 101 on how Celestia-App only should be started. -// In this test-case, we are testing the following scenario: -// 1. Every instance can create an account -// 2. The orchestrator(described more below) funds the account at genesis -// and sends the initial genesis.json to the rest of the validators' set -// 3. After receiving the initial genesis.json, validators are signing the -// genesis transaction(gentx) -// 4. Validators collects all genesis transactions -// 5. The chain is started -func InitVal(runenv *runtime.RunEnv, initCtx *run.InitContext) error { - var err error - - switch runenv.TestGroupID { - case "validators": - err = appsync.RunValidator(runenv, initCtx) - case "seeds": - err = appsync.RunSeed(runenv, initCtx) - } - - return err -} diff --git a/tests/tc-001-val-large-txs.go b/tests/tc-001-val-large-txs.go new file mode 100644 index 00000000..21e78e69 --- /dev/null +++ b/tests/tc-001-val-large-txs.go @@ -0,0 +1,23 @@ +package tests + +import ( + appsync "github.com/celestiaorg/test-infra/tests/app-sync" + "github.com/testground/sdk-go/run" + "github.com/testground/sdk-go/runtime" +) + +// Test-Case #001 - Validators submit large txs +// Description is in docs/test-plans/001-Big-Blocks/test-cases +func ValSubmitLargeTxs(runenv *runtime.RunEnv, initCtx *run.InitContext) error { + var err error + + switch runenv.TestGroupID { + case "validators": + err = appsync.RunValidator(runenv, initCtx) + // we don't have seeds rn. More info in the func + case "seeds": + err = appsync.RunSeed(runenv, initCtx) + } + + return err +} From c5c9675bf7cdb07c2c54230c460154581a0f14d3 Mon Sep 17 00:00:00 2001 From: Nhu Viet Nguyen Date: Wed, 31 Aug 2022 11:45:54 +0200 Subject: [PATCH 2/8] doc: adding more readmes per each root directory --- compositions/README.md | 16 ++++++++++++++++ testkit/README.md | 11 +++++++++++ tests/README.md | 8 ++++++++ 3 files changed, 35 insertions(+) create mode 100644 compositions/README.md create mode 100644 testkit/README.md create mode 100644 tests/README.md diff --git a/compositions/README.md b/compositions/README.md new file mode 100644 index 00000000..763b70a2 --- /dev/null +++ b/compositions/README.md @@ -0,0 +1,16 @@ +# Compositions + +Please navigate to the `manifest.toml` if you want to know more about which test cases/params are defined for the compositions +to set during test runs + +## local-docker + +This directory contains sanity compositions that can be easily run on a local PC or any small VM(e.g. DO droplet) +The motivation is to do quick regression check-ups if any PR arises from the stack(core/app/node etc.) + +## cluster-k8s + +This directory contains compositions that are described in `docs/test-plans`. The sorting of inner directories +are following the same pattern as the test-plan to test-case placement. Namings of directories and files follow this style: + +`test-case-id` -> `participants-amount` -> `bandwidth-latency-per-participant` diff --git a/testkit/README.md b/testkit/README.md new file mode 100644 index 00000000..43bb4b0d --- /dev/null +++ b/testkit/README.md @@ -0,0 +1,11 @@ +# Testing Kit + +This directory contains all necessary implementations that are utilized in `tests` directory + +Mainly: + +- Sync Topics +- App Creation and CLI handling +- Node Creation + +Please follow up to dedicated inner `doc.go` for more details diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 00000000..90939ee5 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,8 @@ +# Tests + +Each `*.go` follows the naming of the test-case in `docs/test-plan/test-plan-id/*`. + +In order to not clutter the test-file with different participants' steps, each dedicated directory is created to +maintain steps of each types of participants. + +The `common` directory is maintaining steps for a participant that plays the same role in every of the test-case(e.g. creating a validators set) \ No newline at end of file From e3f6baca810d5982c932ee5576215664051f378a Mon Sep 17 00:00:00 2001 From: Nhu Viet Nguyen Date: Mon, 5 Sep 2022 11:51:45 +0200 Subject: [PATCH 3/8] chore: remove err declaration in the func Co-authored-by: Viacheslav Gonkivskyi --- tests/tc-001-val-large-txs.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/tc-001-val-large-txs.go b/tests/tc-001-val-large-txs.go index 21e78e69..ceea3c46 100644 --- a/tests/tc-001-val-large-txs.go +++ b/tests/tc-001-val-large-txs.go @@ -8,9 +8,7 @@ import ( // Test-Case #001 - Validators submit large txs // Description is in docs/test-plans/001-Big-Blocks/test-cases -func ValSubmitLargeTxs(runenv *runtime.RunEnv, initCtx *run.InitContext) error { - var err error - +func ValSubmitLargeTxs(runenv *runtime.RunEnv, initCtx *run.InitContext) (err error) { switch runenv.TestGroupID { case "validators": err = appsync.RunValidator(runenv, initCtx) From c42a81d7522d960fa0ec7fb7fd448ee9dbf51b91 Mon Sep 17 00:00:00 2001 From: Nguyen Nhu Viet Date: Tue, 6 Sep 2022 11:56:25 +0300 Subject: [PATCH 4/8] Apply suggestions from code review Co-authored-by: CHAMI Rachid --- README.md | 2 +- compositions/README.md | 9 +++------ testkit/README.md | 6 ++---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 26a867a9..97ff8132 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ The repository is divided into 4 main directories: The order of directories above :point_up: is how the repo should be read if you want to get acquinted with test plans/cases design and their further implementations. -Each of the directories contains its own `README.md` +Each of the directories contains its own `README.md`. ## Test Execution diff --git a/compositions/README.md b/compositions/README.md index 763b70a2..c373ba4f 100644 --- a/compositions/README.md +++ b/compositions/README.md @@ -1,16 +1,13 @@ # Compositions -Please navigate to the `manifest.toml` if you want to know more about which test cases/params are defined for the compositions -to set during test runs +Please navigate to the `manifest.toml` if you want to know more about which test cases/params are defined for the compositions to set during test runs ## local-docker -This directory contains sanity compositions that can be easily run on a local PC or any small VM(e.g. DO droplet) -The motivation is to do quick regression check-ups if any PR arises from the stack(core/app/node etc.) +This directory contains sanity compositions that can be easily run on a local PC or any small VM(e.g. DO droplet). The motivation is to do quick regression check-ups if any PR arises from the stack(core/app/node etc). ## cluster-k8s -This directory contains compositions that are described in `docs/test-plans`. The sorting of inner directories -are following the same pattern as the test-plan to test-case placement. Namings of directories and files follow this style: +This directory contains compositions that are described in `docs/test-plans`. The sorting of inner directories are following the same pattern as the test-plan to test-case placement. Namings of directories and files follow this style: `test-case-id` -> `participants-amount` -> `bandwidth-latency-per-participant` diff --git a/testkit/README.md b/testkit/README.md index 43bb4b0d..d6fb395e 100644 --- a/testkit/README.md +++ b/testkit/README.md @@ -1,11 +1,9 @@ # Testing Kit -This directory contains all necessary implementations that are utilized in `tests` directory - -Mainly: +This directory contains all necessary implementations that are utilized in `tests` directory, mainly: - Sync Topics - App Creation and CLI handling - Node Creation -Please follow up to dedicated inner `doc.go` for more details +Please follow up to dedicated inner `doc.go` for more details. From db7fd39c2aefa20d008b4f02c7b9d01b042daed4 Mon Sep 17 00:00:00 2001 From: Nguyen Nhu Viet Date: Tue, 6 Sep 2022 11:56:40 +0300 Subject: [PATCH 5/8] Update README.md Co-authored-by: CHAMI Rachid --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 97ff8132..17eea9e7 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,7 @@ Testing scenarios and network infrastructure for the Celestia Network ## Pre-Requisites -Please install `docker` and [testground](https://docs.testground.ai/v/master/getting-started) -to execute network tests. +Please install `docker` and [testground](https://docs.testground.ai/v/master/getting-started) to execute network tests. ## Go requirements From 7aea12f38c90c158d4965fc741a18ca0c4d8dab0 Mon Sep 17 00:00:00 2001 From: Nhu Viet Nguyen Date: Wed, 14 Sep 2022 14:00:18 +0200 Subject: [PATCH 6/8] feat: adapt compositions to accept validator param Edit the orchestator to only init the chain and send the genesis.json Now all validators are doing genesis accounts --- .../100-vals-40kb-pfd/320mib-0ms.toml | 1 + .../100-vals-40kb-pfd/320mib-100ms.toml | 1 + .../100-vals-40kb-pfd/320mib-200ms.toml | 1 + .../40-vals-100kb-pfd/256mib-0ms.toml | 1 + .../40-vals-100kb-pfd/320mib-100ms.toml | 1 + .../40-vals-100kb-pfd/320mib-200ms.toml | 1 + .../80-vals-50kb-pfd/320mib-0ms.toml | 4 +- .../80-vals-50kb-pfd/320mib-100ms.toml | 1 + .../80-vals-50kb-pfd/320mib-200ms.toml | 1 + tests/common/validator.go | 54 +++++++++---------- 10 files changed, 37 insertions(+), 29 deletions(-) diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-0ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-0ms.toml index 5035073b..319f933f 100644 --- a/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-0ms.toml +++ b/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-0ms.toml @@ -13,6 +13,7 @@ [global.run.test_params] latency = "0" bandwidth = "320Mib" + validator = "100" persistent-peers = "10" submit-times = "10" msg-size = "40000" diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-100ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-100ms.toml index 5035073b..319f933f 100644 --- a/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-100ms.toml +++ b/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-100ms.toml @@ -13,6 +13,7 @@ [global.run.test_params] latency = "0" bandwidth = "320Mib" + validator = "100" persistent-peers = "10" submit-times = "10" msg-size = "40000" diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-200ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-200ms.toml index e3d631b4..05162fe0 100644 --- a/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-200ms.toml +++ b/compositions/cluster-k8s/tc-001-val-large-txs/100-vals-40kb-pfd/320mib-200ms.toml @@ -13,6 +13,7 @@ [global.run.test_params] latency = "200" bandwidth = "320Mib" + validator = "100" persistent-peers = "10" submit-times = "10" msg-size = "40000" diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/256mib-0ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/256mib-0ms.toml index e2add8c4..72704ab3 100644 --- a/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/256mib-0ms.toml +++ b/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/256mib-0ms.toml @@ -13,6 +13,7 @@ [global.run.test_params] latency = "0" bandwidth = "256Mib" + validator = "40" persistent-peers = "10" submit-times = "10" msg-size = "100000" diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-100ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-100ms.toml index aae9af21..4c16b98e 100644 --- a/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-100ms.toml +++ b/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-100ms.toml @@ -13,6 +13,7 @@ [global.run.test_params] latency = "100" bandwidth = "320Mib" + validator = "40" persistent-peers = "10" submit-times = "10" msg-size = "100000" diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-200ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-200ms.toml index bf43590e..0c8b46c1 100644 --- a/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-200ms.toml +++ b/compositions/cluster-k8s/tc-001-val-large-txs/40-vals-100kb-pfd/320mib-200ms.toml @@ -13,6 +13,7 @@ [global.run.test_params] latency = "200" bandwidth = "320Mib" + validator = "40" persistent-peers = "10" submit-times = "10" msg-size = "100000" diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-0ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-0ms.toml index 56e61f9b..4d85c16b 100644 --- a/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-0ms.toml +++ b/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-0ms.toml @@ -16,14 +16,14 @@ validator = "80" persistent-peers = "10" submit-times = "10" - msg-size = "50000" + msg-size = "48000" [[groups]] id = "validators" builder = "docker:generic" [groups.resources] memory = "4Gi" - cpu = "3" + cpu = "4" [groups.instances] count = 80 percentage = 0.0 diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-100ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-100ms.toml index 349582ca..d117928a 100644 --- a/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-100ms.toml +++ b/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-100ms.toml @@ -13,6 +13,7 @@ [global.run.test_params] latency = "100" bandwidth = "320Mib" + validator = "80" persistent-peers = "10" submit-times = "10" msg-size = "50000" diff --git a/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-200ms.toml b/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-200ms.toml index e4d0b351..dc5ad879 100644 --- a/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-200ms.toml +++ b/compositions/cluster-k8s/tc-001-val-large-txs/80-vals-50kb-pfd/320mib-200ms.toml @@ -13,6 +13,7 @@ [global.run.test_params] latency = "200" bandwidth = "320Mib" + validator = "80" persistent-peers = "10" submit-times = "10" msg-size = "50000" diff --git a/tests/common/validator.go b/tests/common/validator.go index 34bc9db1..de816226 100644 --- a/tests/common/validator.go +++ b/tests/common/validator.go @@ -24,7 +24,6 @@ func BuildValidator(ctx context.Context, runenv *runtime.RunEnv, initCtx *run.In const chainId string = "tia-test" cmd := appkit.New(home, chainId) - keyringName := fmt.Sprintf("keyName-%d", initCtx.GlobalSeq) accAddr, err := cmd.CreateKey(keyringName, "test", home) if err != nil { @@ -32,43 +31,36 @@ func BuildValidator(ctx context.Context, runenv *runtime.RunEnv, initCtx *run.In } cmd.AccountAddress = accAddr - _, err = syncclient.Publish(ctx, testkit.AccountAddressTopic, accAddr) + seq, err := syncclient.Publish(ctx, testkit.AccountAddressTopic, accAddr) if err != nil { return nil, err } - // Here we assign the first instance to be the orchestrator role - // - // Orchestrator is receiving all accounts by subscription, to then - // execute the `add-genesis-account` command and send back to the rest - // of the validators to set the initial genesis.json - if initCtx.GlobalSeq == 1 { - accAddrCh := make(chan string) - _, err = syncclient.Subscribe(ctx, testkit.AccountAddressTopic, accAddrCh) - if err != nil { - return nil, err - } + accAddrCh := make(chan string) + _, err = syncclient.Subscribe(ctx, testkit.AccountAddressTopic, accAddrCh) + if err != nil { + return nil, err + } - var accounts []string - for i := 0; i < runenv.IntParam("validator"); i++ { - addr := <-accAddrCh - runenv.RecordMessage("Received address: %s", addr) - accounts = append(accounts, addr) - } + var accounts []string + for i := 0; i < runenv.IntParam("validator"); i++ { + addr := <-accAddrCh + // runenv.RecordMessage("Received address: %s", addr) + accounts = append(accounts, addr) + } - moniker := fmt.Sprintf("validator-%d", initCtx.GlobalSeq) + moniker := fmt.Sprintf("validator-%d", initCtx.GlobalSeq) + // Here we assign the first instance to be the orchestrator role + // + // Orchestrator is only initing the chain and sending the genesis.json + // to others, so the genesis time is the same everywhere + if seq == 1 { _, err = cmd.InitChain(moniker) if err != nil { return nil, err } - - for _, v := range accounts { - _, err := cmd.AddGenAccount(v, "1000000000000000utia") - if err != nil { - return nil, err - } - } + runenv.RecordMessage("Chain initialised") gen, err := os.Open(fmt.Sprintf("%s/config/genesis.json", home)) if err != nil { @@ -106,6 +98,14 @@ func BuildValidator(ctx context.Context, runenv *runtime.RunEnv, initCtx *run.In runenv.RecordMessage("Validator has received the initial genesis") } + for _, v := range accounts { + _, err := cmd.AddGenAccount(v, "1000000000000000utia") + if err != nil { + return nil, err + } + } + + runenv.RecordMessage("Validator is signing its own GenTx") _, err = cmd.SignGenTx(keyringName, "5000000000utia", "test", home) if err != nil { return nil, err From 22fd7b87241ae0f21ac0a7ce608b249c09b3c7bd Mon Sep 17 00:00:00 2001 From: Nhu Viet Nguyen Date: Thu, 15 Sep 2022 14:26:04 +0200 Subject: [PATCH 7/8] fix: remove obsolete comment section --- tests/common/validator.go | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/common/validator.go b/tests/common/validator.go index de816226..40d8c83e 100644 --- a/tests/common/validator.go +++ b/tests/common/validator.go @@ -45,7 +45,6 @@ func BuildValidator(ctx context.Context, runenv *runtime.RunEnv, initCtx *run.In var accounts []string for i := 0; i < runenv.IntParam("validator"); i++ { addr := <-accAddrCh - // runenv.RecordMessage("Received address: %s", addr) accounts = append(accounts, addr) } From 84e5a1f805b930bf1054a07e98afb06dca987f58 Mon Sep 17 00:00:00 2001 From: Nguyen Nhu Viet Date: Thu, 15 Sep 2022 15:39:12 +0300 Subject: [PATCH 8/8] Update tests/README.md Co-authored-by: Hlib Kanunnikov --- tests/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/README.md b/tests/README.md index 90939ee5..2bd31c68 100644 --- a/tests/README.md +++ b/tests/README.md @@ -5,4 +5,4 @@ Each `*.go` follows the naming of the test-case in `docs/test-plan/test-plan-id/ In order to not clutter the test-file with different participants' steps, each dedicated directory is created to maintain steps of each types of participants. -The `common` directory is maintaining steps for a participant that plays the same role in every of the test-case(e.g. creating a validators set) \ No newline at end of file +The `common` directory maintains steps for a participant that plays the same role in every of the test-case(e.g. creating a validators set) \ No newline at end of file