diff --git a/.circleci/config.yml b/.circleci/config.yml index ae131f7cda..9215d0f886 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,8 +2,8 @@ version: 2.1 jobs: build: working_directory: ~/cwa-server - docker: - - image: circleci/openjdk:11-jdk + machine: + image: ubuntu-1604:202004-01 steps: - checkout - run: @@ -15,6 +15,12 @@ jobs: - restore_cache: key: cwa-server-{{ checksum "~/pom-checksum" }} - run: mvn --batch-mode dependency:go-offline + - run: + name: Update to OpenJDK 11 + command: | + sudo apt-get install openjdk-11-jre + sudo update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java + java -version - run: name: Analyze on SonarCloud command: mvn --batch-mode verify sonar:sonar --fail-never @@ -22,7 +28,12 @@ jobs: paths: - ~/.m2 key: cwa-server-{{ checksum "~/pom-checksum" }} - - run: mvn --batch-mode package + - run: + name: Run all tests on Docker + command: | + docker-compose -f docker-compose-it.yaml up -d objectstore + docker-compose -f docker-compose-it.yaml up -d create-bucket + docker-compose -f docker-compose-it.yaml run run-tests - run: name: Save test results command: | diff --git a/docker-compose-it.yaml b/docker-compose-it.yaml new file mode 100644 index 0000000000..c86c54a7d0 --- /dev/null +++ b/docker-compose-it.yaml @@ -0,0 +1,41 @@ +version: '3' +services: + objectstore: + image: "zenko/cloudserver" + volumes: + - objectstore_volume:/data + ports: + - "8003:8000" + environment: + ENDPOINT: objectstore + REMOTE_MANAGEMENT_DISABLE: 1 + SCALITY_ACCESS_KEY_ID: ${OBJECTSTORE_ACCESSKEY} + SCALITY_SECRET_ACCESS_KEY: ${OBJECTSTORE_SECRETKEY} + create-bucket: + image: amazon/aws-cli + environment: + - AWS_ACCESS_KEY_ID=${OBJECTSTORE_ACCESSKEY} + - AWS_SECRET_ACCESS_KEY=${OBJECTSTORE_SECRETKEY} + entrypoint: ["/root/scripts/wait-for-it/wait-for-it.sh", "objectstore:8000", "-t", "30", "--"] + volumes: + - ./scripts/wait-for-it:/root/scripts/wait-for-it + command: aws s3api create-bucket --bucket cwa --endpoint-url http://objectstore:8000 --acl public-read + depends_on: + - objectstore + run-tests: + stop_signal: SIGKILL + working_dir: $PWD + environment: + - CWA_OBJECTSTORE_ENDPOINT=http://objectstore + - CWA_OBJECTSTORE_PORT=8000 + depends_on: + - objectstore + - create-bucket + image: maven:3.6.3-jdk-11 + command: mvn failsafe:integration-test --batch-mode package + volumes: + - $PWD:$PWD + - /var/run/docker.sock:/var/run/docker.sock + - ~/.m2:/root/.m2 +volumes: + objectstore_volume: diff --git a/services/distribution/pom.xml b/services/distribution/pom.xml index 3d15e8bde2..95325196aa 100644 --- a/services/distribution/pom.xml +++ b/services/distribution/pom.xml @@ -17,6 +17,18 @@ + + maven-failsafe-plugin + 3.0.0-M4 + + + + integration-test + verify + + + + org.apache.maven.plugins maven-surefire-plugin diff --git a/services/distribution/src/test/java/app/coronawarn/server/services/distribution/objectstore/ObjectStoreAccessTest.java b/services/distribution/src/test/java/app/coronawarn/server/services/distribution/objectstore/ObjectStoreAccessIT.java similarity index 99% rename from services/distribution/src/test/java/app/coronawarn/server/services/distribution/objectstore/ObjectStoreAccessTest.java rename to services/distribution/src/test/java/app/coronawarn/server/services/distribution/objectstore/ObjectStoreAccessIT.java index a1b5b67d76..f34ef9f749 100644 --- a/services/distribution/src/test/java/app/coronawarn/server/services/distribution/objectstore/ObjectStoreAccessTest.java +++ b/services/distribution/src/test/java/app/coronawarn/server/services/distribution/objectstore/ObjectStoreAccessIT.java @@ -48,7 +48,7 @@ @SpringBootTest(classes = {ObjectStoreAccess.class, ObjectStorePublishingConfig.class}) @EnableConfigurationProperties(value = DistributionServiceConfig.class) @Tag("s3-integration") -class ObjectStoreAccessTest { +class ObjectStoreAccessIT { private static final String testRunId = "testing/cwa/" + UUID.randomUUID().toString() + "/"; private static final String rootTestFolder = "objectstore/"; diff --git a/services/distribution/src/test/java/app/coronawarn/server/services/distribution/objectstore/S3PublisherIntegrationTest.java b/services/distribution/src/test/java/app/coronawarn/server/services/distribution/objectstore/S3PublisherIT.java similarity index 98% rename from services/distribution/src/test/java/app/coronawarn/server/services/distribution/objectstore/S3PublisherIntegrationTest.java rename to services/distribution/src/test/java/app/coronawarn/server/services/distribution/objectstore/S3PublisherIT.java index 0b9687bcd1..78a22de837 100644 --- a/services/distribution/src/test/java/app/coronawarn/server/services/distribution/objectstore/S3PublisherIntegrationTest.java +++ b/services/distribution/src/test/java/app/coronawarn/server/services/distribution/objectstore/S3PublisherIT.java @@ -44,7 +44,7 @@ @SpringBootTest(classes = {ObjectStoreAccess.class, ObjectStorePublishingConfig.class, S3Publisher.class}) @EnableConfigurationProperties(value = DistributionServiceConfig.class) @Tag("s3-integration") -class S3PublisherIntegrationTest { +class S3PublisherIT { private final String rootTestFolder = "objectstore/publisher/";