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

Problem: use prebuilt image in testground #1480

Merged
merged 6 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
23 changes: 15 additions & 8 deletions testground/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# Guide

[Testground documentation](https://docs.testground.ai/)

## Getting started
## Build Image

> Prerequisites: nix, linux remote builder for macOS

yihuang marked this conversation as resolved.
Show resolved Hide resolved
yihuang marked this conversation as resolved.
Show resolved Hide resolved
You can test with the prebuilt images in github registry, to build the images locally for yourself:

yihuang marked this conversation as resolved.
Show resolved Hide resolved
### Prerequisites
```bash
$ nix build .#testground-image
# for mac: nix build .#legacyPackages.aarch64-linux.testground-image
$ docker load < ./result
yihuang marked this conversation as resolved.
Show resolved Hide resolved
Loaded image: cronos-testground:<imageID>
$ docker tag cronos-testground:<imageID> ghcr.io/crypto-org-chain/cronos-testground:latest
```

- docker
- go 1.22, or higher
## Run Test

### Install Testground

Expand All @@ -20,15 +27,15 @@ $ 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
```

Keep the daemon process running during the test.

yihuang marked this conversation as resolved.
Show resolved Hide resolved
### Running Test Plan
### Run Test Plan

yihuang marked this conversation as resolved.
Show resolved Hide resolved
Import the test plan before the first run:

Expand Down
9 changes: 8 additions & 1 deletion testground/benchmark/benchmark/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,17 @@ 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 "<jemalloc>:" warning messages
stdout = b"\n".join(
line for line in stdout.splitlines() if not line.startswith(b"<jemalloc>:")
)

return stdout

def __call__(self, *args, **kwargs):
"execute the command and clean the output"
return self.raw(*args, **kwargs).decode().strip()
Expand Down
8 changes: 5 additions & 3 deletions testground/benchmark/compositions/local.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"
yihuang marked this conversation as resolved.
Show resolved Hide resolved

[[groups]]
id = "fullnodes"
builder = "docker:nix"
[groups.instances]
count = 7
[groups.run]
artifact = "ghcr.io/crypto-org-chain/cronos-testground:latest"
5 changes: 1 addition & 4 deletions testground/benchmark/manifest.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name = "benchmark"

[defaults]
builder = "docker:nix"
builder = "local:docker"
yihuang marked this conversation as resolved.
Show resolved Hide resolved
runner = "local:docker"

[builders."docker:nix"]
enabled = true

[runners."local:docker"]
enabled = true

Expand Down
Loading