diff --git a/testground/README.md b/testground/README.md index c52b153efe..40018edbb1 100644 --- a/testground/README.md +++ b/testground/README.md @@ -1,13 +1,20 @@ -# Guide - [Testground documentation](https://docs.testground.ai/) -## Getting started +## Build Image + +> Prerequisites: nix, for macOS also need [linux remote builder](https://nix.dev/manual/nix/2.22/advanced-topics/distributed-builds.html) + +You can test with the prebuilt images in [github registry](https://github.com/crypto-org-chain/cronos/pkgs/container/cronos-testground), or build the image locally: -### Prerequisites +```bash +$ nix build .#testground-image +# for mac: nix build .#legacyPackages.aarch64-linux.testground-image +$ docker load < ./result +Loaded image: cronos-testground: +$ docker tag cronos-testground: ghcr.io/crypto-org-chain/cronos-testground:latest +``` -- docker -- go 1.22, or higher +## Run Test ### Install Testground @@ -20,7 +27,7 @@ $ make install It'll install the `testground` binary in your `$GOPATH/bin` directory, and build several docker images. -### Running Testground +### Run Testground Daemon ```bash $ TESTGROUND_HOME=$PWD/data testground daemon @@ -28,7 +35,7 @@ $ TESTGROUND_HOME=$PWD/data testground daemon Keep the daemon process running during the test. -### Running Test Plan +### Run Test Plan Import the test plan before the first run: diff --git a/testground/benchmark/benchmark/cli.py b/testground/benchmark/benchmark/cli.py index a86912c0b1..6ceed40128 100644 --- a/testground/benchmark/benchmark/cli.py +++ b/testground/benchmark/benchmark/cli.py @@ -9,21 +9,28 @@ def __init__(self, cmd): def raw(self, *args, stdin=None, stderr=subprocess.STDOUT, **kwargs): "execute the command" args = " ".join(build_cli_args_safe(*args, **kwargs)) - return interact( + stdout = interact( f"{self.cmd} {args}", input=stdin, stderr=stderr, env=os.environ ) + # filter out ":" warning messages + stdout = b"\n".join( + line for line in stdout.splitlines() if not line.startswith(b":") + ) + + return stdout + def __call__(self, *args, **kwargs): "execute the command and clean the output" return self.raw(*args, **kwargs).decode().strip() -def interact(cmd, ignore_error=False, input=None, **kwargs): - kwargs.setdefault("stderr", subprocess.STDOUT) +def interact(cmd, ignore_error=False, input=None, stderr=subprocess.STDOUT, **kwargs): proc = subprocess.Popen( cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=stderr, shell=True, **kwargs, ) diff --git a/testground/benchmark/compositions/local.toml b/testground/benchmark/compositions/local.toml index ba24473eb3..4d710e2955 100644 --- a/testground/benchmark/compositions/local.toml +++ b/testground/benchmark/compositions/local.toml @@ -6,7 +6,7 @@ author = "core-app" plan = "benchmark" case = "entrypoint" total_instances = 10 -builder = "docker:nix" +builder = "docker:go" # not used runner = "local:docker" disable_metrics = false @@ -16,12 +16,14 @@ halt_height = "5" [[groups]] id = "validators" -builder = "docker:nix" [groups.instances] count = 3 +[groups.run] +artifact = "ghcr.io/crypto-org-chain/cronos-testground:latest" [[groups]] id = "fullnodes" -builder = "docker:nix" [groups.instances] count = 7 +[groups.run] +artifact = "ghcr.io/crypto-org-chain/cronos-testground:latest" diff --git a/testground/benchmark/manifest.toml b/testground/benchmark/manifest.toml index 9184c54e7c..b9d3afbb0c 100644 --- a/testground/benchmark/manifest.toml +++ b/testground/benchmark/manifest.toml @@ -1,12 +1,9 @@ name = "benchmark" [defaults] -builder = "docker:nix" +builder = "docker:go" runner = "local:docker" -[builders."docker:nix"] -enabled = true - [runners."local:docker"] enabled = true