forked from safetrustcr/backend-SafeTrust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose-test.yml
More file actions
172 lines (163 loc) · 5.74 KB
/
Copy pathdocker-compose-test.yml
File metadata and controls
172 lines (163 loc) · 5.74 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
services:
postgres_test:
image: postgis/postgis:15-3.3
restart: always
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: postgrespassword
ports:
- "5434:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
start_period: 10s
networks:
- test-network
graphql-engine-test:
image: hasura/graphql-engine:v2.42.0
ports:
- "8081:8080"
restart: always
environment:
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres_test:5432/postgres
PG_DATABASE_URL: postgres://postgres:postgrespassword@postgres_test:5432/postgres
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
HASURA_GRAPHQL_DEV_MODE: "true"
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
HASURA_GRAPHQL_METADATA_DEFAULTS: '{"backend_configs":{"dataconnector":{"athena":{"uri":"http://data-connector-agent-test:8081/api/v1/athena"},"mariadb":{"uri":"http://data-connector-agent-test:8081/api/v1/mariadb"},"mysql8":{"uri":"http://data-connector-agent-test:8081/api/v1/mysql"},"oracle":{"uri":"http://data-connector-agent-test:8081/api/v1/oracle"},"snowflake":{"uri":"http://data-connector-agent-test:8081/api/v1/snowflake"}}}}'
depends_on:
postgres_test:
condition: service_healthy
data-connector-agent-test:
condition: service_healthy
networks:
- test-network
data-connector-agent-test:
image: hasura/graphql-data-connector:v2.42.0
restart: always
ports:
- "8082:8081"
environment:
QUARKUS_LOG_LEVEL: ERROR
QUARKUS_OPENTELEMETRY_ENABLED: "false"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081/api/v1/athena/health"]
interval: 5s
timeout: 10s
retries: 5
start_period: 5s
networks:
- test-network
hasura-cli-test:
build:
context: .
dockerfile: Dockerfile
tty: true
volumes:
- .:/app
environment:
HASURA_GRAPHQL_ENDPOINT: http://graphql-engine-test:8080
PG_DATABASE_URL: postgres://postgres:postgrespassword@postgres_test:5432/postgres
HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
working_dir: /app
command: hasura console --address 0.0.0.0 --console-port 9696
ports:
- "9696:9696"
depends_on:
graphql-engine-test:
condition: service_healthy
networks:
- test-network
webhook:
build:
context: .
dockerfile: webhook/Dockerfile
environment:
- NODE_ENV=test
- WEBHOOK_PORT=3001
- HASURA_GRAPHQL_ADMIN_SECRET=myadminsecretkey
- HASURA_GRAPHQL_ENDPOINT=http://graphql-engine-test:8080/v1/graphql
- POSTGRES_HOST=postgres_test
- POSTGRES_PORT=5432
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgrespassword
- USE_MOCK_DATA=true
- TRUSTLESSWORK_WEBHOOK_SECRET=dev-secret
depends_on:
postgres_test:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
interval: 5s
timeout: 5s
retries: 10
start_period: 5s
networks:
- test-network
karate:
build:
context: .
dockerfile: Dockerfile.test
environment:
baseUrl: http://graphql-engine-test:8080/v1/graphql
webhookUrl: http://webhook:3001
HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
JWT_SECRET: testsecret
TRUSTLESSWORK_WEBHOOK_SECRET: dev-secret
command: >
java -cp /app/tests/karate.jar:/app/tests/postgresql-jdbc.jar:/app/tests/karate/src/test/resources
com.intuit.karate.Main
--configdir /app/tests/karate/src/test/resources
--tags ~@ignore
tests/karate/features
volumes:
- ./tests/results:/app/target/karate-reports
- ./tests/results:/app/tests/results
depends_on:
postgres_test:
condition: service_healthy
webhook:
condition: service_healthy
migrate-test:
condition: service_completed_successfully
graphql-engine-test:
condition: service_started
networks:
- test-network
migrate-test:
build:
context: .
dockerfile: Dockerfile
environment:
HASURA_GRAPHQL_ENDPOINT: http://graphql-engine-test:8080
HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
working_dir: /app
command: >
sh -c "
until curl -s http://graphql-engine-test:8080/healthz; do echo 'Waiting for Hasura...'; sleep 2; done;
sleep 5;
curl -s -X POST http://graphql-engine-test:8080/v1/metadata -H 'X-Hasura-Admin-Secret: myadminsecretkey' -H 'Content-Type: application/json' -d '{\"type\": \"pg_add_source\", \"args\": {\"name\": \"safetrust\", \"configuration\": {\"connection_info\": { \"database_url\": \"postgres://postgres:postgrespassword@postgres_test:5432/postgres\", \"isolation_level\": \"read-committed\" } } } }';
sleep 2;
for i in 1 2 3 4 5; do hasura migrate apply --database-name safetrust --endpoint http://graphql-engine-test:8080 --admin-secret myadminsecretkey && break || sleep 5; done;
case $$(uname -m) in
aarch64|arm64) ARCH=arm64 ;;
*) ARCH=amd64 ;;
esac;
curl -L https://github.com/mikefarah/yq/releases/latest/download/yq_linux_$$ARCH -o /usr/local/bin/yq && chmod +x /usr/local/bin/yq;
cd metadata && ./setup-tenant.sh safetrust --endpoint http://graphql-engine-test:8080 --admin-secret myadminsecretkey
"
depends_on:
graphql-engine-test:
condition: service_started
networks:
- test-network
volumes:
db_data:
networks:
test-network:
driver: bridge