From 0e29500c1feb3b5e852e4e06c194ebfcd06ba373 Mon Sep 17 00:00:00 2001 From: Theodore Schnepper Date: Wed, 1 Oct 2025 12:07:13 -0600 Subject: [PATCH] Fix `TestSmoke` failing on CI/CD The sigp/lighthouse docker image was upgraded from version `v7.1.0` to `v8.0.0-rc.0` on `2025-09-29`. Since the image isn't anchored to a version, this update gets pulled in, and it seems to have breaking changes with our previous setup. This change sets the version of the docker image used specifically to `v7.1.0` so that the previous behavior we're used to is seen. Additionally, when `TestSmoke` is running, it initially **MUST** download the images for the docker containers that wer not built in the `Build Devnet` job. This delays the launch and running of the DevNet by quite a bit. Fix this delay by adding a `docker compose pull` setp to `Build Devnet` --- .github/workflows/espresso-devnet-tests.yaml | 7 +++--- espresso/devnet-tests/devnet_tools.go | 24 ++++++++++++++++++++ espresso/devnet-tests/smoke_test.go | 3 ++- espresso/docker-compose.yml | 4 ++-- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/.github/workflows/espresso-devnet-tests.yaml b/.github/workflows/espresso-devnet-tests.yaml index 8a3092202a1..bcfc5088cee 100644 --- a/.github/workflows/espresso-devnet-tests.yaml +++ b/.github/workflows/espresso-devnet-tests.yaml @@ -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 @@ -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/... diff --git a/espresso/devnet-tests/devnet_tools.go b/espresso/devnet-tests/devnet_tools.go index 2368636368f..1e5a991f90e 100644 --- a/espresso/devnet-tests/devnet_tools.go +++ b/espresso/devnet-tests/devnet_tools.go @@ -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", diff --git a/espresso/devnet-tests/smoke_test.go b/espresso/devnet-tests/smoke_test.go index 225fd10fac4..1e562d18f35 100644 --- a/espresso/devnet-tests/smoke_test.go +++ b/espresso/devnet-tests/smoke_test.go @@ -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) diff --git a/espresso/docker-compose.yml b/espresso/docker-compose.yml index d176c398886..053daf3960c 100644 --- a/espresso/docker-compose.yml +++ b/espresso/docker-compose.yml @@ -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 @@ -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