-
Notifications
You must be signed in to change notification settings - Fork 59
Conversation
@chavafg could you enable swarm test for docker 17 this PR ? |
e57eb8e
to
7ff0e65
Compare
@jodh-intel nice to checkcommits is happy with my long name \o/ |
This patcha adds a function to be used in tests related with swarm. The function check_swarm_replicas: Will wait until all the replicas from a docker swarm service is ready. It also uses a timeout if after the timeout is finished the function will fail. The function uses : ``` docker service ps SERVICE ``` instead of: ``` docker ps --filter status=running --filter ancestor=IMAGE ``` This is needed because docker 17 does not filter containers that are part of a swarm service. Signed-off-by: Jose Carlos Venegas Munoz <[email protected]>
Should that commit message be changed like this?: s/tests: down wait/tests: don't wait/ ? |
|
||
info (){ | ||
msg="$*" | ||
echo "INFO: $msg" >&2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: do you want this to get to stderr or stdout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to send info to stderr just un case someone make a function and want to use the output for the command they did , but without having issues with info log. But I can change it if that does not sounds like a good approach.
tests/integration/docker/dns.bats
Outdated
|
||
info "create service testswarm1" | ||
$DOCKER_EXE service create \ | ||
--name testswarm1 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use a variable here for testswarm1
and testswarm2
which can be passed to docker and used in the info
call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree! Fixing
tests/integration/docker/dns.bats
Outdated
|
||
info "create service testdns" | ||
$DOCKER_EXE service create \ | ||
--name testdns \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another variable opportunity for testdns
.
tests/integration/docker/dns.bats
Outdated
--name testdns \ | ||
--replicas $number_of_replicas \ | ||
--publish 8084:80 \ | ||
mcastelino/nettools sleep 60000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd consider adding a comment saying that this is designed to sleep for the duration of the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than use these very long sleep
commands, I tend to use tail -f /dev/null
for a 'sleep forever' blocking function. About equally 'obscure', but at least it doesn't have some semi-random hardwired big number in it :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jodh-intel @grahamwhaley sure, taking a look to the code looks like that is the intention, but I also prefer to do a blocking container anyway it will be destroyed at the end.
I would like @GabyCT input , I think she did this tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried to move the command to /bin/bash but the image start to fail. I would like to keep that without modification by now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you were trying to replace the sleep with /bin/bash then that will likely fail as /bin/bash will have no 'commands' to process, so just instantly quits. Replace 'sleep 600000' with 'tail -f /dev/null' may just work - or worst case you may have to invoke a shell and pass 'tail -f /dev/null' as an argument to that (so '/bin/bash -c "tail -f /dev/null"' for instance). Anyhow, now probably anecdotal.
tests/integration/docker/mtu.bats
Outdated
@@ -40,16 +45,20 @@ setup() { | |||
break; | |||
fi | |||
done | |||
info "running $DOCKER_EXE swarm init ${swarm_interface_arg}" | |||
$DOCKER_EXE swarm init ${swarm_interface_arg} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use a pattern like this to avoid having to maintain both the docker command and the info
string:
cmd=$DOCKER_EXE swarm init ${swarm_interface_arg}`
info "running '$cmd'"
eval $cmd
@jcvenegas I tested them using centos 7 with docker version 17.05.0-ce, build 89658be and with cc-oci-runtime version: 2.1.10 commit: b82bbc2 and I noticed that the mtu.bats test is hanging |
@GabyCT this patch fix a hang in docker 17 for mtu dns swarm test. The fix only removes the hang from the setup function ( the test was not running, it was an issue with the test itself) . Is it only mtu test haivng issues? If so that should be a different issue from here. Could you please give more information what part of the test is having issues? In case this PR dont introduce any other regression could you please create a different issue for that ? |
@jcvenegas , the replicas are always in the state of created but they are never in the state of up or running |
$ docker ps -a |
that is not good :( . I tested in Clear Linux and is working and the CI seems that passed as well. I double check the function check_swarm_replicas it should not hang unless one of the docker commands be hanging ( that should involve a bigger PR to add timeout to all docker commands in our test). |
7ff0e65
to
5c585ad
Compare
(late reply) @jcvenegas - \o/. glad |
@jodh-intel changes applied |
@jcvenegas thanks for the discussion that we have, this lgtm as it is doing what it supposed to do even if we have still issues with swarm specially in centos |
@jcvenegas , I created the issue #959 about Centos thanks |
qa-passed |
5c585ad
to
f4d6ef7
Compare
thank you for review the issue @GabyCT |
This patch uses the function check_swarm_replicas in swarm tests. It removes the infinite loop that potentially can hang the test. Fixes: intel#938 Signed-off-by: Jose Carlos Venegas Munoz <[email protected]>
f4d6ef7
to
9c34a01
Compare
The timeout function seems that is working as expected, but a test does not finish correctly:
|
lets create an issue for that, I can skip that test for now when docker 17 is used. |
qa-failed |
opened #969 to track the swarm failure on Fedora. |
This patch removes some harcoded variables from swarm tests. Signed-off-by: Jose Carlos Venegas Munoz <[email protected]>
After re-enable swarm test for docker 17. The test "2 check that the replicas' names are different" started to fail ( note that ever run in docker 17 before). Signed-off-by: Jose Carlos Venegas Munoz <[email protected]>
This PR uses the function the new added check_swarm_replicas in swarm tests.
It removes the infinite loop that potentially can hang the test.
The function check_swarm_replicas: Will wait until all the replicas
from a docker swarm service are ready. It also uses a timeout
if after the timeout is finished the function will fail.
Fixes: #938