From 9b5897bfe6719bc19cc4d894d038d64bce3463d1 Mon Sep 17 00:00:00 2001 From: alexstroke1 Date: Thu, 7 Nov 2024 17:30:05 +0100 Subject: [PATCH] Update IrohaContainer.kt refactor IrohaContainer Signed-off-by: alexstroke1 --- .../iroha2/testengine/IrohaContainer.kt | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/modules/test-tools/src/main/kotlin/jp/co/soramitsu/iroha2/testengine/IrohaContainer.kt b/modules/test-tools/src/main/kotlin/jp/co/soramitsu/iroha2/testengine/IrohaContainer.kt index 9f8daed28..b84ddba8e 100644 --- a/modules/test-tools/src/main/kotlin/jp/co/soramitsu/iroha2/testengine/IrohaContainer.kt +++ b/modules/test-tools/src/main/kotlin/jp/co/soramitsu/iroha2/testengine/IrohaContainer.kt @@ -152,10 +152,23 @@ open class IrohaContainer : GenericContainer { private fun String.readStatusBlocks() = JSON_SERDE.readTree(this).get("blocks")?.doubleValue() companion object { - private fun IrohaConfig.getFullImageName() = when (this.imageTag.contains("sha256")) { - true -> "${this.imageName}@${this.imageTag}" - false -> "${this.imageName}@${this.imageTagDef}" - }.let { DockerImageName.parse(it) } + private fun IrohaConfig.getFullImageName(): DockerImageName { + val imageTag = System.getenv("IROHA_IMAGE_TAG") ?: DEFAULT_IMAGE_TAG + return when (imageTag.contains("sha256")) { + true -> "${this.imageName}@$imageTag" + false -> "${this.imageName}:$imageTag" + }.let { DockerImageName.parse(it) } + } + + const val NETWORK_ALIAS = "iroha" + const val DEFAULT_IMAGE_TAG = "2.0.0-pre-rc.22.2" + const val DEFAULT_IMAGE_NAME = "hyperledger/iroha" + const val DEFAULT_EXECUTOR_FILE_NAME = "executor.wasm" + const val DEFAULT_GENESIS_FILE_NAME = "genesis.json" + const val DEFAULT_CONFIG_DIR = "config" + val CONTAINER_STARTUP_TIMEOUT: Duration = Duration.ofSeconds(60) +} + const val CUSTOM_IMAGE_TAG = "iroha-dev" const val NETWORK_ALIAS = "iroha"