Skip to content

Commit dab1548

Browse files
fix: increase timeout to avoid flakiness [skip ci]
1 parent 20088ab commit dab1548

File tree

4 files changed

+39
-8
lines changed

4 files changed

+39
-8
lines changed

.github/workflows/verify.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
uses: ./.github/actions/run-tests
7575
with:
7676
command: |
77-
./gradlew test -DincludeTags="AzureStorageIntegrationTest"
77+
./gradlew test -DincludeTags="AzureStorageIntegrationTest" --refresh-dependencies
7878
7979
8080
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Apache License, Version 2.0 which is available at
6+
* https://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* SPDX-License-Identifier: Apache-2.0
9+
*
10+
* Contributors:
11+
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation
12+
*
13+
*/
14+
15+
package org.eclipse.edc.test.system.utils;
16+
17+
import java.time.Duration;
18+
19+
public interface Constants {
20+
Duration POLL_INTERVAL = Duration.ofSeconds(2);
21+
Duration TIMEOUT = Duration.ofMinutes(1);
22+
}

system-tests/tests/src/testFixtures/java/org/eclipse/edc/test/system/utils/TransferTestClient.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
import static org.eclipse.edc.spi.CoreConstants.EDC_NAMESPACE;
4646
import static org.eclipse.edc.spi.CoreConstants.EDC_PREFIX;
4747
import static org.eclipse.edc.test.system.local.TransferRuntimeConfiguration.CONSUMER_PARTICIPANT_ID;
48+
import static org.eclipse.edc.test.system.utils.Constants.POLL_INTERVAL;
49+
import static org.eclipse.edc.test.system.utils.Constants.TIMEOUT;
4850
import static org.hamcrest.Matchers.is;
4951

5052
/**
@@ -74,7 +76,7 @@ public JsonArray getCatalogDatasets(String providerUrl) {
7476
.add("protocol", "dataspace-protocol-http")
7577
.build();
7678

77-
await().untilAsserted(() -> {
79+
await().atMost(TIMEOUT).pollInterval(POLL_INTERVAL).untilAsserted(() -> {
7880
var response = givenConsumerRequest()
7981
.contentType(JSON)
8082
.when()
@@ -132,7 +134,7 @@ public String negotiateContract(String providerId, String providerUrl, String of
132134
.statusCode(200)
133135
.extract().body().jsonPath().getString(ID);
134136

135-
await().untilAsserted(() -> {
137+
await().atMost(TIMEOUT).pollInterval(POLL_INTERVAL).untilAsserted(() -> {
136138
var state = getContractNegotiationState(negotiationId);
137139
assertThat(state).isEqualTo(FINALIZED.name());
138140
});
@@ -143,7 +145,7 @@ public String negotiateContract(String providerId, String providerUrl, String of
143145
public String getContractAgreementId(String negotiationId) {
144146
var contractAgreementId = new AtomicReference<String>();
145147

146-
await().untilAsserted(() -> {
148+
await().atMost(TIMEOUT).pollInterval(POLL_INTERVAL).untilAsserted(() -> {
147149
var agreementId = getContractNegotiationField(negotiationId, "contractAgreementId");
148150
assertThat(agreementId).isNotNull().isInstanceOf(String.class);
149151

system-tests/tests/src/testFixtures/java/org/eclipse/edc/test/system/utils/TransferTestRunner.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@
1414

1515
package org.eclipse.edc.test.system.utils;
1616

17+
import org.eclipse.edc.connector.transfer.spi.types.TransferProcessStates;
18+
1719
import static org.assertj.core.api.Assertions.assertThat;
1820
import static org.awaitility.Awaitility.await;
1921
import static org.eclipse.edc.connector.transfer.spi.types.TransferProcessStates.STARTED;
2022
import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.ODRL_POLICY_ATTRIBUTE;
2123
import static org.eclipse.edc.test.system.local.TransferRuntimeConfiguration.PROVIDER_ASSET_ID;
2224
import static org.eclipse.edc.test.system.local.TransferRuntimeConfiguration.PROVIDER_PARTICIPANT_ID;
25+
import static org.eclipse.edc.test.system.utils.Constants.POLL_INTERVAL;
26+
import static org.eclipse.edc.test.system.utils.Constants.TIMEOUT;
2327
import static org.eclipse.edc.test.system.utils.TransferTestClient.getContractId;
2428

2529
/**
@@ -46,10 +50,13 @@ public void executeTransfer() {
4650
var destination = configuration.createBlobDestination();
4751
var transferProcessId = client.initiateTransfer(contractAgreementId, PROVIDER_ASSET_ID, configuration.getProviderIdsUrl(), destination);
4852

49-
await().untilAsserted(() -> {
50-
var state = client.getTransferProcessState(transferProcessId);
51-
assertThat(state).isEqualTo(STARTED.name());
52-
});
53+
await().pollInterval(POLL_INTERVAL)
54+
.atMost(TIMEOUT)
55+
.untilAsserted(() -> {
56+
var state = client.getTransferProcessState(transferProcessId);
57+
// should be STARTED or some state after that to make it more robust.
58+
assertThat(TransferProcessStates.valueOf(state).code()).isGreaterThanOrEqualTo(STARTED.code());
59+
});
5360

5461
var transferProcess = client.getTransferProcess(transferProcessId);
5562
assertThat(configuration.isTransferResultValid(transferProcess)).isTrue();

0 commit comments

Comments
 (0)