Skip to content

Commit

Permalink
[serving] Fix flaky test
Browse files Browse the repository at this point in the history
Change-Id: I13b89e04516c59a3d28ecafd49f4f808630b22fb
  • Loading branch information
frankfliu committed Jun 11, 2021
1 parent 77809f4 commit 46f6bff
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions serving/serving/src/test/java/ai/djl/serving/ModelServerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 46f6bff

Please sign in to comment.