I have a test where I am performing a docker stop operation and checking something and starting the docker container. I am using dockerode library. When I run that I test I keep getting the following error - Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. I am using async/await. Here's the sample of the code
describe('docker container test', () => {
let docker
before(() => {
docker = new Docker()
})
after( () => {
docker = null
})
it('simple docker test', async () => {
try {
container = await getDockerContainerByName(docker, containerName)
await stopDocker(docker, container)
await startDocker(docker, container)
await waitForContainerToBeHealthy(docker, container)
console.log("container healthy")
} catch(error) {
console.log("Error occurred "+ JSON.stringify(error))
}
}).timeout(120000)
})
async waitForContainerToBeHealthy (docker, container) {
await invokeUntil(async (retry, complete) => {
return dockerTestHelper.inspectDockerContainer(docker, container).then( (data) => {
if(// check if container is healthy) {
complete()
} else {
retry()
}
})
})
}
I can see on the console that the container is healthy. But, the test doesn't end. It hangs and after some time I see the error posted above. Can someone let me know what am I doing wrong