Skip to content

Commit 44f5c52

Browse files
author
Shailesh Jagannath Padave
committed
Unregister wf
1 parent 2a9f747 commit 44f5c52

File tree

1 file changed

+15
-2
lines changed
  • conductor-clients/java/conductor-java-sdk/tests/src/test/java/io/orkes/conductor/client

1 file changed

+15
-2
lines changed

conductor-clients/java/conductor-java-sdk/tests/src/test/java/io/orkes/conductor/client/ApiClientTest.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@
77
import com.netflix.conductor.common.metadata.workflow.WorkflowDef;
88
import com.netflix.conductor.common.metadata.workflow.WorkflowTask;
99
import com.netflix.conductor.common.run.Workflow;
10+
import org.junit.jupiter.api.AfterAll;
1011
import org.junit.jupiter.api.BeforeAll;
1112
import org.junit.jupiter.api.Test;
1213

1314
import java.util.List;
1415
import java.util.Map;
16+
import java.util.concurrent.TimeUnit;
1517

18+
import static java.util.concurrent.TimeUnit.SECONDS;
1619
import static org.junit.Assert.assertEquals;
1720
import static org.junit.Assert.assertNotNull;
21+
import static org.testcontainers.shaded.org.awaitility.Awaitility.await;
1822

1923
public class ApiClientTest {
2024
private static final String workflowName = "test_api_client_wf";
@@ -33,14 +37,20 @@ public static void init() {
3337
registerWorkflowDef();
3438
}
3539

40+
@AfterAll
41+
public static void cleanUp() {
42+
// Clean up resources
43+
metadataClient.unregisterWorkflowDef(workflowName, 1);
44+
}
45+
3646
static void registerWorkflowDef() {
3747
WorkflowTask httpTask = new WorkflowTask();
3848
httpTask.setDescription("HTTP Task");
3949
httpTask.setWorkflowTaskType(TaskType.HTTP);
4050
httpTask.setTaskReferenceName(taskName);
4151
httpTask.setName(taskName);
4252
httpTask.setInputParameters(Map.of(
43-
"uri", "http://httpbin-server:8081/api/hello?name=apiClientTest",
53+
"uri", "http://httpBin:8081/api/hello?name=apiClientTest",
4454
"method", "GET"
4555
));
4656

@@ -61,7 +71,10 @@ void testApiClient() {
6171
.withVersion(1));
6272

6373
System.out.println("Started workflow " + workflowId);
64-
74+
await().atMost(30, SECONDS).pollInterval(1, SECONDS).until(() -> {
75+
var wf = workflowClient.getWorkflow(workflowId, true);
76+
return wf.getStatus().isTerminal();
77+
});
6578
var workflow = workflowClient.getWorkflow(workflowId, true);
6679

6780
assertNotNull(workflowId);

0 commit comments

Comments
 (0)