Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Plugin starts tests even if not all containers are ready. #100

Open
rossoha opened this issue Nov 1, 2017 · 4 comments
Open

Plugin starts tests even if not all containers are ready. #100

rossoha opened this issue Nov 1, 2017 · 4 comments

Comments

@rossoha
Copy link

rossoha commented Nov 1, 2017

In current state plugin checks that container is up by trying to get container ID from docker.
My proposal is that plugin should run tests only after all containers has status healthy or none.
Fast workaround can be added to DockerCommands

def getDockerContainerId(instanceName: String, serviceName: String): String = {
  //Docker replaces '/' with '_' in the identifier string so search for replaced version
  Process(s"""docker ps --all --filter=name=${instanceName.replace('/', '_')}_${serviceName}_ --format=\"{{.ID}}\  --filter=\"health=healthy\" --filter=\"health=none\"  """").!!.trim().replaceAll("\"", "")
}
@kurtkopchik
Copy link
Contributor

Hi @NikolayKhoroshevsky,

I like the suggestion. However, the one complication is that it looks like the ability for docker ps to filter on health status was not introduced until somewhat recently in docker v1.13.0 moby/moby#24698

As it looks like docker ps returns an error when a non-existing filter is supplied this change is going to break compatibility with anyone using a pre-v1.13.0 version of docker.

docker ps --filter=test=test
Error response from daemon: Invalid filter 'test'

It's possible that we could have two different versions of the command that getDockerContainerId executes but that would require adding some additional logic to get the docker version information before deciding on which version of the command to execute.

I'm open to other suggestions as well.

@rossoha
Copy link
Author

rossoha commented Nov 2, 2017

Could you please add the documentation, guide how to build this plug locally for different sbt/scala versions to make easier testing and contribution processes?

@kurtkopchik
Copy link
Contributor

Hi @NikolayKhoroshevsky - If you want to build/test for sbt 0.13 and sbt 1.0 you can check out these instructions.

As for testing against different versions of docker I'm not aware of a good or easy way to do this. I identified the compatibility issue with the filters because in the past we have run into this type of problem when updating any of the commands in DockerCommands.scala. So I just manually took a look at the docker code to identify when support for the filters was added.

@rossoha
Copy link
Author

rossoha commented Nov 2, 2017

Thanks!)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants