diff --git a/.github/workflows/build-validation.yml b/.github/workflows/build-validation.yml index 7659f586..db7f298f 100644 --- a/.github/workflows/build-validation.yml +++ b/.github/workflows/build-validation.yml @@ -73,12 +73,11 @@ jobs: if: env.UNIT_TEST_FAILED == 'true' run: exit 1 - # TODO: Move the sidecar into a central image repository - - name: Initialize Durable Task Sidecar - run: docker run --name durabletask-sidecar -p 4001:4001 --env 'DURABLETASK_SIDECAR_LOGLEVEL=Debug' -d peterstone2019/durabletask-sidecar:latest start --backend Emulator + - name: Initialize Durable Task Emulator + run: docker run --name durabletask-emulator -p 4001:8080 -d mcr.microsoft.com/dts/dts-emulator:latest - - name: Display Durable Task Sidecar Logs - run: nohup docker logs --since=0 durabletask-sidecar > durabletask-sidecar.log 2>&1 & + - name: Display Durable Task Emulator Logs + run: nohup docker logs --since=0 durabletask-emulator > durabletask-emulator.log 2>&1 & # wait for 10 seconds, so sidecar container can be fully up, this will avoid intermittent failing issues for integration tests causing by failed to connect to sidecar - name: Wait for 10 seconds @@ -88,14 +87,14 @@ jobs: run: ./gradlew integrationTest || echo "TEST_FAILED=true" >> $GITHUB_ENV continue-on-error: true - - name: Kill Durable Task Sidecar - run: docker kill durabletask-sidecar + - name: Kill Durable Task Emulator + run: docker kill durabletask-emulator - - name: Upload Durable Task Sidecar Logs + - name: Upload Durable Task Emulator Logs uses: actions/upload-artifact@v4 with: - name: Durable Task Sidecar Logs - path: durabletask-sidecar.log + name: Durable Task Emulator Logs + path: durabletask-emulator.log - name: Archive test report uses: actions/upload-artifact@v4 diff --git a/azuremanaged/src/main/java/com/microsoft/durabletask/azuremanaged/DurableTaskSchedulerClientExtensions.java b/azuremanaged/src/main/java/com/microsoft/durabletask/azuremanaged/DurableTaskSchedulerClientExtensions.java index ffc7d446..7e749603 100644 --- a/azuremanaged/src/main/java/com/microsoft/durabletask/azuremanaged/DurableTaskSchedulerClientExtensions.java +++ b/azuremanaged/src/main/java/com/microsoft/durabletask/azuremanaged/DurableTaskSchedulerClientExtensions.java @@ -91,7 +91,8 @@ public static DurableTaskGrpcClientBuilder createClientBuilder( return createBuilderFromOptions(new DurableTaskSchedulerClientOptions() .setEndpointAddress(endpoint) .setTaskHubName(taskHubName) - .setCredential(tokenCredential)); + .setCredential(tokenCredential) + .setAllowInsecureCredentials(tokenCredential == null)); } // Private helper methods to reduce code duplication diff --git a/azuremanaged/src/main/java/com/microsoft/durabletask/azuremanaged/DurableTaskSchedulerWorkerExtensions.java b/azuremanaged/src/main/java/com/microsoft/durabletask/azuremanaged/DurableTaskSchedulerWorkerExtensions.java index 0ea9b5be..97b3593d 100644 --- a/azuremanaged/src/main/java/com/microsoft/durabletask/azuremanaged/DurableTaskSchedulerWorkerExtensions.java +++ b/azuremanaged/src/main/java/com/microsoft/durabletask/azuremanaged/DurableTaskSchedulerWorkerExtensions.java @@ -91,7 +91,8 @@ public static DurableTaskGrpcWorkerBuilder createWorkerBuilder( return createBuilderFromOptions(new DurableTaskSchedulerWorkerOptions() .setEndpointAddress(endpoint) .setTaskHubName(taskHubName) - .setCredential(tokenCredential)); + .setCredential(tokenCredential) + .setAllowInsecureCredentials(tokenCredential == null)); } // Private helper methods to reduce code duplication diff --git a/client/build.gradle b/client/build.gradle index 9da13e81..34f84afb 100644 --- a/client/build.gradle +++ b/client/build.gradle @@ -17,6 +17,8 @@ def grpcVersion = '1.59.0' def protocVersion = '3.12.0' def jacksonVersion = '2.15.3' def openTelemetryVersion = '1.25.0' +def azureCoreVersion = '1.45.0' +def azureIdentityVersion = '1.11.1' // When build on local, you need to set this value to your local jdk11 directory. // Java11 is used to compile and run all the tests. // Example for Windows: C:/Program Files/Java/openjdk-11.0.12_7/ @@ -36,12 +38,14 @@ dependencies { implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}" implementation "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}" implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${jacksonVersion}" - implementation "io.opentelemetry:opentelemetry-api:${openTelemetryVersion}" implementation "io.opentelemetry:opentelemetry-context:${openTelemetryVersion}" testImplementation(platform('org.junit:junit-bom:5.7.2')) testImplementation('org.junit.jupiter:junit-jupiter') + testImplementation project(':azuremanaged') + testImplementation "com.azure:azure-core:${azureCoreVersion}" + testImplementation "com.azure:azure-identity:${azureIdentityVersion}" } compileJava { diff --git a/client/src/test/java/com/microsoft/durabletask/ErrorHandlingIntegrationTests.java b/client/src/test/java/com/microsoft/durabletask/ErrorHandlingIntegrationTests.java index 223652b9..996919b4 100644 --- a/client/src/test/java/com/microsoft/durabletask/ErrorHandlingIntegrationTests.java +++ b/client/src/test/java/com/microsoft/durabletask/ErrorHandlingIntegrationTests.java @@ -13,7 +13,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import org.junit.jupiter.api.BeforeEach; import static org.junit.jupiter.api.Assertions.*; /** @@ -26,13 +25,6 @@ @Tag("integration") public class ErrorHandlingIntegrationTests extends IntegrationTestBase { - @BeforeEach - private void startUp() { - try(DurableTaskClient client = new DurableTaskGrpcClientBuilder().build()) { - client.deleteTaskHub(); - } - } - @Test void orchestratorException() throws TimeoutException { final String orchestratorName = "OrchestratorWithException"; @@ -44,7 +36,7 @@ void orchestratorException() throws TimeoutException { }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 0); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); @@ -83,7 +75,7 @@ void activityException(boolean handleException) throws TimeoutException { }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, ""); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); @@ -166,7 +158,7 @@ void subOrchestrationException(boolean handleException) throws TimeoutException throw new RuntimeException(errorMessage); }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 1); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); @@ -284,7 +276,7 @@ private FailureDetails retryOnFailuresCoreTest( }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, ""); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); diff --git a/client/src/test/java/com/microsoft/durabletask/IntegrationTestBase.java b/client/src/test/java/com/microsoft/durabletask/IntegrationTestBase.java index ce64f215..a540a17d 100644 --- a/client/src/test/java/com/microsoft/durabletask/IntegrationTestBase.java +++ b/client/src/test/java/com/microsoft/durabletask/IntegrationTestBase.java @@ -7,21 +7,62 @@ import java.time.Duration; +import com.microsoft.durabletask.azuremanaged.DurableTaskSchedulerClientOptions; +import com.microsoft.durabletask.azuremanaged.DurableTaskSchedulerWorkerExtensions; +import com.microsoft.durabletask.azuremanaged.DurableTaskSchedulerWorkerOptions; + +import io.grpc.Channel; +import io.grpc.ManagedChannel; public class IntegrationTestBase { protected static final Duration defaultTimeout = Duration.ofSeconds(10); // All tests that create a server should save it to this variable for proper shutdown - private DurableTaskGrpcWorker server; + private DurableTaskGrpcWorker server; // All tests that create a client are responsible for closing their own gRPC channel + private ManagedChannel workerChannel; + private ManagedChannel clientChannel; @AfterEach private void shutdown() { if (this.server != null) { this.server.stop(); + this.server = null; + } + + if (this.workerChannel != null) { + this.workerChannel.shutdownNow(); + this.workerChannel = null; + } + + if (this.clientChannel != null) { + this.clientChannel.shutdownNow(); + this.clientChannel = null; } } protected TestDurableTaskWorkerBuilder createWorkerBuilder() { - return new TestDurableTaskWorkerBuilder(); + DurableTaskSchedulerWorkerOptions options = new DurableTaskSchedulerWorkerOptions() + .setEndpointAddress("http://localhost:4001") + .setTaskHubName("default") + .setCredential(null) + .setAllowInsecureCredentials(true); + Channel grpcChannel = options.createGrpcChannel(); + this.workerChannel = (ManagedChannel) grpcChannel; + return new TestDurableTaskWorkerBuilder( + new DurableTaskGrpcWorkerBuilder() + .grpcChannel(grpcChannel)); + } + + protected DurableTaskGrpcClientBuilder createClientBuilder() { + DurableTaskSchedulerClientOptions options = new DurableTaskSchedulerClientOptions() + .setEndpointAddress("http://localhost:4001") + .setTaskHubName("default") + .setCredential(null) + .setAllowInsecureCredentials(true); + Channel grpcChannel = options.createGrpcChannel(); + // The channel returned is actually a ManagedChannel, so we can safely cast it + this.clientChannel = (ManagedChannel) grpcChannel; + return new DurableTaskGrpcClientBuilder() + .grpcChannel(grpcChannel); } public class TestDurableTaskWorkerBuilder { @@ -31,6 +72,10 @@ private TestDurableTaskWorkerBuilder() { this.innerBuilder = new DurableTaskGrpcWorkerBuilder(); } + private TestDurableTaskWorkerBuilder(DurableTaskGrpcWorkerBuilder innerBuilder) { + this.innerBuilder = innerBuilder; + } + public DurableTaskGrpcWorker buildAndStart() { DurableTaskGrpcWorker server = this.innerBuilder.build(); IntegrationTestBase.this.server = server; diff --git a/client/src/test/java/com/microsoft/durabletask/IntegrationTests.java b/client/src/test/java/com/microsoft/durabletask/IntegrationTests.java index 38ae865e..dabbcc31 100644 --- a/client/src/test/java/com/microsoft/durabletask/IntegrationTests.java +++ b/client/src/test/java/com/microsoft/durabletask/IntegrationTests.java @@ -14,8 +14,6 @@ import java.util.stream.IntStream; import java.util.stream.Stream; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; @@ -35,25 +33,8 @@ @Tag("integration") public class IntegrationTests extends IntegrationTestBase { static final Duration defaultTimeout = Duration.ofSeconds(100); - // All tests that create a server should save it to this variable for proper shutdown - private DurableTaskGrpcWorker server; - - // Before whole test suite, delete the task hub - @BeforeEach - private void startUp() { - try (DurableTaskClient client = new DurableTaskGrpcClientBuilder().build()) { - client.deleteTaskHub(); - } - } - - @AfterEach - private void shutdown() throws InterruptedException { - if (this.server != null) { - this.server.stop(); - } - } - @Test + @Test void emptyOrchestration() throws TimeoutException { final String orchestratorName = "EmptyOrchestration"; final String input = "Hello " + Instant.now(); @@ -61,7 +42,7 @@ void emptyOrchestration() throws TimeoutException { .addOrchestrator(orchestratorName, ctx -> ctx.complete(ctx.getInput(String.class))) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, input); OrchestrationMetadata instance = client.waitForInstanceCompletion( @@ -76,7 +57,7 @@ void emptyOrchestration() throws TimeoutException { } } - @Test + @Test void singleTimer() throws IOException, TimeoutException { final String orchestratorName = "SingleTimer"; final Duration delay = Duration.ofSeconds(3); @@ -84,7 +65,7 @@ void singleTimer() throws IOException, TimeoutException { .addOrchestrator(orchestratorName, ctx -> ctx.createTimer(delay).await()) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); Duration timeout = delay.plus(defaultTimeout); @@ -110,14 +91,12 @@ void longTimer() throws TimeoutException { .addOrchestrator(orchestratorName, ctx -> { timestamps.set(counter.get(), LocalDateTime.now()); counter.incrementAndGet(); - ctx.createTimer(delay).await(); - }) + ctx.createTimer(delay).await(); }) .setMaximumTimerInterval(Duration.ofSeconds(3)) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { - client.createTaskHub(true); String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); Duration timeout = delay.plus(defaultTimeout); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, timeout, false); @@ -164,7 +143,7 @@ void longTimerNonblocking() throws TimeoutException { } }).setMaximumTimerInterval(Duration.ofSeconds(3)).buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); client.raiseEvent(instanceId, externalEventActivityName, "Hello world"); @@ -202,7 +181,7 @@ void longTimerNonblockingNoExternal() throws TimeoutException { } }).setMaximumTimerInterval(Duration.ofSeconds(3)).buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); @@ -235,7 +214,7 @@ void longTimeStampTimer() throws TimeoutException { .setMaximumTimerInterval(Duration.ofSeconds(3)) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); Duration timeout = delay.plus(defaultTimeout); @@ -263,7 +242,7 @@ void singleTimeStampTimer() throws IOException, TimeoutException { .addOrchestrator(orchestratorName, ctx -> ctx.createTimer(zonedDateTime).await()) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); Duration timeout = delay.plus(defaultTimeout); @@ -293,7 +272,7 @@ void isReplaying() throws IOException, InterruptedException, TimeoutException { }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); OrchestrationMetadata instance = client.waitForInstanceCompletion( @@ -330,7 +309,7 @@ void singleActivity() throws IOException, InterruptedException, TimeoutException }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, input); OrchestrationMetadata instance = client.waitForInstanceCompletion( @@ -375,7 +354,7 @@ void currentDateTimeUtc() throws IOException, TimeoutException { }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); @@ -402,7 +381,7 @@ void activityChain() throws IOException, TimeoutException { .addActivity(plusOneActivityName, ctx -> ctx.getInput(int.class) + 1) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 0); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); @@ -423,7 +402,7 @@ void subOrchestration() throws TimeoutException { } ctx.complete(result); }).buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try(worker; client){ String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 1); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); @@ -446,7 +425,7 @@ void continueAsNew() throws TimeoutException { ctx.complete(input); } }).buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try(worker; client){ String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 1); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); @@ -472,7 +451,7 @@ void continueAsNewWithExternalEvents() throws TimeoutException, InterruptedExcep ctx.complete(receivedEventCount); } }).buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 0); @@ -496,7 +475,7 @@ void termination() throws TimeoutException { .addOrchestrator(orchestratorName, ctx -> ctx.createTimer(delay).await()) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); String expectOutput = "I'll be back."; @@ -519,7 +498,7 @@ void restartOrchestrationWithNewInstanceId(boolean restartWithNewInstanceId) thr .addOrchestrator(orchestratorName, ctx -> ctx.createTimer(delay).await()) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, "RestartTest"); client.waitForInstanceCompletion(instanceId, defaultTimeout, true); @@ -546,7 +525,7 @@ void restartOrchestrationThrowsException() { .addOrchestrator(orchestratorName, ctx -> ctx.createTimer(delay).await()) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { client.scheduleNewOrchestrationInstance(orchestratorName, "RestartTest"); @@ -573,7 +552,7 @@ void suspendResumeOrchestration() throws TimeoutException, InterruptedException }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); client.suspendInstance(instanceId); @@ -612,7 +591,7 @@ void terminateSuspendOrchestration() throws TimeoutException, InterruptedExcepti }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); String suspendReason = "Suspend for testing."; @@ -647,7 +626,7 @@ void activityFanOut() throws IOException, TimeoutException { .addActivity(activityName, ctx -> ctx.getInput(Object.class).toString()) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 0); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); @@ -689,7 +668,7 @@ void externalEvents() throws IOException, TimeoutException { }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); @@ -723,7 +702,7 @@ void externalEventsWithTimeouts(boolean raiseEvent) throws IOException, TimeoutE }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); @@ -757,7 +736,7 @@ void setCustomStatus() throws TimeoutException { }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); @@ -790,7 +769,7 @@ void clearCustomStatus() throws TimeoutException { }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); @@ -813,7 +792,7 @@ void clearCustomStatus() throws TimeoutException { void multiInstanceQuery() throws TimeoutException{ final String plusOne = "plusOne"; final String waitForEvent = "waitForEvent"; - final DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + final DurableTaskClient client = this.createClientBuilder().build(); DurableTaskGrpcWorker worker = this.createWorkerBuilder() .addOrchestrator(plusOne, ctx -> { int value = ctx.getInput(int.class); @@ -830,7 +809,6 @@ void multiInstanceQuery() throws TimeoutException{ }).buildAndStart(); try(worker; client){ - client.createTaskHub(true); Instant startTime = Instant.now(); String prefix = startTime.toString(); @@ -1004,9 +982,8 @@ void purgeInstanceId() throws TimeoutException { .addActivity(plusOneActivityName, ctx -> ctx.getInput(int.class) + 1) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { - client.createTaskHub(true); String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 0); OrchestrationMetadata metadata = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); assertNotNull(metadata); @@ -1051,9 +1028,8 @@ void purgeInstanceFilter() throws TimeoutException { .addOrchestrator(terminate, ctx -> ctx.createTimer(delay).await()) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { - client.createTaskHub(true); Instant startTime = Instant.now(); String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 0); @@ -1144,9 +1120,8 @@ void purgeInstanceFilterTimeout() throws TimeoutException { .addActivity(plusTwo, ctx -> ctx.getInput(int.class) + 2) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { - client.createTaskHub(true); Instant startTime = Instant.now(); String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 0); @@ -1190,7 +1165,7 @@ void waitForInstanceStartThrowsException() { }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); assertThrows(TimeoutException.class, () -> client.waitForInstanceStart(instanceId, Duration.ofSeconds(2))); @@ -1219,9 +1194,8 @@ void waitForInstanceCompletionThrowsException() { }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { - client.createTaskHub(true); String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 0); assertThrows(TimeoutException.class, () -> client.waitForInstanceCompletion(instanceId, Duration.ofSeconds(2), false)); } @@ -1259,7 +1233,7 @@ void activityFanOutWithException() throws TimeoutException { .addActivity(activityName, ctx -> count / ctx.getInput(Integer.class)) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 0); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); @@ -1301,7 +1275,7 @@ void thenApply() throws IOException, InterruptedException, TimeoutException { }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, input); OrchestrationMetadata instance = client.waitForInstanceCompletion( @@ -1336,7 +1310,7 @@ void externalEventThenAccept() throws InterruptedException, TimeoutException { ctx.complete(receivedEventCount); } }).buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 0); @@ -1390,7 +1364,7 @@ void activityAllOf() throws IOException, TimeoutException { }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 0); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); @@ -1458,7 +1432,7 @@ void activityAllOfException() throws IOException, TimeoutException { }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 0); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); @@ -1508,7 +1482,7 @@ void activityAnyOf() throws IOException, TimeoutException { }) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try (worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName, 0); OrchestrationMetadata instance = client.waitForInstanceCompletion(instanceId, defaultTimeout, true); @@ -1553,7 +1527,7 @@ public void newUUIDTest() { }) .addActivity(echoActivityName, ctx -> ctx.getInput(UUID.class)) .buildAndStart(); - DurableTaskClient client = new DurableTaskGrpcClientBuilder().build(); + DurableTaskClient client = this.createClientBuilder().build(); try(worker; client) { String instanceId = client.scheduleNewOrchestrationInstance(orchestratorName); @@ -1565,4 +1539,4 @@ public void newUUIDTest() { throw new RuntimeException(e); } } -} \ No newline at end of file +}