Skip to content

Commit

Permalink
tests: Try to make shutdowntest a bit more robust
Browse files Browse the repository at this point in the history
This should help it run better on slow test environment like the LXC CI
armhf builder.
 - Wait longer for the container to start
 - Wait longer for the container to shutdown
 - On failure to shutdown, kill the container
 - Always destroy the container if it's around

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information
stgraber committed Apr 2, 2014
1 parent 982b595 commit cf0c72d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/tests/shutdowntest.c
Expand Up @@ -70,10 +70,13 @@ int main(int argc, char *argv[])
}

/* Wait for init to be ready for SIGPWR */
sleep(10);
sleep(20);

if (!c->shutdown(c, 60)) {
if (!c->shutdown(c, 120)) {
fprintf(stderr, "%d: failed to shut down %s\n", __LINE__, MYNAME);
if (!c->stop(c)) {
fprintf(stderr, "%d: failed to kill %s\n", __LINE__, MYNAME);
}
goto out;
}

Expand All @@ -90,6 +93,10 @@ int main(int argc, char *argv[])
fprintf(stderr, "all lxc_container tests passed for %s\n", c->name);
ret = 0;
out:
if (c && c->is_defined(c)) {
c->destroy(c);
}

lxc_container_put(c);
exit(ret);
}

0 comments on commit cf0c72d

Please sign in to comment.