Skip to content

Commit 9f85c77

Browse files
committed
Fixed #57 - moved OrderHistoryDaoDynamoDbTest to integration-test + Docker Compose configuration to run DynamoDBLocal
1 parent bb766a7 commit 9f85c77

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

dynamodblocal-init/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ COPY create-dynamodb-tables.sh .
44
COPY ftgo-order-history.json .
55
COPY wait-for-dynamodblocal.sh .
66
RUN chmod +x *.sh
7+
HEALTHCHECK --interval=10s --retries=10 --timeout=3s CMD [[ -f /tables-created ]]
8+
79
CMD ./wait-for-dynamodblocal.sh && ./create-dynamodb-tables.sh

dynamodblocal-init/create-dynamodb-tables.sh

+7
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,10 @@ echo creating table
1010
aws dynamodb $* create-table --region us-west-2 --endpoint-url ${AWS_DYNAMODB_ENDPOINT_URL?} --cli-input-json file://ftgo-order-history.json
1111

1212
fi
13+
14+
touch /tables-created
15+
16+
while [[ true ]] ; do
17+
echo sleeping...
18+
sleep 3600
19+
done

dynamodblocal/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
FROM amazon/dynamodb-local:1.11.477
22
ENTRYPOINT java -jar DynamoDBLocal.jar -inMemory -sharedDb -port 8000
3+
HEALTHCHECK --start-period=5s --interval=5s CMD curl http://localhost:8000 || exit 1

ftgo-order-history-service/build.gradle

+20
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ buildscript {
33
dependencies {
44
classpath "io.spring.gradle:dependency-management-plugin:$springDependencyManagementPluginVersion"
55
classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:$springCloudContractDependenciesVersion"
6+
classpath "com.avast.gradle:gradle-docker-compose-plugin:$dockerComposePluginVersion"
67
}
78
repositories {
89
mavenCentral()
@@ -13,6 +14,8 @@ buildscript {
1314
apply plugin: FtgoServicePlugin
1415
apply plugin: "io.spring.dependency-management"
1516
apply plugin: 'spring-cloud-contract'
17+
apply plugin: IntegrationTestsPlugin
18+
apply plugin: 'docker-compose'
1619

1720
dependencyManagement {
1821
imports {
@@ -53,3 +56,20 @@ dependencies {
5356

5457

5558
}
59+
60+
dockerCompose {
61+
62+
startedServices = ['not-used']
63+
64+
integrationTests {
65+
if (System.getenv("FTGO_DOCKER_COMPOSE_FILES") != null)
66+
useComposeFiles = System.getenv("FTGO_DOCKER_COMPOSE_FILES").split(",").collect { "../" + it }
67+
68+
startedServices = ['dynamodblocal', 'dynamodblocal-init']
69+
stopContainers = true
70+
}
71+
}
72+
73+
integrationTest.dependsOn(integrationTestsComposeUp)
74+
75+

0 commit comments

Comments
 (0)