Skip to content

Commit 0d9c1e5

Browse files
committed
docs: update CHANGELOG with enhancements to health and readiness checks, including E2E test updates
1 parent b09df84 commit 0d9c1e5

4 files changed

Lines changed: 20 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424
- Use cache instead of in memory store for reaper. Persist cache on reload. Autoclean after 24 hours. ([#2811](https://github.com/evstack/ev-node/pull/2811))
2525
- Simplified `/health/live` endpoint to only check store accessibility (liveness) instead of business logic, following Kubernetes best practices ([#2800](https://github.com/evstack/ev-node/pull/2800))
2626
- Updated `/health/ready` endpoint to use `GetState()` instead of `Height()` to access block production timing information ([#2800](https://github.com/evstack/ev-node/pull/2800))
27+
- Updated E2E test helper `AwaitNodeUp()` to check both liveness and readiness endpoints, ensuring nodes are not just alive but ready to serve traffic ([#2800](https://github.com/evstack/ev-node/pull/2800))
2728
- Renamed integration test from `TestHealthEndpointWhenBlockProductionStops` to `TestReadinessEndpointWhenBlockProductionStops` to correctly test readiness endpoint ([#2800](https://github.com/evstack/ev-node/pull/2800))
2829
- Updated Rust client example (`client/crates/client/examples/basic.rs`) to demonstrate both liveness and readiness checks ([#2800](https://github.com/evstack/ev-node/pull/2800))
2930

node/single_sequencer_integration_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
coreda "github.com/evstack/ev-node/core/da"
1717
coreexecutor "github.com/evstack/ev-node/core/execution"
1818
evconfig "github.com/evstack/ev-node/pkg/config"
19+
"github.com/evstack/ev-node/pkg/rpc/client"
1920
)
2021

2122
// FullNodeTestSuite is a test suite for full node integration tests
@@ -451,7 +452,7 @@ func TestReadinessEndpointWhenBlockProductionStops(t *testing.T) {
451452
// Verify readiness is READY while blocks are being produced
452453
readiness, err := rpcClient.GetReadiness(ctx)
453454
require.NoError(err)
454-
require.Equal("READY", readiness.String(), "Readiness should be READY while producing blocks")
455+
require.Equal(client.ReadinessStatus_READY, readiness, "Readiness should be READY while producing blocks")
455456

456457
// Wait for block production to stop (when MaxPendingHeadersAndData is reached)
457458
time.Sleep(time.Duration(config.Node.MaxPendingHeadersAndData+2) * config.Node.BlockTime.Duration)
@@ -473,7 +474,7 @@ func TestReadinessEndpointWhenBlockProductionStops(t *testing.T) {
473474
if err != nil {
474475
return false
475476
}
476-
return readiness.String() == "UNREADY"
477+
return readiness == client.ReadinessStatus_UNREADY
477478
}, 10*time.Second, 100*time.Millisecond, "Readiness should be UNREADY after aggregator stops producing blocks (5x block time)")
478479

479480
// Stop the node and wait for shutdown

pkg/rpc/client/client_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ func TestClientGetHealth(t *testing.T) {
284284
healthStatus, err := client.GetHealth(context.Background())
285285

286286
require.NoError(t, err)
287-
require.Equal(t, "PASS", healthStatus.String())
287+
require.Equal(t, HealthStatus_PASS, healthStatus)
288288
mockStore.AssertExpectations(t)
289289
})
290290

@@ -301,7 +301,7 @@ func TestClientGetHealth(t *testing.T) {
301301
healthStatus, err := client.GetHealth(context.Background())
302302

303303
require.NoError(t, err)
304-
require.Equal(t, "FAIL", healthStatus.String())
304+
require.Equal(t, HealthStatus_FAIL, healthStatus)
305305
mockStore.AssertExpectations(t)
306306
})
307307

@@ -318,7 +318,7 @@ func TestClientGetHealth(t *testing.T) {
318318
healthStatus, err := client.GetHealth(context.Background())
319319

320320
require.NoError(t, err)
321-
require.Equal(t, "PASS", healthStatus.String())
321+
require.Equal(t, HealthStatus_PASS, healthStatus)
322322
mockStore.AssertExpectations(t)
323323
})
324324
}
@@ -352,7 +352,7 @@ func TestClientGetReadiness(t *testing.T) {
352352
readiness, err := client.GetReadiness(context.Background())
353353

354354
require.NoError(t, err)
355-
require.Equal(t, "READY", readiness.String())
355+
require.Equal(t, ReadinessStatus_READY, readiness)
356356
mockStore.AssertExpectations(t)
357357
mockP2P.AssertExpectations(t)
358358
})
@@ -373,7 +373,7 @@ func TestClientGetReadiness(t *testing.T) {
373373
readiness, err := client.GetReadiness(context.Background())
374374

375375
require.NoError(t, err)
376-
require.Equal(t, "UNREADY", readiness.String())
376+
require.Equal(t, ReadinessStatus_UNREADY, readiness)
377377
mockP2P.AssertExpectations(t)
378378
})
379379

@@ -397,7 +397,7 @@ func TestClientGetReadiness(t *testing.T) {
397397
readiness, err := client.GetReadiness(context.Background())
398398

399399
require.NoError(t, err)
400-
require.Equal(t, "UNREADY", readiness.String())
400+
require.Equal(t, ReadinessStatus_UNREADY, readiness)
401401
mockP2P.AssertExpectations(t)
402402
})
403403
}

test/e2e/sut_helper.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ func (s *SystemUnderTest) ExecCmd(cmd string, args ...string) {
9393
s.awaitProcessCleanup(c)
9494
}
9595

96-
// AwaitNodeUp waits until a node is operational by validating it produces blocks.
96+
// AwaitNodeUp waits until a node is operational by checking both liveness and readiness.
97+
// This verifies the process is alive (liveness) and ready to serve traffic (readiness).
9798
func (s *SystemUnderTest) AwaitNodeUp(t *testing.T, rpcAddr string, timeout time.Duration) {
9899
t.Helper()
99100
t.Logf("Await node is up: %s", rpcAddr)
@@ -102,8 +103,15 @@ func (s *SystemUnderTest) AwaitNodeUp(t *testing.T, rpcAddr string, timeout time
102103
require.EventuallyWithT(t, func(t *assert.CollectT) {
103104
c := client.NewClient(rpcAddr)
104105
require.NotNil(t, c)
106+
107+
// Check liveness: is the process alive?
105108
_, err := c.GetHealth(ctx)
106-
require.NoError(t, err)
109+
require.NoError(t, err, "liveness check failed")
110+
111+
// Check readiness: is the node ready to serve traffic?
112+
readiness, err := c.GetReadiness(ctx)
113+
require.NoError(t, err, "readiness check failed")
114+
require.Equal(t, client.ReadinessStatus_READY, readiness, "node is not ready")
107115
}, timeout, min(timeout/10, 200*time.Millisecond), "node is not up")
108116
}
109117

0 commit comments

Comments
 (0)