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.
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.