Skip to content

Commit 3a119c3

Browse files
committed
feat(core): refactor image comparison logic for S3 and GCS containers
- Replaced inline string comparisons with `isImageNamed` extension function for cleaner and reusable code. - Updated image comparison logic in `BigDataContainerFactory` for LocalStack S3 and Fake GCS.
1 parent 274d03b commit 3a119c3

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

core/src/main/kotlin/org/openprojectx/bigdata/test/core/container/BigDataContainerFactory.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ internal class BigDataContainerFactory(
710710

711711
private fun localStackS3(): BigDataServiceContainer {
712712
val objectStore = options.localStackS3
713-
val isFloci = objectStore.image.substringBefore(":") == "floci/floci"
713+
val isFloci = objectStore.image.isImageNamed("floci/floci")
714714
val container = GenericBigDataContainer(objectStore.image)
715715
.withNetwork(network)
716716
.withNetworkAliases("localstack")
@@ -793,11 +793,15 @@ internal class BigDataContainerFactory(
793793
}
794794

795795
private fun isFlociGcp(): Boolean =
796-
options.fakeGcs.image.substringBefore(":") == "floci/floci-gcp"
796+
options.fakeGcs.image.isImageNamed("floci/floci-gcp")
797797

798798
private fun fakeGcsServicePort(): Int =
799799
if (isFlociGcp()) 4588 else 4443
800800

801+
private fun String.isImageNamed(repository: String): Boolean {
802+
val image = substringBefore("@").substringBefore(":")
803+
return image == repository || image.endsWith("/$repository")
804+
}
801805

802806
private fun hiveMetastoreObjectStoreConfiguration(): Map<String, String> =
803807
buildMap {

0 commit comments

Comments
 (0)