From 4f67205d16d1bcd07f0f13a8c57fffd9bd861893 Mon Sep 17 00:00:00 2001
From: Mike <45373284+munkhuushmgl@users.noreply.github.com>
Date: Fri, 11 Dec 2020 10:32:32 -0800
Subject: [PATCH] chore: added retry for flaky test (#391)
* chore: added retry for flaky test
* lint
* added missing dependency
---
dialogflow/snippets/pom.xml | 9 +++++++++
.../java/com/example/dialogflow/CreateDocumentTest.java | 5 +++++
2 files changed, 14 insertions(+)
diff --git a/dialogflow/snippets/pom.xml b/dialogflow/snippets/pom.xml
index 8278c6ca682..25d49bbf777 100644
--- a/dialogflow/snippets/pom.xml
+++ b/dialogflow/snippets/pom.xml
@@ -44,6 +44,15 @@
+
+ com.google.cloud
+ google-cloud-core
+ 1.94.0
+ test
+ tests
+
+
+
junit
junit
diff --git a/dialogflow/snippets/src/test/java/com/example/dialogflow/CreateDocumentTest.java b/dialogflow/snippets/src/test/java/com/example/dialogflow/CreateDocumentTest.java
index 8aaa3830053..dc9c0d4ef89 100644
--- a/dialogflow/snippets/src/test/java/com/example/dialogflow/CreateDocumentTest.java
+++ b/dialogflow/snippets/src/test/java/com/example/dialogflow/CreateDocumentTest.java
@@ -23,6 +23,7 @@
import com.google.cloud.dialogflow.v2beta1.KnowledgeBase;
import com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClient;
import com.google.cloud.dialogflow.v2beta1.ProjectName;
+import com.google.cloud.testing.junit4.MultipleAttemptsRule;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
@@ -30,6 +31,7 @@
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -84,6 +86,9 @@ public void tearDown() throws IOException {
System.setOut(null);
}
+ @Rule
+ public MultipleAttemptsRule multipleAttemptsRule = new MultipleAttemptsRule(3);
+
@Test
public void testCreateDocument() throws Exception {
DocumentManagement.createDocument(