Skip to content

Commit 94054a2

Browse files
committed
Copying over the security only saved object api tests
1 parent cef2e78 commit 94054a2

17 files changed

Lines changed: 2894 additions & 0 deletions

File tree

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import path from 'path';
8+
import { resolveKibanaPath } from '@kbn/plugin-helpers';
9+
import { EsProvider } from './services/es';
10+
11+
12+
export function createTestConfig(name, { license = 'trial', disabledPlugins = [] } = {}) {
13+
14+
return async function ({ readConfigFile }) {
15+
16+
const config = {
17+
kibana: {
18+
api: await readConfigFile(resolveKibanaPath('test/api_integration/config.js')),
19+
functional: await readConfigFile(require.resolve('../../../../test/functional/config.js'))
20+
},
21+
xpack: {
22+
api: await readConfigFile(require.resolve('../../api_integration/config.js'))
23+
}
24+
};
25+
26+
return {
27+
testFiles: [require.resolve(`../${name}/apis/`)],
28+
servers: config.xpack.api.get('servers'),
29+
services: {
30+
es: EsProvider,
31+
// Provide license and list of disabled plugins to tests so they can alter their configuration
32+
testEnv: () => ({
33+
license,
34+
disabledPlugins,
35+
}),
36+
esSupertestWithoutAuth: config.xpack.api.get('services.esSupertestWithoutAuth'),
37+
supertest: config.kibana.api.get('services.supertest'),
38+
supertestWithoutAuth: config.xpack.api.get('services.supertestWithoutAuth'),
39+
esArchiver: config.kibana.functional.get('services.esArchiver'),
40+
kibanaServer: config.kibana.functional.get('services.kibanaServer'),
41+
},
42+
junit: {
43+
reportName: 'X-Pack Saved Object API Integration Tests -- ' + name,
44+
},
45+
46+
// The saved_objects/basic archives are almost an exact replica of the ones in OSS
47+
// with the exception of a bogus "not-a-visualization" type that I added to make sure
48+
// the find filtering without a type specified worked correctly. Once we have the ability
49+
// to specify more granular access to the objects via the Kibana privileges, this should
50+
// no longer be necessary, and it's only required as long as we do read/all privileges.
51+
esArchiver: {
52+
directory: path.join(__dirname, 'fixtures', 'es_archiver')
53+
},
54+
55+
esTestCluster: {
56+
...config.xpack.api.get('esTestCluster'),
57+
license,
58+
serverArgs: [
59+
...config.xpack.api.get('esTestCluster.serverArgs'),
60+
],
61+
},
62+
63+
kbnTestServer: {
64+
...config.xpack.api.get('kbnTestServer'),
65+
serverArgs: [
66+
...config.xpack.api.get('kbnTestServer.serverArgs'),
67+
'--optimize.enabled=false',
68+
'--server.xsrf.disableProtection=true',
69+
...disabledPlugins.map(key => `--xpack.${key}.enabled=false`)
70+
],
71+
},
72+
};
73+
};
74+
}

x-pack/test/saved_object_api_integration/common/fixtures/es_archiver/saved_objects/basic/data.json

Lines changed: 90 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
{
2+
"type": "index",
3+
"value": {
4+
"index": ".kibana",
5+
"settings": {
6+
"index": {
7+
"number_of_shards": "1",
8+
"auto_expand_replicas": "0-1",
9+
"number_of_replicas": "0"
10+
}
11+
},
12+
"mappings": {
13+
"doc": {
14+
"dynamic": "strict",
15+
"properties": {
16+
"config": {
17+
"dynamic": "true",
18+
"properties": {
19+
"buildNum": {
20+
"type": "keyword"
21+
},
22+
"defaultIndex": {
23+
"type": "text",
24+
"fields": {
25+
"keyword": {
26+
"type": "keyword",
27+
"ignore_above": 256
28+
}
29+
}
30+
}
31+
}
32+
},
33+
"dashboard": {
34+
"properties": {
35+
"description": {
36+
"type": "text"
37+
},
38+
"hits": {
39+
"type": "integer"
40+
},
41+
"kibanaSavedObjectMeta": {
42+
"properties": {
43+
"searchSourceJSON": {
44+
"type": "text"
45+
}
46+
}
47+
},
48+
"optionsJSON": {
49+
"type": "text"
50+
},
51+
"panelsJSON": {
52+
"type": "text"
53+
},
54+
"refreshInterval": {
55+
"properties": {
56+
"display": {
57+
"type": "keyword"
58+
},
59+
"pause": {
60+
"type": "boolean"
61+
},
62+
"section": {
63+
"type": "integer"
64+
},
65+
"value": {
66+
"type": "integer"
67+
}
68+
}
69+
},
70+
"timeFrom": {
71+
"type": "keyword"
72+
},
73+
"timeRestore": {
74+
"type": "boolean"
75+
},
76+
"timeTo": {
77+
"type": "keyword"
78+
},
79+
"title": {
80+
"type": "text"
81+
},
82+
"uiStateJSON": {
83+
"type": "text"
84+
},
85+
"version": {
86+
"type": "integer"
87+
}
88+
}
89+
},
90+
"graph-workspace": {
91+
"properties": {
92+
"description": {
93+
"type": "text"
94+
},
95+
"kibanaSavedObjectMeta": {
96+
"properties": {
97+
"searchSourceJSON": {
98+
"type": "text"
99+
}
100+
}
101+
},
102+
"numLinks": {
103+
"type": "integer"
104+
},
105+
"numVertices": {
106+
"type": "integer"
107+
},
108+
"title": {
109+
"type": "text"
110+
},
111+
"version": {
112+
"type": "integer"
113+
},
114+
"wsState": {
115+
"type": "text"
116+
}
117+
}
118+
},
119+
"index-pattern": {
120+
"properties": {
121+
"fieldFormatMap": {
122+
"type": "text"
123+
},
124+
"fields": {
125+
"type": "text"
126+
},
127+
"intervalName": {
128+
"type": "keyword"
129+
},
130+
"notExpandable": {
131+
"type": "boolean"
132+
},
133+
"sourceFilters": {
134+
"type": "text"
135+
},
136+
"timeFieldName": {
137+
"type": "keyword"
138+
},
139+
"title": {
140+
"type": "text"
141+
}
142+
}
143+
},
144+
"search": {
145+
"properties": {
146+
"columns": {
147+
"type": "keyword"
148+
},
149+
"description": {
150+
"type": "text"
151+
},
152+
"hits": {
153+
"type": "integer"
154+
},
155+
"kibanaSavedObjectMeta": {
156+
"properties": {
157+
"searchSourceJSON": {
158+
"type": "text"
159+
}
160+
}
161+
},
162+
"sort": {
163+
"type": "keyword"
164+
},
165+
"title": {
166+
"type": "text"
167+
},
168+
"version": {
169+
"type": "integer"
170+
}
171+
}
172+
},
173+
"server": {
174+
"properties": {
175+
"uuid": {
176+
"type": "keyword"
177+
}
178+
}
179+
},
180+
"timelion-sheet": {
181+
"properties": {
182+
"description": {
183+
"type": "text"
184+
},
185+
"hits": {
186+
"type": "integer"
187+
},
188+
"kibanaSavedObjectMeta": {
189+
"properties": {
190+
"searchSourceJSON": {
191+
"type": "text"
192+
}
193+
}
194+
},
195+
"timelion_chart_height": {
196+
"type": "integer"
197+
},
198+
"timelion_columns": {
199+
"type": "integer"
200+
},
201+
"timelion_interval": {
202+
"type": "keyword"
203+
},
204+
"timelion_other_interval": {
205+
"type": "keyword"
206+
},
207+
"timelion_rows": {
208+
"type": "integer"
209+
},
210+
"timelion_sheet": {
211+
"type": "text"
212+
},
213+
"title": {
214+
"type": "text"
215+
},
216+
"version": {
217+
"type": "integer"
218+
}
219+
}
220+
},
221+
"type": {
222+
"type": "keyword"
223+
},
224+
"updated_at": {
225+
"type": "date"
226+
},
227+
"url": {
228+
"properties": {
229+
"accessCount": {
230+
"type": "long"
231+
},
232+
"accessDate": {
233+
"type": "date"
234+
},
235+
"createDate": {
236+
"type": "date"
237+
},
238+
"url": {
239+
"type": "text",
240+
"fields": {
241+
"keyword": {
242+
"type": "keyword",
243+
"ignore_above": 2048
244+
}
245+
}
246+
}
247+
}
248+
},
249+
"visualization": {
250+
"properties": {
251+
"description": {
252+
"type": "text"
253+
},
254+
"kibanaSavedObjectMeta": {
255+
"properties": {
256+
"searchSourceJSON": {
257+
"type": "text"
258+
}
259+
}
260+
},
261+
"savedSearchId": {
262+
"type": "keyword"
263+
},
264+
"title": {
265+
"type": "text"
266+
},
267+
"uiStateJSON": {
268+
"type": "text"
269+
},
270+
"version": {
271+
"type": "integer"
272+
},
273+
"visState": {
274+
"type": "text"
275+
}
276+
}
277+
}
278+
}
279+
}
280+
},
281+
"aliases": {}
282+
}
283+
}

0 commit comments

Comments
 (0)