Skip to content

Commit

Permalink
don't query prod poets in node tests and add timeout (#6698)
Browse files Browse the repository at this point in the history
## Motivation

Unit tests in node_test.go query prod poets in `NewPoetServiceWithClient()` and might timeout if poet is not responding.
  • Loading branch information
poszu committed Feb 6, 2025
1 parent 5803599 commit 106070f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion activation/poet.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,10 @@ func NewPoetServiceWithClient(
opt(service)
}

err := service.verifyPhaseShiftConfiguration(context.Background())
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
defer cancel()

err := service.verifyPhaseShiftConfiguration(ctx)
switch {
case errors.Is(err, errIncompatiblePhaseShift):
logger.Fatal("failed to create poet service", zap.String("poet", client.Address()))
Expand Down
2 changes: 2 additions & 0 deletions node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,8 @@ func getTestDefaultConfig(tb testing.TB) *config.Config {
cfg.POST.LabelsPerUnit = 32
cfg.POST.K2 = 4

cfg.BaseConfig.PoetServers = nil

cfg.SMESHING = config.DefaultSmeshingConfig()
cfg.SMESHING.Start = false
cfg.SMESHING.CoinbaseAccount = types.GenerateAddress([]byte{1}).String()
Expand Down

0 comments on commit 106070f

Please sign in to comment.