cashapp / tempest

Typesafe DynamoDB for Kotlin and Java.
https://cashapp.github.io/tempest/
Apache License 2.0
83 stars 33 forks source link

Try to close reused sockets in TestDynamoDbService #185

Closed mmollaverdi closed 4 months ago

mmollaverdi commented 4 months ago

Follow-up from https://github.com/cashapp/tempest/pull/184 and https://github.com/cashapp/tempest/pull/182

The previous implementation fails with a port already bound error, if a first test creates a test dynamodb server, but doesn't start and then a second test tries to start the server, because the socket allocated in the first test and reused in the second test doesn't get closed (due to first test not calling startUp).

This PR makes it so that we close the socket if it's not closed even when it's reused across tests.