Skip to content

Commit

Permalink
Add oci image definition, use it in integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtSilvio committed Nov 18, 2024
1 parent f18253e commit f61516a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
25 changes: 24 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,29 @@ oci {
optionalCredentials()
}
}
imageMapping {
mapModule("com.hivemq", "hivemq-enterprise") {
toImage("hivemq/hivemq4")
}
}
imageDefinitions.register("main") {
allPlatforms {
dependencies {
runtime("com.hivemq:hivemq-enterprise:4.28.2")
}
layers {
layer("hivemqExtension") {
contents {
permissions("opt/hivemq/", 0b111_111_000)
permissions("opt/hivemq/extensions/", 0b111_111_000)
into("opt/hivemq/extensions") {
from(zipTree(tasks.hivemqExtensionZip.flatMap { it.archiveFile }))
}
}
}
}
}
}
}

@Suppress("UnstableApiUsage")
Expand Down Expand Up @@ -68,7 +91,7 @@ testing {
}
oci.of(this) {
imageDependencies {
runtime("hivemq:hivemq4:4.28.2").tag("latest")
runtime(project).tag("latest")
runtime("localstack:localstack:3.5.0").tag("latest")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ internal class EndToEndIT {
}
localStack.start()

val hivemq = HiveMQContainer(OciImages.getImageName("hivemq/hivemq4")).apply {
withExtension(MountableFile.forClasspathResource("hivemq-aws-cloudwatch-extension"))
withFileInExtensionHomeFolder(
val hivemq = HiveMQContainer(
OciImages.getImageName("hivemq/extensions/hivemq-aws-cloudwatch-extension")
.asCompatibleSubstituteFor("hivemq/hivemq4")
).apply {
withCopyToContainer(
MountableFile.forClasspathResource("extension-config.xml"),
"hivemq-aws-cloudwatch-extension",
"extension-config.xml"
"/opt/hivemq/extensions/hivemq-aws-cloudwatch-extension/extension-config.xml",
)
withEnv("AWS_REGION", localStack.region)
withEnv("AWS_ACCESS_KEY_ID", localStack.accessKey)
Expand Down

0 comments on commit f61516a

Please sign in to comment.