Commit b130964d by S.Çağlar Onur Committed by Serge Hallyn

use busybox instead of ubuntu to test as it's much more lightweight, also wait…

use busybox instead of ubuntu to test as it's much more lightweight, also wait containers to enter desired state Signed-off-by: 's avatarS.Çağlar Onur <caglar@10ur.org> Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent f209d63a
...@@ -40,7 +40,7 @@ void * concurrent(void *arguments) { ...@@ -40,7 +40,7 @@ void * concurrent(void *arguments) {
args->return_code = 1; args->return_code = 1;
if (strcmp(args->mode, "create") == 0) { if (strcmp(args->mode, "create") == 0) {
if (!c->is_defined(c)) { if (!c->is_defined(c)) {
if (!c->create(c, "ubuntu", NULL, NULL, 1, NULL)) { if (!c->create(c, "busybox", NULL, NULL, 1, NULL)) {
fprintf(stderr, "Creating the container (%s) failed...\n", name); fprintf(stderr, "Creating the container (%s) failed...\n", name);
goto out; goto out;
} }
...@@ -52,6 +52,10 @@ void * concurrent(void *arguments) { ...@@ -52,6 +52,10 @@ void * concurrent(void *arguments) {
fprintf(stderr, "Starting the container (%s) failed...\n", name); fprintf(stderr, "Starting the container (%s) failed...\n", name);
goto out; goto out;
} }
if (!c->wait(c, "RUNNING", -1)) {
fprintf(stderr, "Waiting the container (%s) to start failed...\n", name);
goto out;
}
} }
} else if(strcmp(args->mode, "stop") == 0) { } else if(strcmp(args->mode, "stop") == 0) {
if (c->is_defined(c) && c->is_running(c)) { if (c->is_defined(c) && c->is_running(c)) {
...@@ -59,6 +63,10 @@ void * concurrent(void *arguments) { ...@@ -59,6 +63,10 @@ void * concurrent(void *arguments) {
fprintf(stderr, "Stopping the container (%s) failed...\n", name); fprintf(stderr, "Stopping the container (%s) failed...\n", name);
goto out; goto out;
} }
if (!c->wait(c, "STOPPED", -1)) {
fprintf(stderr, "Waiting the container (%s) to stop failed...\n", name);
goto out;
}
} }
} else if(strcmp(args->mode, "destroy") == 0) { } else if(strcmp(args->mode, "destroy") == 0) {
if (c->is_defined(c) && !c->is_running(c)) { if (c->is_defined(c) && !c->is_running(c)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment