fix: deprecate --dns-discovery (#3485)

* fix: deprecate `--dns-discovery`

Properly deprecates `--dns-discovery` CLI arg.
DNS Discovery is enabled if a non-empty DNS Discovery URL is passed.

* test: add test_all for factory

add and use test_all for some tests.
This commit is contained in:
fryorcraken 2025-07-03 11:56:43 +10:00 committed by GitHub
parent ac094eae38
commit 4b186a4b28
5 changed files with 17 additions and 29 deletions

View File

@ -92,20 +92,9 @@ import
import ./test_waku_keystore_keyfile, ./test_waku_keystore import ./test_waku_keystore_keyfile, ./test_waku_keystore
## Wakunode Rest API test suite ## Wakunode Rest API test suite
import import ./wakunode_rest/test_all
./wakunode_rest/test_rest_debug,
./wakunode_rest/test_rest_debug_serdes,
./wakunode_rest/test_rest_relay,
./wakunode_rest/test_rest_relay_serdes,
./wakunode_rest/test_rest_serdes,
./wakunode_rest/test_rest_filter,
./wakunode_rest/test_rest_lightpush,
./wakunode_rest/test_rest_lightpush_legacy,
./wakunode_rest/test_rest_admin,
./wakunode_rest/test_rest_cors,
./wakunode_rest/test_rest_health
import ./waku_rln_relay/test_all import ./waku_rln_relay/test_all
# Node Factory # Node Factory
import ./factory/[test_external_config, test_node_factory, test_waku_conf] import ./factory/test_all

View File

@ -0,0 +1 @@
import ./test_external_config, ./test_node_factory, ./test_waku_conf

View File

@ -1,14 +1,15 @@
{.used.} {.used.}
import import
./test_rest_debug_serdes, ./test_rest_admin,
./test_rest_cors,
./test_rest_debug, ./test_rest_debug,
./test_rest_debug_serdes,
./test_rest_filter, ./test_rest_filter,
./test_rest_lightpush_legacy,
./test_rest_health, ./test_rest_health,
./test_rest_lightpush,
./test_rest_lightpush_legacy,
./test_rest_relay_serdes, ./test_rest_relay_serdes,
./test_rest_relay, ./test_rest_relay,
./test_rest_serdes, ./test_rest_serdes,
./test_rest_store, ./test_rest_store
./test_rest_admin,
./test_rest_cors

View File

@ -1,4 +1,4 @@
import chronicles, std/[net, options, sequtils], results import chronicles, std/[net, options, strutils], results
import ../waku_conf import ../waku_conf
logScope: logScope:
@ -8,16 +8,12 @@ logScope:
## DNS Discovery Config Builder ## ## DNS Discovery Config Builder ##
################################## ##################################
type DnsDiscoveryConfBuilder* = object type DnsDiscoveryConfBuilder* = object
enabled*: Option[bool]
enrTreeUrl*: Option[string] enrTreeUrl*: Option[string]
nameServers*: seq[IpAddress] nameServers*: seq[IpAddress]
proc init*(T: type DnsDiscoveryConfBuilder): DnsDiscoveryConfBuilder = proc init*(T: type DnsDiscoveryConfBuilder): DnsDiscoveryConfBuilder =
DnsDiscoveryConfBuilder() DnsDiscoveryConfBuilder()
proc withEnabled*(b: var DnsDiscoveryConfBuilder, enabled: bool) =
b.enabled = some(enabled)
proc withEnrTreeUrl*(b: var DnsDiscoveryConfBuilder, enrTreeUrl: string) = proc withEnrTreeUrl*(b: var DnsDiscoveryConfBuilder, enrTreeUrl: string) =
b.enrTreeUrl = some(enrTreeUrl) b.enrTreeUrl = some(enrTreeUrl)
@ -25,13 +21,13 @@ proc withNameServers*(b: var DnsDiscoveryConfBuilder, nameServers: seq[IpAddress
b.nameServers = nameServers b.nameServers = nameServers
proc build*(b: DnsDiscoveryConfBuilder): Result[Option[DnsDiscoveryConf], string] = proc build*(b: DnsDiscoveryConfBuilder): Result[Option[DnsDiscoveryConf], string] =
if not b.enabled.get(false): if b.enrTreeUrl.isNone():
return ok(none(DnsDiscoveryConf)) return ok(none(DnsDiscoveryConf))
if isEmptyOrWhiteSpace(b.enrTreeUrl.get()):
return err("dnsDiscovery.enrTreeUrl cannot be an empty string")
if b.nameServers.len == 0: if b.nameServers.len == 0:
return err("dnsDiscovery.nameServers is not specified") return err("dnsDiscovery.nameServers is not specified")
if b.enrTreeUrl.isNone():
return err("dnsDiscovery.enrTreeUrl is not specified")
return ok( return ok(
some(DnsDiscoveryConf(nameServers: b.nameServers, enrTreeUrl: b.enrTreeUrl.get())) some(DnsDiscoveryConf(nameServers: b.nameServers, enrTreeUrl: b.enrTreeUrl.get()))

View File

@ -550,7 +550,8 @@ with the drawback of consuming some more bandwidth.""",
.}: bool .}: bool
dnsDiscoveryUrl* {. dnsDiscoveryUrl* {.
desc: "URL for DNS node list in format 'enrtree://<key>@<fqdn>'", desc:
"URL for DNS node list in format 'enrtree://<key>@<fqdn>', enables DNS Discovery",
defaultValue: "", defaultValue: "",
name: "dns-discovery-url" name: "dns-discovery-url"
.}: string .}: string
@ -996,8 +997,8 @@ proc toWakuConf*(n: WakuNodeConf): ConfResult[WakuConf] =
b.metricsServerConf.withHttpPort(n.metricsServerPort) b.metricsServerConf.withHttpPort(n.metricsServerPort)
b.metricsServerConf.withLogging(n.metricsLogging) b.metricsServerConf.withLogging(n.metricsLogging)
b.dnsDiscoveryConf.withEnabled(n.dnsDiscovery) if n.dnsDiscoveryUrl != "":
b.dnsDiscoveryConf.withEnrTreeUrl(n.dnsDiscoveryUrl) b.dnsDiscoveryConf.withEnrTreeUrl(n.dnsDiscoveryUrl)
b.dnsDiscoveryConf.withNameServers(n.dnsAddrsNameServers) b.dnsDiscoveryConf.withNameServers(n.dnsAddrsNameServers)
if n.discv5Discovery.isSome(): if n.discv5Discovery.isSome():