Skip to content

Commit

Permalink
chore: add more debug info regarding DDB Local ports (#1482)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianbotsf authored Dec 20, 2024
1 parent a6651e4 commit c40ca4f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 12 additions & 2 deletions hll/dynamodb-mapper/dynamodb-mapper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,21 @@ open class DynamoDbLocalInstance : DefaultTask() {
.createServerFromCommandLineArgs(arrayOf("-inMemory", "-port", port.toString(), "-disableTelemetry"))
.also { it.start() }

portFile.asFile.get().writeText(port.toString())
portFile
.asFile
.get()
.also { println("Writing port info file to ${it.absolutePath}") }
.writeText(port.toString())
}

fun stop() {
runCatching { portFile.asFile.get().delete() }.onFailure { t -> println("Failed to delete $portFile: $t") }
runCatching {
portFile
.asFile
.get()
.also { println("Deleting port info file at ${it.absolutePath}") }
.delete()
}.onFailure { t -> println("Failed to delete $portFile: $t") }

runner?.let {
println("Stopping DynamoDB local instance on port $port")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ abstract class DdbLocalTest : AnnotationSpec() {

private val ddbHolder = lazy {
val portFile = File("build/ddblocal/port.info").absoluteFile // Keep in sync with build.gradle.kts
println("Reading DDB Local port info from ${portFile.absolutePath}")
val port = portFile.readText().toInt()
println("Connecting to DDB Local on port $port")

DynamoDbClient {
endpointUrl = Url {
Expand Down

0 comments on commit c40ca4f

Please sign in to comment.