forked from wikimedia/restbase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.fullstack.test.yaml
300 lines (285 loc) · 10.7 KB
/
config.fullstack.test.yaml
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# Hacky way to parametrize RESTBase tests. TODO: Move to config?
test:
parsoid: &parsoid_test_options
disabled_storage:
default: false
# eswiki beta has parsoid storage disabled for testing purposes
es.wikipedia.beta.wmflabs.org: true
host: https://en.wikipedia.beta.wmflabs.org/w/rest.php
content_types:
html: '/^text\/html; charset=utf-8; profile="https:\/\/www\.mediawiki\.org\/wiki\/Specs\/HTML\/[\d.]+"$/'
data-parsoid: '/^application\/json; charset=utf-8; profile="https:\/\/www\.mediawiki\.org\/wiki\/Specs\/data-parsoid/[\d.]+"$/'
wikitext: '/^text\/plain; charset=utf-8; profile="https:\/\/www.mediawiki.org\/wiki\/Specs\/wikitext\/[\d.]+"$/'
default_project: &default_project
x-modules:
- spec:
paths:
/{api:v1}:
x-modules:
- path: projects/v1/default.wmf.yaml
options: &default_options
parsoid:
<<: *parsoid_test_options
grace_ttl: 1000000
action:
apiUriTemplate: "{{'https://{domain}/w/api.php'}}"
baseUriTemplate: "{{'https://{domain}/api/rest_v1'}}"
mathoid: &mathoid_options
host: https://mathoid-beta-svc.wmcloud.org
# 10 days Varnish caching, one day client-side
cache-control: s-maxage=864000, max-age=86400
mobileapps:
host: https://mobileapps.wmcloud.org
cache_control: test_mobileapps_cache_control
wikifeeds:
host: https://wikifeeds-beta.wmflabs.org
summary:
protocol: https
implementation: mcs
host: https://mobileapps.wmcloud.org
citoid:
host: https://citoid-beta.wmflabs.org
recommendation:
host: https://recommendation-api-beta.wmflabs.org
purged_cache_control: test_purged_cache_control
# Cache control for purged endpoints allowing short-term client caching
purged_cache_control_client_cache: test_purged_cache_control_with_client_caching
pdf:
# Cache PDF for 10 minutes since it's not purged
cache_control: s-maxage=600, max-age=600
uri: https://proton-beta.wmflabs.org
transform:
cx_host: https://cxserver-beta.wmflabs.org
skip_updates: false
- path: projects/proxy.yaml
options: &proxy_options
backend_host_template: '{{"/{domain}/sys/legacy"}}'
block_external_reqs: true
/{api:sys}: &default_sys
x-modules:
- path: projects/sys/default.wmf.yaml
options: *default_options
- path: projects/proxy.yaml
options:
<<: *proxy_options
block_external_reqs: false
- spec:
paths:
/legacy/key_value:
x-modules:
- path: sys/key_value.js
/legacy/page_revisions:
x-modules:
- path: sys/page_revisions.js
/table: &table_spec
x-modules:
- path: sys/table.js
options:
conf:
backend: '{env(RB_TEST_BACKEND, sqlite)}'
hosts: [localhost]
keyspace: system
username: cassandra
password: cassandra
defaultConsistency: one # or 'localQuorum' for production
storage_groups:
- name: test.group.local
domains: /./
# ignored in cassandra, but useful in SQLite testing
dbname: '{env(RB_SQLITE_FILE, test.db.sqlite3)}'
wikimedia_project: &wikimedia_project
x-modules:
- spec:
paths:
/{api:v1}:
x-modules:
- path: projects/v1/wikimedia.wmf.yaml
options:
<<: *default_options
- path: projects/proxy.yaml
options: *proxy_options
/{api:sys}:
x-modules:
- path: projects/proxy.yaml
options:
<<: *proxy_options
block_external_reqs: false
- spec:
paths:
/legacy/key_value:
x-modules:
- path: sys/key_value.js
/table: *table_spec
/mathoid:
x-modules:
- path: sys/mathoid.js
options: *mathoid_options
/post_data:
x-modules:
- path: sys/post_data.js
/events:
x-modules:
- path: sys/events.js
# No options provided deliberately to avoid log noise upon testing
wikipedia_project: &wikipedia_project
x-modules:
- spec:
paths:
/{api:v1}:
x-modules:
- path: projects/v1/wikipedia.wmf.yaml
options: *default_options
- path: projects/proxy.yaml
options: *proxy_options
/{api:sys}: *default_sys
/sys_passthrough/{+syspath}:
get:
x-request-handler:
- passthrough_sys:
request:
method: get
uri: /{domain}/sys/{+syspath}
return:
status: 200
headers: '{{passthrough_sys.headers}}'
body: '{{passthrough_sys.body}}'
wikipedia_project_no_storage: &wikipedia_project_no_storage
x-modules:
- spec:
paths:
/{api:v1}:
x-modules:
- path: projects/v1/wikipedia.wmf.yaml
options:
<<: *default_options
disabled_storage: true
- path: projects/proxy.yaml
options: *proxy_options
/{api:sys}: *default_sys
wiktionary_project: &wiktionary_project
x-modules:
- spec:
paths:
/{api:v1}:
x-modules:
- path: projects/v1/wiktionary.wmf.yaml
options: *default_options
- path: projects/proxy.yaml
options: *proxy_options
/{api:sys}: *default_sys
commons_project: &commons_project
x-modules:
- spec:
paths:
/{api:v1}:
x-modules:
- path: projects/v1/default.wmf.yaml
options: *default_options
- spec:
paths:
/data:
x-modules:
- path: v1/recommend-caption.yaml
options: '{{options.recommendation}}'
options: *default_options
- path: projects/proxy.yaml
options: *proxy_options
/{api:sys}: *default_sys
wikidata_project: &wikidata_project
x-modules:
- spec:
paths:
/{api:v1}:
x-modules:
- path: projects/v1/wikidata.wmf.yaml
options: *default_options
- path: projects/proxy.yaml
options: *proxy_options
/{api:sys}: *default_sys
testing_project: &testing_project
x-modules:
- spec:
paths:
/{api:v1}:
x-modules:
- path: test/test_module.yaml
options:
events:
uri: http://127.0.0.1:8085/v1/events
stream: resource_change
transcludes_stream: change-prop.transcludes.resource-change
- path: projects/proxy.yaml
options: *proxy_options
/{api:sys}: *default_sys
# The root of the spec tree. Domains tend to share specs by referencing them
# using YAML references.
spec_root: &spec_root
title: "The RESTBase root"
# Some more general RESTBase info
x-request-filters:
- path: lib/security_response_header_filter.js
x-sub-request-filters:
- type: default
name: http
options:
allow:
- pattern: /^https?:\/\/[a-zA-Z0-9.-]+\/w\/api\.php/
forward_headers: true
- pattern: /^https?:\/\/[a-zA-Z0-9.-]+\/w\/rest\.php.+/
forward_headers: true
- pattern: /^https?:\/\//
paths:
/{domain:commons.wikimedia.beta.wmflabs.org}: *commons_project
# The order is important for tests.
# Redirect tests require en.wiki being not the first wiki in the list.
/{domain:en.wikipedia.beta.wmflabs.org}: *wikipedia_project
# Used for testing parsoid storage flag
/{domain:es.wikipedia.beta.wmflabs.org}: *wikipedia_project
# For testing purpose lets run de-beta with storage disabled
/{domain:de.wikipedia.beta.wmflabs.org}: *wikipedia_project_no_storage
/{domain:zh.wikipedia.beta.wmflabs.org}: *wikipedia_project
/{domain:wikidata.beta.wmflabs.org}: *wikidata_project
# Serbian wiki in beta for language variants tests
/{domain:sr.wikipedia.beta.wmflabs.org}: *wikipedia_project
# For security testing we rely on mocks, so it's OK to use Russian wiki.
/{domain:ru.wikipedia.beta.wmflabs.org}:
<<: *wikipedia_project
x-route-filters:
- path: ./lib/mediawiki_auth_filter.js
options:
permissions:
- read
# global domain
/{domain:wikimedia.org}: *wikimedia_project
# Wiktionary has some specific endpoints
/{domain:en.wiktionary.beta.wmflabs.org}: *wiktionary_project
# Fake domain to run tests relying on test_module
/{domain:fake.fakepedia.org}: *testing_project
# Finally, a standard service-runner config.
info:
name: restbase
services:
- name: restbase
module: hyperswitch
conf: &rb_conf
# In production we expose both 7231 and 7233 ports from fullstack RB.
port: 7233
spec: *spec_root
salt: secret
default_page_size: 1
user_agent: RESTBase-testsuite
ui_name: RESTBase
ui_url: https://www.mediawiki.org/wiki/RESTBase
ui_title: RESTBase docs
logging:
name: restbase-test
level: warn
streams:
- type: stdout
metrics:
- type: prometheus
port: 9000
- type: statsd
host: localhost
port: 8125
num_workers: 0