Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/actions/integration-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ inputs:
maven-version:
description: The Maven version the build shall run with.
required: true
malware-scan-timeout:
description: Timeout for waiting on async malware scan completion (ISO-8601 duration, e.g. PT120S).
required: false
default: PT1M
Comment thread
holgpar marked this conversation as resolved.

runs:
using: composite
Expand All @@ -29,7 +33,18 @@ runs:
shell: bash

- name: Generic Integration Tests
run: mvn clean verify -ntp -B -f integration-tests/pom.xml -pl :cds-feature-attachments-integration-tests-parent,:cds-feature-attachments-integration-tests-db,:cds-feature-attachments-integration-tests-generic -Dcds.install-node.skip
env:
MALWARE_SCAN_TIMEOUT: ${{ inputs.malware-scan-timeout }}
# Tests relying on the malware scan service are flaky.
# Therefore, we retry failed tests as a mitigation.
RERUN_FAILING_TESTS_COUNT: "2"
run: |
mvn clean verify -ntp -B \
-f integration-tests/pom.xml \
-pl :cds-feature-attachments-integration-tests-parent,:cds-feature-attachments-integration-tests-db,:cds-feature-attachments-integration-tests-generic \
-Dcds.install-node.skip \
-Dtest.malware-scan.timeout="${MALWARE_SCAN_TIMEOUT}" \
-Dsurefire.rerunFailingTestsCount="${RERUN_FAILING_TESTS_COUNT}"
Comment thread
holgpar marked this conversation as resolved.
Comment thread
holgpar marked this conversation as resolved.
shell: bash

- name: MTX-Local Integration Tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.concurrent.TimeUnit;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.webmvc.test.autoconfigure.AutoConfigureMockMvc;
import org.springframework.http.HttpStatus;
Expand All @@ -55,6 +57,9 @@ abstract class DraftOdataRequestValidationBase {
@Autowired private TableDataDeleter dataDeleter;
@Autowired private TestPersistenceHandler testPersistenceHandler;

@Value("${test.malware-scan.timeout:PT60S}")
private Duration malwareScanTimeout;

@AfterEach
void teardown() {
dataDeleter.deleteData(
Expand Down Expand Up @@ -122,7 +127,7 @@ void contentCanBeReadFromDraft() throws Exception {
+ "/content";

Awaitility.await()
.atMost(60, TimeUnit.SECONDS)
.atMost(malwareScanTimeout)
.pollDelay(1, TimeUnit.SECONDS)
.pollInterval(2, TimeUnit.SECONDS)
.until(
Expand Down Expand Up @@ -796,7 +801,7 @@ protected void readAndValidateActiveContent(
+ "/content";

Awaitility.await()
.atMost(60, TimeUnit.SECONDS)
.atMost(malwareScanTimeout)
.pollDelay(1, TimeUnit.SECONDS)
.pollInterval(2, TimeUnit.SECONDS)
.until(
Expand All @@ -807,19 +812,19 @@ protected void readAndValidateActiveContent(
var attachmentEntityContentAsString =
attachmentEntityResponse.getResponse().getContentAsString();

var booleanResult =
var contentMatchesExpectation =
attachmentContentAsString.equals(attachmentContent)
&& attachmentEntityContentAsString.equals(attachmentEntityContent);

if (!booleanResult) {
if (!contentMatchesExpectation) {
logger.info(
"Attachment response content: {}, Attachment Test Content: {}, Attachment Entity response content: {}, Attachment Entity Test Content: {}",
attachmentContentAsString,
attachmentContent,
attachmentEntityContentAsString,
attachmentEntityContent);
}
return booleanResult;
return contentMatchesExpectation;
});
clearServiceHandlerContext();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ cds:
csv:
paths: "../db/src/gen/csv"

test:
malware-scan:
timeout: PT60S

---
spring:
config:
Expand Down
Loading