-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.integration-test.yml
More file actions
147 lines (141 loc) · 4.37 KB
/
docker-compose.integration-test.yml
File metadata and controls
147 lines (141 loc) · 4.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
services:
mongo_test:
image: mongo:6.0
container_name: forms-submission-api-mongo-test
command: ['--replSet', 'rs0', '--bind_ip_all', '--port', '27017']
ports:
- '27018:27017'
volumes:
- mongo_test_data:/data/db
healthcheck:
test: echo "try { rs.status() } catch (err) { rs.initiate({_id:'rs0',members:[{_id:0,host:'mongo_test:27017'}]}) }" | mongosh --port 27017 --quiet
interval: 5s
timeout: 30s
start_period: 10s
retries: 12
environment:
MONGO_INITDB_DATABASE: forms-submission-api-test
networks:
- forms_test_net
localstack_test:
image: localstack/localstack:3.0.2
container_name: localstack-test
ports:
- '4567:4566'
environment:
DEBUG: ${DEBUG:-0}
LS_LOG: WARN
SERVICES: s3,sqs,sns
LOCALSTACK_HOST: 0.0.0.0
AWS_DEFAULT_REGION: us-east-1
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
volumes:
- '/tmp/localstack-test:/var/lib/localstack'
- './test/integration/init-localstack.sh:/etc/localstack/init/ready.d/init-localstack.sh'
healthcheck:
test: ['CMD', 'curl', 'localhost:4566']
interval: 5s
start_period: 10s
retries: 6
networks:
- forms_test_net
oidc:
image: ghcr.io/soluto/oidc-server-mock:0.6.0
container_name: oidc-mock-test
ports:
- '5556:80'
environment:
ISSUER: http://oidc:80
PORT: 80
USERS_CONFIGURATION_PATH: /data/users.yml
CLIENTS_CONFIGURATION_PATH: /data/clients.yml
API_SCOPES_INLINE: |
- Name: "newman-test-client"
API_RESOURCES_INLINE: |
- Name: "newman-test-client"
DisplayName: "Forms Submission API Test Resource"
Scopes: ["newman-test-client"]
UserClaims: ["oid", "groups", "email", "name", "preferred_username", "email_verified"]
SERVER_OPTIONS_INLINE: |
{
"IssuerUri": "http://oidc:80",
"AccessTokenJwtType": "JWT",
"Discovery": {
"ShowKeySet": true
},
"Events": { "RaiseErrorEvents": true, "RaiseSuccessEvents": true, "RaiseInformationEvents": true }
}
volumes:
- ./test/integration/postman/oidc-config:/data:ro
networks:
- forms_test_net
healthcheck:
test:
[
'CMD-SHELL',
'wget -q --spider http://localhost:80/.well-known/openid-configuration || exit 1'
]
interval: 10s
timeout: 10s
retries: 12
start_period: 60s
app_test:
build:
context: .
target: production
container_name: forms-submission-api-app-test
ports:
- '3002:3002'
environment:
MONGO_URI: mongodb://mongo_test:27017/forms-submission-api-test?replicaSet=rs0&directConnection=true
PORT: 3002
NODE_ENV: production
OIDC_JWKS_URI: 'http://oidc:80/.well-known/openid-configuration/jwks'
OIDC_VERIFY_AUD: 'newman-test-client'
OIDC_VERIFY_ISS: 'http://oidc:80'
# Mock S3 configuration for testing
AWS_ACCESS_KEY_ID: 'test'
AWS_SECRET_ACCESS_KEY: 'test'
AWS_REGION: 'us-east-1'
S3_BUCKET: 'test-forms-submission-bucket'
S3_ENDPOINT: 'http://localstack_test:4566'
LOADED_PREFIX: 'loaded'
DESIGNER_URL: 'http://localhost:3000'
MANAGER_URL: 'http://localhost:3001'
NOTIFY_API_KEY: 'dummy'
NOTIFY_REPLY_TO_ID: 'dummy'
NOTIFY_TEMPLATE_ID: 'dummy'
depends_on:
mongo_test:
condition: service_healthy
localstack_test:
condition: service_healthy
oidc:
condition: service_started
command: ['npm', 'start', '--ignore-scripts']
networks:
- forms_test_net
newman:
image: postman/newman:latest
container_name: forms-submission-api-newman-test
environment:
NEWMAN_TOKEN_URL: 'http://oidc:80/connect/token'
NEWMAN_USERNAME: 'newman-service-account'
NEWMAN_PASSWORD: 'newman-mock-password'
NEWMAN_CLIENT_ID: 'newman-test-client'
NEWMAN_CLIENT_SECRET: 'newman-mock-secret'
NEWMAN_SCOPE: 'openid profile email newman-test-client'
NEWMAN_TEST_EMAIL: 'test.email@defra.gov.uk'
API_URL: 'http://app_test:3002'
volumes:
- ./test/integration/postman:/etc/newman
- ./newman-reports:/etc/newman/reports
depends_on:
- app_test
networks:
- forms_test_net
volumes:
mongo_test_data:
networks:
forms_test_net: