logos-delivery/tests/api/test_node_conf.nim
Igor Sirotin ef651a7ccc
fix(networks): move logos.dev preset to cluster-id 3 (#4113)
* fix(networks): move logos.dev preset to cluster-id 3

The Logos Dev Network is now deployed on cluster 3. Update the
`logos.dev` preset accordingly, along with the CLI help text and the
library README preset table.

The deprecated "cluster-id implies preset" shim now triggers on
`--cluster-id=3` instead of `2`: cluster 2 is still the Logos Test
Network, so keeping the old mapping would silently move a node that
explicitly asked for cluster 2 onto cluster 3.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(conf): keep the legacy cluster-id preset shim on cluster 2

Remapping the deprecated `--cluster-id` -> preset shim onto cluster 3
hijacked every caller that uses 3 as a plain cluster id with no preset,
applying the whole logos.dev preset (p2p reliability, mix, discv5, dev
entry nodes) on top. tests/api/test_api_send.nim does exactly that, and
the extra reliability layer made Send emit `Sent` events the tests never
asked for.

Revert that hunk; only the preset's own cluster id moves to 3.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 12:05:25 +01:00

107 lines
2.5 KiB
Nim

{.used.}
import results, testutils/unittests
import
tools/confutils/cli_args,
logos_delivery/waku/factory/waku_conf,
logos_delivery/waku/factory/networks_config
suite "WakuNodeConf - preset integration":
test "TWN preset applies TheWakuNetworkConf":
## Given
var conf = defaultWakuNodeConf().valueOr:
raiseAssert error
conf.preset = "twn"
## When
let wakuConfRes = conf.toWakuConf()
## Then
require wakuConfRes.isOk()
let wakuConf = wakuConfRes.get()
require wakuConf.validate().isOk()
check:
wakuConf.clusterId == 1
test "LogosDev preset applies LogosDevConf":
## Given
var conf = defaultWakuNodeConf().valueOr:
raiseAssert error
conf.preset = "logosdev"
## When
let wakuConfRes = conf.toWakuConf()
## Then
require wakuConfRes.isOk()
let wakuConf = wakuConfRes.get()
require wakuConf.validate().isOk()
check:
wakuConf.clusterId == 3
test "LogosTest preset applies LogosTestConf":
## Given
var conf = defaultWakuNodeConf().valueOr:
raiseAssert error
conf.preset = "logostest"
## When
let wakuConfRes = conf.toWakuConf()
## Then
require wakuConfRes.isOk()
let wakuConf = wakuConfRes.get()
require wakuConf.validate().isOk()
check:
wakuConf.clusterId == 2
test "StatusProd preset applies StatusProdConf":
## Given
var conf = defaultWakuNodeConf().valueOr:
raiseAssert error
conf.preset = "status.prod"
## When
let wakuConfRes = conf.toWakuConf()
## Then
require wakuConfRes.isOk()
let wakuConf = wakuConfRes.get()
require wakuConf.validate().isOk()
check:
wakuConf.clusterId == 16
wakuConf.shardingConf.kind == AutoSharding
wakuConf.shardingConf.numShardsInCluster == 1
wakuConf.rlnRelayConf.isNone()
test "Invalid preset returns error":
## Given
var conf = defaultWakuNodeConf().valueOr:
raiseAssert error
conf.preset = "status.prod"
## When
let wakuConfRes = conf.toWakuConf()
## Then
require wakuConfRes.isOk()
let wakuConf = wakuConfRes.get()
require wakuConf.validate().isOk()
check:
wakuConf.clusterId == 16
wakuConf.shardingConf.kind == AutoSharding
wakuConf.shardingConf.numShardsInCluster == 1
wakuConf.rlnRelayConf.isNone()
test "Invalid preset returns error":
## Given
var conf = defaultWakuNodeConf().valueOr:
raiseAssert error
conf.preset = "nonexistent"
## When
let wakuConfRes = conf.toWakuConf()
## Then
check wakuConfRes.isErr()