diff --git a/src/broker/test/overlay.c b/src/broker/test/overlay.c index dfe9ed02b66e..170e7ce7e48c 100644 --- a/src/broker/test/overlay.c +++ b/src/broker/test/overlay.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -523,8 +524,22 @@ void test_create (flux_t *h, * handler, and overlay_authorize() will fail if it doesn't * exist. */ - if (overlay_bind (ctx[0]->ov, uri) < 0) - BAIL_OUT ("%s: overlay_bind failed", ctx[0]->name); + while (1) { + if (overlay_bind (ctx[0]->ov, uri) < 0) { + /* There's a small chance bind from previous test + * not yet cleared, we'll retry until it works + */ + if (errno != EADDRINUSE) + BAIL_OUT ("%s: overlay_bind failed", ctx[0]->name); + usleep (100000); + ctx_destroy (ctx[rank]); + ctx[rank] = ctx_create (h, size, rank, NULL, recv_cb); + if (overlay_set_topology (ctx[rank]->ov, ctx[rank]->topo) < 0) + BAIL_OUT ("%s: overlay_set_topology failed", ctx[rank]->name); + continue; + } + break; + } } else { if (overlay_authorize (ctx[0]->ov,