Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Integration Testing on CircleCI #580

Merged
merged 5 commits into from
Jun 30, 2020
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: 14 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -15,14 +15,25 @@ 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
- save_cache:
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: |
Expand Down
41 changes: 41 additions & 0 deletions docker-compose-it.yaml
Original file line number Diff line number Diff line change
@@ -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:
12 changes: 12 additions & 0 deletions services/distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M4</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/";

Expand Down