Skip to content
Merged
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
7 changes: 4 additions & 3 deletions .github/workflows/espresso-devnet-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
test:
runs-on: ubuntu-24.04-8core
env:
ESPRESSO_DEVNET_TESTS_LIVENESS_PERIOD: '1m'
ESPRESSO_DEVNET_TESTS_OUTAGE_PERIOD: '1m'
ESPRESSO_DEVNET_TESTS_LIVENESS_PERIOD: "1m"
ESPRESSO_DEVNET_TESTS_OUTAGE_PERIOD: "1m"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
submodules: "recursive"

- name: Install Nix
uses: nixbuild/nix-quick-install-action@v30
Expand Down Expand Up @@ -49,6 +49,7 @@ jobs:
cd ../espresso
./scripts/prepare-allocs.sh
docker compose build
docker compose pull l1-validator espresso-dev-node l1-data-init

- name: Run Smoke test
run: go test -timeout 30m -p 1 -count 1 -run 'TestSmoke' -v ./espresso/devnet-tests/...
Expand Down
24 changes: 24 additions & 0 deletions espresso/devnet-tests/devnet_tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,31 @@ func NewDevnet(ctx context.Context, t *testing.T) *Devnet {
return d
}

func (d *Devnet) isRunning() bool {
cmd := exec.CommandContext(
d.ctx,
"docker", "compose", "ps", "-q",
)
buf := new(bytes.Buffer)
cmd.Stdout = buf
if err := cmd.Run(); err != nil {
log.Error("failed to check if devnet is running", "error", err)
return false
}
out := strings.TrimSpace(buf.String())
return len(out) > 0
}

func (d *Devnet) Up() (err error) {
if d.isRunning() {
if err := d.Down(); err != nil {
return err
}
// Let's shutdown the devnet before returning an error, just to clean
// up any existing state.
return fmt.Errorf("devnet is already running, this should be a clean state; please shut it down first")
}

cmd := exec.CommandContext(
d.ctx,
"docker", "compose", "up", "-d",
Expand Down
3 changes: 2 additions & 1 deletion espresso/devnet-tests/smoke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package devnet_tests
import (
"context"
"testing"
"time"

"github.com/stretchr/testify/require"
)

func TestSmoke(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Minute)
defer cancel()

d := NewDevnet(ctx, t)
Expand Down
4 changes: 2 additions & 2 deletions espresso/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
- l1-data:/data

l1-validator:
image: sigp/lighthouse
image: sigp/lighthouse:v7.1.0
depends_on:
l1-genesis:
condition: service_completed_successfully
Expand All @@ -56,7 +56,7 @@ services:
- ${OPERATOR_ADDRESS}

l1-beacon:
image: sigp/lighthouse
image: sigp/lighthouse:v7.1.0
depends_on:
l1-genesis:
condition: service_completed_successfully
Expand Down
Loading