Skip to content

Commit 92d6e87

Browse files
authored
Merge pull request #9 from BSStudio/maintenance/integration-test-refactor
Maintenance: Integration test refactor
2 parents 05f2ae3 + 34608a0 commit 92d6e87

5 files changed

Lines changed: 42 additions & 25 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- checkout
2727
- setup_remote_docker:
2828
version: 19.03.13
29-
- run: docker-compose up --build --abort-on-container-exit
29+
- run: docker-compose -f ./docker-compose.test.yaml up --build --abort-on-container-exit
3030
workflows:
3131
version: 2
3232
build_and_test:

application/src/main/resources/application-ci.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

docker-compose.test.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: "3.8"
2+
services:
3+
app:
4+
build:
5+
context: ./
6+
dockerfile: Dockerfile
7+
environment:
8+
robonauth.api-key: BSS
9+
spring.data.mongodb.host: mongo
10+
spring.rabbitmq.host: rabbit-mq
11+
ports:
12+
- 8080:8080
13+
rabbit-mq:
14+
image: rabbitmq:management-alpine
15+
ports:
16+
- 5672:5672
17+
- 8081:15672
18+
mongo:
19+
image: mongo:4.4.2-bionic
20+
ports:
21+
- 27017:27017
22+
integration-test:
23+
build:
24+
context: ./integration
25+
dockerfile: Dockerfile
26+
command: dockerize -wait tcp://mongo:27017 -wait tcp://app:8080 -wait tcp://rabbit-mq:5672 -timeout 10m sh -c "sleep 1m && yarn test"
27+
environment:
28+
HOST_NAME: http://app:8080
29+
DB_HOST: mongodb://mongo:27017/
30+
AMQP_HOST: amqp://rabbit-mq
31+
depends_on:
32+
- rabbit-mq
33+
- app
34+
- mongo

docker-compose.yaml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,3 @@ services:
1919
image: mongo:4.4.2-bionic
2020
ports:
2121
- 27017:27017
22-
integration-test:
23-
build:
24-
context: ./integration
25-
dockerfile: Dockerfile
26-
command: dockerize -wait tcp://mongo:27017 -wait tcp://app:8080 -wait tcp://rabbit-mq:5672 -timeout 10m sh -c "sleep 1m && yarn test"
27-
environment:
28-
HOST_NAME: http://app:8080
29-
DB_HOST: mongodb://mongo:27017/
30-
AMQP_HOST: amqp://rabbit-mq
31-
depends_on:
32-
- rabbit-mq
33-
- app
34-
- mongo

integration/test/race.test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ describe('Test a happy path of events', () => {
306306
purgeQueue('speed.safetyCar.overtake'),
307307
purgeQueue('speed.timer'),
308308
purgeQueue('team.teamData')
309-
])
309+
]);
310310
});
311311
it('should contain no teams in the start', () => {
312312
return request(HOST)
@@ -326,7 +326,7 @@ describe('Test a happy path of events', () => {
326326
expect(response.status).toBe(200)
327327
expect(response.body).toStrictEqual(createdTeam)
328328
})
329-
.then(_ => assertQueue('team.teamData', createdTeam))
329+
.then(_ => assertQueue('team.teamData', createdTeam));
330330
});
331331
it('should display the new team', () => {
332332
return request(HOST)
@@ -368,7 +368,7 @@ describe('Test a happy path of events', () => {
368368
expect(response.status).toBe(200)
369369
expect(response.body).toStrictEqual(skillTimerStart)
370370
})
371-
.then(_ => assertQueue('skill.timer', skillTimerStart))
371+
.then(_ => assertQueue('skill.timer', skillTimerStart));
372372
});
373373
it('should stop the skill timer', () => {
374374
return request(HOST)
@@ -379,7 +379,7 @@ describe('Test a happy path of events', () => {
379379
expect(response.status).toBe(200)
380380
expect(response.body).toStrictEqual(skillTimerStop)
381381
})
382-
.then(_ => assertQueue('skill.timer', skillTimerStop))
382+
.then(_ => assertQueue('skill.timer', skillTimerStop));
383383
});
384384
it('should update team on gate enter', () => {
385385
return request(HOST)
@@ -448,7 +448,7 @@ describe('Test a happy path of events', () => {
448448
expect(response.status).toBe(200)
449449
expect(response.body).toStrictEqual(speedTimerStop)
450450
})
451-
.then(_ => assertQueue('speed.timer', speedTimerStop))
451+
.then(_ => assertQueue('speed.timer', speedTimerStop));
452452
});
453453
it('should update team after lap is completed', () => {
454454
return request(HOST)
@@ -507,6 +507,6 @@ describe('Test a happy path of events', () => {
507507
.then(_ => assertQueue('team.teamData', updatedTeamAfterEndResults));
508508
});
509509
afterAll(() => {
510-
return cleanDB()
510+
return cleanDB();
511511
});
512-
});
512+
});

0 commit comments

Comments
 (0)