From a7240c43a4eb928a810d6e5aceaa29d5ab237c17 Mon Sep 17 00:00:00 2001 From: Vladimir Logachev Date: Fri, 15 Nov 2024 13:32:04 +0400 Subject: [PATCH] Fix tests after renaming fields --- .../test/scala/com/wavesplatform/it/Docker.scala | 5 +++-- .../test/scala/com/wavesplatform/it/Node.scala | 2 +- .../settings/NetworkSettingsSpecification.scala | 15 +++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/node-it/src/test/scala/com/wavesplatform/it/Docker.scala b/node-it/src/test/scala/com/wavesplatform/it/Docker.scala index 8f8ab85a5c..43f8c19521 100644 --- a/node-it/src/test/scala/com/wavesplatform/it/Docker.scala +++ b/node-it/src/test/scala/com/wavesplatform/it/Docker.scala @@ -306,7 +306,7 @@ class Docker( private def getNodeInfo(containerId: String, settings: WavesSettings): NodeInfo = { val restApiPort = settings.restAPISettings.port // assume test nodes always have an open port - val networkPort = settings.networkSettings.bindAddress.get.getPort + val networkPort = settings.networkSettings.derivedBindAddress.get.getPort val containerInfo = inspectContainer(containerId) val wavesIpAddress = containerInfo.networkSettings().networks().get(wavesNetwork.name()).ipAddress() @@ -601,7 +601,8 @@ object Docker { } AddressScheme.current = new AddressScheme { - override val chainId: Byte = ConfigSource.fromConfig(configTemplate).at("waves.blockchain.custom.address-scheme-character").loadOrThrow[String].charAt(0).toByte + override val chainId: Byte = + ConfigSource.fromConfig(configTemplate).at("waves.blockchain.custom.address-scheme-character").loadOrThrow[String].charAt(0).toByte } def apply(owner: Class[?]): Docker = new Docker(tag = owner.getSimpleName) diff --git a/node-it/src/test/scala/com/wavesplatform/it/Node.scala b/node-it/src/test/scala/com/wavesplatform/it/Node.scala index 903f56213e..27488b168e 100644 --- a/node-it/src/test/scala/com/wavesplatform/it/Node.scala +++ b/node-it/src/test/scala/com/wavesplatform/it/Node.scala @@ -55,7 +55,7 @@ abstract class Node(val config: Config) extends AutoCloseable { object Node { implicit class NodeExt(val n: Node) extends AnyVal { - def name: String = n.settings.networkSettings.nodeName + def name: String = n.settings.networkSettings.derivedNodeName def publicKeyStr: String = n.publicKey.toString def fee(txTypeId: Byte): Long = FeeValidation.FeeConstants(TransactionType(txTypeId)) * FeeValidation.FeeUnit def blockDelay: FiniteDuration = n.settings.blockchainSettings.genesisSettings.averageBlockDelay diff --git a/node/tests/src/test/scala/com/wavesplatform/settings/NetworkSettingsSpecification.scala b/node/tests/src/test/scala/com/wavesplatform/settings/NetworkSettingsSpecification.scala index 220f288265..0df0a8293d 100644 --- a/node/tests/src/test/scala/com/wavesplatform/settings/NetworkSettingsSpecification.scala +++ b/node/tests/src/test/scala/com/wavesplatform/settings/NetworkSettingsSpecification.scala @@ -5,7 +5,6 @@ import com.typesafe.config.ConfigFactory import com.wavesplatform.test.FlatSpec import pureconfig.ConfigSource import pureconfig.generic.auto.* -import pureconfig.error.ConfigReaderException import scala.concurrent.duration.* class NetworkSettingsSpecification extends FlatSpec { @@ -67,32 +66,32 @@ class NetworkSettingsSpecification extends FlatSpec { val config = loadConfig(ConfigFactory.empty()) val networkSettings = ConfigSource.fromConfig(config).at("waves.network").loadOrThrow[NetworkSettings] - networkSettings.nonce should not be 0 + networkSettings.derivedNonce should not be 0 } it should "build node name using nonce" in { val config = loadConfig(ConfigFactory.parseString("waves.network.nonce = 12345")) val networkSettings = ConfigSource.fromConfig(config).at("waves.network").loadOrThrow[NetworkSettings] - networkSettings.nonce should be(12345) - networkSettings.nodeName should be("Node-12345") + networkSettings.derivedNonce should be(12345) + networkSettings.derivedNodeName should be("Node-12345") } it should "build node name using random nonce" in { val config = loadConfig(ConfigFactory.empty()) val networkSettings = ConfigSource.fromConfig(config).at("waves.network").loadOrThrow[NetworkSettings] - networkSettings.nonce should not be 0 - networkSettings.nodeName should be(s"Node-${networkSettings.nonce}") + networkSettings.derivedNonce should not be 0 + networkSettings.derivedNodeName should be(s"Node-${networkSettings.derivedNonce}") } - it should "fail with ConfigReaderException on too long node name" in { + it should "fail with IllegalArgumentException on too long node name" in { val config = loadConfig( ConfigFactory.parseString( "waves.network.node-name = очень-длинное-название-в-многобайтной-кодировке-отличной-от-однобайтной-кодировки-американского-института-стандартов" ) ) - intercept[ConfigReaderException[NetworkSettings]] { + intercept[IllegalArgumentException] { ConfigSource.fromConfig(config).at("waves.network").loadOrThrow[NetworkSettings] } }