Fix: tests: metadata presence on relayd is not deterministic
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 11 Dec 2019 20:58:58 +0000 (15:58 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 13 Dec 2019 20:06:06 +0000 (15:06 -0500)
There is no synchronization point guaranteeing the presence of metadata on
lttng-relayd side when the live metadata request is done. It must be
present at some point in the future but might not be at the moment we
perform the request.

Add a retry phase to this step. It must succeed in the future.

Not sure how this test was never marked as flaky.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I033005c6a228013e699c74d8e8faafcb3272dd98
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/regression/tools/live/live_test.c

index 8a884ab6bf68d3b5d8cbc04cfcbfdcf609f70388..217c72af422b9286d8b38fe60ed4c4132f1532cb 100644 (file)
@@ -399,6 +399,7 @@ int get_metadata(void)
 
        rq.stream_id = htobe64(session->streams[metadata_stream_id].id);
 
+retry:
        ret_len = lttng_live_send(control_sock, &cmd, sizeof(cmd));
        if (ret_len < 0) {
                diag("Error sending cmd");
@@ -423,8 +424,8 @@ int get_metadata(void)
                break;
        case LTTNG_VIEWER_NO_NEW_METADATA:
                diag("Got LTTNG_VIEWER_NO_NEW_METADATA:");
-               ret = 0;
-               goto end;
+               usleep(50);
+               goto retry;
        case LTTNG_VIEWER_METADATA_ERR:
                diag("Got LTTNG_VIEWER_METADATA_ERR:");
                goto error;
@@ -454,7 +455,7 @@ int get_metadata(void)
        }
        free(data);
        ret = len;
-end:
+
        return ret;
 
 error_free_data:
This page took 0.026415 seconds and 4 git commands to generate.