From 46f6bffbb9498deef530456e440ea3433e9aebf1 Mon Sep 17 00:00:00 2001 From: Frank Liu Date: Thu, 10 Jun 2021 21:57:14 -0700 Subject: [PATCH] [serving] Fix flaky test Change-Id: I13b89e04516c59a3d28ecafd49f4f808630b22fb --- .../java/ai/djl/serving/ModelServerTest.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/serving/serving/src/test/java/ai/djl/serving/ModelServerTest.java b/serving/serving/src/test/java/ai/djl/serving/ModelServerTest.java index 057720cb186..f663fb3d0b4 100644 --- a/serving/serving/src/test/java/ai/djl/serving/ModelServerTest.java +++ b/serving/serving/src/test/java/ai/djl/serving/ModelServerTest.java @@ -170,7 +170,7 @@ public void test() // plugin tests testStaticHtmlRequest(); - channel.close(); + channel.close().sync(); // negative test case that channel will be closed by server testInvalidUri(); @@ -437,7 +437,7 @@ private void testInvalidUri() throws InterruptedException { channel.writeAndFlush(req).sync(); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class); @@ -457,7 +457,7 @@ private void testInvalidDescribeModel() throws InterruptedException { channel.writeAndFlush(req).sync(); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class); @@ -476,7 +476,7 @@ private void testInvalidPredictionsUri() throws InterruptedException { channel.writeAndFlush(req).sync(); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class); @@ -496,7 +496,7 @@ private void testPredictionsModelNotFound() throws InterruptedException { channel.writeAndFlush(req).sync(); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class); @@ -515,7 +515,7 @@ private void testInvalidManagementUri() throws InterruptedException { channel.writeAndFlush(req).sync(); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class); @@ -534,7 +534,7 @@ private void testInvalidManagementMethod() throws InterruptedException { channel.writeAndFlush(req).sync(); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class); @@ -553,7 +553,7 @@ private void testInvalidPredictionsMethod() throws InterruptedException { channel.writeAndFlush(req).sync(); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class); @@ -573,7 +573,7 @@ private void testDescribeModelNotFound() throws InterruptedException { channel.writeAndFlush(req).sync(); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class); @@ -592,7 +592,7 @@ private void testRegisterModelMissingUrl() throws InterruptedException { channel.writeAndFlush(req).sync(); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class); @@ -612,7 +612,7 @@ private void testRegisterModelNotFound() throws InterruptedException { channel.writeAndFlush(req).sync(); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class); @@ -638,7 +638,7 @@ private void testRegisterModelConflict() channel.writeAndFlush(req); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class); @@ -660,7 +660,7 @@ private void testInvalidScaleModel() throws InterruptedException { channel.writeAndFlush(req).sync(); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class); @@ -679,7 +679,7 @@ private void testScaleModelNotFound() throws InterruptedException { channel.writeAndFlush(req).sync(); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class); @@ -698,7 +698,7 @@ private void testUnregisterModelNotFound() throws InterruptedException { channel.writeAndFlush(req).sync(); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class); @@ -730,7 +730,7 @@ private void testServiceUnavailable() throws InterruptedException { channel.writeAndFlush(req).sync(); latch.await(); channel.closeFuture().sync(); - channel.close(); + channel.close().sync(); if (!System.getProperty("os.name").startsWith("Win")) { ErrorResponse resp = JsonUtils.GSON.fromJson(result, ErrorResponse.class);