Skip to content
This repository was archived by the owner on Sep 16, 2023. It is now read-only.

Commit ae769cb

Browse files
authored
chore: added extra flow for traingflow test (#209)
Fixes #203 ☕️ Problem is IT has only one flow that is being used in numerous tests. Because of that trainFlowTest is flaky, so it might be good idea to have seperate flow only for trainFlowTest
1 parent b29dfea commit ae769cb

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

  • google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/it

google-cloud-dialogflow-cx/src/test/java/com/google/cloud/dialogflow/cx/v3beta1/it/ITSystemTest.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public class ITSystemTest {
103103
private static String agentName;
104104
private static String entityTypesName;
105105
private static String flowName;
106+
private static String trainFlowName;
106107
private static String intentsName;
107108
private static String pageName;
108109
private static String transitionRouteGroupName;
@@ -173,6 +174,17 @@ public static void setUp() throws IOException, ExecutionException, InterruptedEx
173174
Flow flowResponse = flowsClient.createFlow(createFlowRequest);
174175
flowName = flowResponse.getName();
175176

177+
Flow trainFlow =
178+
Flow.newBuilder()
179+
.setNluSettings(NLUSETTINGS)
180+
.setDisplayName(DISPLAY_NAME)
181+
.setDescription(DESCRIPTION)
182+
.build();
183+
CreateFlowRequest createTrainFlowRequest =
184+
CreateFlowRequest.newBuilder().setParent(agentName).setFlow(trainFlow).build();
185+
Flow trainFlowResponse = flowsClient.createFlow(createTrainFlowRequest);
186+
trainFlowName = trainFlowResponse.getName();
187+
176188
/* create intents */
177189
intentsClient = IntentsClient.create();
178190
Intent intent = Intent.newBuilder().setDisplayName(DISPLAY_NAME).setPriority(1).build();
@@ -245,6 +257,10 @@ public static void tearDown() {
245257
/* delete flows */
246258
DeleteFlowRequest deleteFlowRequest = DeleteFlowRequest.newBuilder().setName(flowName).build();
247259
flowsClient.deleteFlow(deleteFlowRequest);
260+
261+
DeleteFlowRequest deleteTrainFlowRequest =
262+
DeleteFlowRequest.newBuilder().setName(trainFlowName).build();
263+
flowsClient.deleteFlow(deleteTrainFlowRequest);
248264
flowsClient.close();
249265

250266
/* delete entity types */
@@ -381,7 +397,7 @@ public void listFlowsTest() {
381397
@Test
382398
public void trainFlowTest() throws ExecutionException, InterruptedException {
383399
Empty expectedResponse = Empty.newBuilder().build();
384-
Empty response = flowsClient.trainFlowAsync(flowName).get();
400+
Empty response = flowsClient.trainFlowAsync(trainFlowName).get();
385401
assertEquals(expectedResponse, response);
386402
}
387403

0 commit comments

Comments
 (0)