Skip to content

Commit

Permalink
Coordinator test fix #4544 (#4610)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kec <daniel.kec@oracle.com>
  • Loading branch information
danielkec authored Jul 26, 2022
1 parent 29416bd commit 0cbe0cd
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.helidon.lra.coordinator;

import java.net.URI;
import java.time.Duration;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import io.helidon.common.LazyValue;
import io.helidon.common.reactive.Multi;
import io.helidon.config.Config;
import io.helidon.config.ConfigSources;
import io.helidon.lra.coordinator.CoordinatorService;
import io.helidon.media.jsonp.JsonpSupport;
import io.helidon.webclient.WebClient;
import io.helidon.webserver.Routing;
Expand All @@ -41,6 +41,8 @@ public class CoordinatorTest {

private static final String CONTEXT_PATH = "/test";
private static final String COORDINATOR_ROUTING_NAME = "coordinator";

private static final Duration TIMEOUT = Duration.ofSeconds(10);
private static WebServer server;
private static String serverUrl;
private static WebClient webClient;
Expand Down Expand Up @@ -72,7 +74,7 @@ static void beforeAll() {
.build())
.routing(r -> r.register(CONTEXT_PATH, rules -> rules.put((req, res) -> res.send())))
.build();
server.start().await();
server.start().await(TIMEOUT);
serverUrl = "http://localhost:" + server.port();
webClient = WebClient.builder()
.keepAlive(false)
Expand Down Expand Up @@ -122,7 +124,7 @@ private String start() {
.path("start")
.submit()
.flatMapSingle(res -> res.content().as(String.class))
.await(500, TimeUnit.MILLISECONDS);
.await(TIMEOUT);
}

private LRAStatus getParsedStatusOfLra(String lraId) {
Expand All @@ -139,7 +141,7 @@ private LRAStatus getParsedStatusOfLra(String lraId) {
.map(jo -> jo.getString("status"))
.map(LRAStatus::valueOf)
.first()
.await(500, TimeUnit.MILLISECONDS);
.await(TIMEOUT);
}

private LRAStatus status(String lraId) {
Expand All @@ -152,7 +154,7 @@ private LRAStatus status(String lraId) {
.request()
.flatMapSingle(res -> res.content().as(String.class))
.map(LRAStatus::valueOf)
.await(500, TimeUnit.MILLISECONDS);
.await(TIMEOUT);
}

private void close(String lraId) {
Expand All @@ -163,7 +165,7 @@ private void close(String lraId) {
.build()
.put()
.submit()
.await(500, TimeUnit.MILLISECONDS);
.await(TIMEOUT);
}

private void cancel(String lraId) {
Expand All @@ -174,6 +176,6 @@ private void cancel(String lraId) {
.build()
.put()
.submit()
.await(500, TimeUnit.MILLISECONDS);
.await(TIMEOUT);
}
}

0 comments on commit 0cbe0cd

Please sign in to comment.