Skip to content

Commit 34f572b

Browse files
YunchuWangJoshVanL
authored andcommitted
Fixing various test issues for all tests (microsoft#208)
1 parent 4f7fe0c commit 34f572b

File tree

11 files changed

+218
-60
lines changed

11 files changed

+218
-60
lines changed

.github/workflows/build-validation.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,27 @@ jobs:
4646

4747
# TODO: Move the sidecar into a central image repository
4848
- name: Initialize Durable Task Sidecar
49-
run: docker run --name durabletask-sidecar -p 4001:4001 --env 'DURABLETASK_SIDECAR_LOGLEVEL=Debug' -d kaibocai/durabletask-sidecar:latest start --backend Emulator
49+
run: docker run --name durabletask-sidecar -p 4001:4001 --env 'DURABLETASK_SIDECAR_LOGLEVEL=Debug' -d peterstone2019/durabletask-sidecar:latest start --backend Emulator
50+
51+
- name: Display Durable Task Sidecar Logs
52+
run: nohup docker logs --since=0 durabletask-sidecar > durabletask-sidecar.log 2>&1 &
5053

5154
# 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
5255
- name: Wait for 10 seconds
5356
run: sleep 10
5457

5558
- name: Integration Tests with Gradle
56-
run: ./gradlew integrationTest
59+
run: ./gradlew integrationTest || echo "TEST_FAILED=true" >> $GITHUB_ENV
60+
continue-on-error: true
61+
62+
- name: Kill Durable Task Sidecar
63+
run: docker kill durabletask-sidecar
64+
65+
- name: Upload Durable Task Sidecar Logs
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: Durable Task Sidecar Logs
69+
path: durabletask-sidecar.log
5770

5871
- name: Archive test report
5972
uses: actions/upload-artifact@v4
@@ -67,6 +80,10 @@ jobs:
6780
name: Package
6881
path: client/build/libs
6982

83+
- name: Fail the job if tests failed
84+
if: env.TEST_FAILED == 'true'
85+
run: exit 1
86+
7087
functions-e2e-tests:
7188

7289
needs: build
@@ -124,7 +141,7 @@ jobs:
124141
uses: gradle/gradle-build-action@v2
125142

126143
- name: Publish to local
127-
run: ./gradlew publishToMavenLocal -x sign
144+
run: ./gradlew publishToMavenLocal
128145

129146
- name: Build azure functions sample
130147
run: ./gradlew azureFunctionsPackage

client/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ task integrationTest(type: Test) {
118118
dependsOn build
119119
shouldRunAfter test
120120
testLogging.showStandardStreams = true
121+
122+
ignoreFailures = false
121123
}
122124

123125
publishing {

client/src/test/java/com/microsoft/durabletask/ErrorHandlingIntegrationTests.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
import org.junit.jupiter.api.Test;
88
import org.junit.jupiter.params.ParameterizedTest;
99
import org.junit.jupiter.params.provider.ValueSource;
10+
import org.junit.jupiter.api.extension.ExtendWith;
1011

1112
import java.time.Duration;
1213
import java.util.concurrent.TimeoutException;
1314
import java.util.concurrent.atomic.AtomicBoolean;
1415
import java.util.concurrent.atomic.AtomicInteger;
1516

17+
import org.junit.jupiter.api.BeforeEach;
1618
import static org.junit.jupiter.api.Assertions.*;
1719

1820
/**
@@ -23,8 +25,15 @@
2325
* client operations and sends invocation instructions to the DurableTaskWorker).
2426
*/
2527
@Tag("integration")
28+
@ExtendWith(TestRetryExtension.class)
2629
public class ErrorHandlingIntegrationTests extends IntegrationTestBase {
27-
@Test
30+
@BeforeEach
31+
private void startUp() {
32+
DurableTaskClient client = new DurableTaskGrpcClientBuilder().build();
33+
client.deleteTaskHub();
34+
}
35+
36+
@RetryingTest
2837
void orchestratorException() throws TimeoutException {
2938
final String orchestratorName = "OrchestratorWithException";
3039
final String errorMessage = "Kah-BOOOOOM!!!";
@@ -50,7 +59,7 @@ void orchestratorException() throws TimeoutException {
5059
}
5160
}
5261

53-
@ParameterizedTest
62+
@RetryingParameterizedTest
5463
@ValueSource(booleans = {true, false})
5564
void activityException(boolean handleException) throws TimeoutException {
5665
final String orchestratorName = "OrchestratorWithActivityException";
@@ -102,7 +111,7 @@ void activityException(boolean handleException) throws TimeoutException {
102111
}
103112
}
104113

105-
@ParameterizedTest
114+
@RetryingParameterizedTest
106115
@ValueSource(ints = {1, 2, 10})
107116
public void retryActivityFailures(int maxNumberOfAttempts) throws TimeoutException {
108117
// There is one task for each activity call and one task between each retry
@@ -116,7 +125,7 @@ public void retryActivityFailures(int maxNumberOfAttempts) throws TimeoutExcepti
116125
});
117126
}
118127

119-
@ParameterizedTest
128+
@RetryingParameterizedTest
120129
@ValueSource(ints = {1, 2, 10})
121130
public void retryActivityFailuresWithCustomLogic(int maxNumberOfAttempts) throws TimeoutException {
122131
// This gets incremented every time the retry handler is invoked
@@ -133,7 +142,7 @@ public void retryActivityFailuresWithCustomLogic(int maxNumberOfAttempts) throws
133142
assertEquals(maxNumberOfAttempts, retryHandlerCalls.get());
134143
}
135144

136-
@ParameterizedTest
145+
@RetryingParameterizedTest
137146
@ValueSource(booleans = {true, false})
138147
void subOrchestrationException(boolean handleException) throws TimeoutException {
139148
final String orchestratorName = "OrchestrationWithBustedSubOrchestrator";
@@ -183,7 +192,7 @@ void subOrchestrationException(boolean handleException) throws TimeoutException
183192
}
184193
}
185194

186-
@ParameterizedTest
195+
@RetryingParameterizedTest
187196
@ValueSource(ints = {1, 2, 10})
188197
public void retrySubOrchestratorFailures(int maxNumberOfAttempts) throws TimeoutException {
189198
// There is one task for each sub-orchestrator call and one task between each retry
@@ -198,7 +207,7 @@ public void retrySubOrchestratorFailures(int maxNumberOfAttempts) throws Timeout
198207
});
199208
}
200209

201-
@ParameterizedTest
210+
@RetryingParameterizedTest
202211
@ValueSource(ints = {1, 2, 10})
203212
public void retrySubOrchestrationFailuresWithCustomLogic(int maxNumberOfAttempts) throws TimeoutException {
204213
// This gets incremented every time the retry handler is invoked

0 commit comments

Comments
 (0)