forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copying over the security only saved object api tests
- Loading branch information
Showing
17 changed files
with
2,894 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import path from 'path'; | ||
import { resolveKibanaPath } from '@kbn/plugin-helpers'; | ||
import { EsProvider } from './services/es'; | ||
|
||
|
||
export function createTestConfig(name, { license = 'trial', disabledPlugins = [] } = {}) { | ||
|
||
return async function ({ readConfigFile }) { | ||
|
||
const config = { | ||
kibana: { | ||
api: await readConfigFile(resolveKibanaPath('test/api_integration/config.js')), | ||
functional: await readConfigFile(require.resolve('../../../../test/functional/config.js')) | ||
}, | ||
xpack: { | ||
api: await readConfigFile(require.resolve('../../api_integration/config.js')) | ||
} | ||
}; | ||
|
||
return { | ||
testFiles: [require.resolve(`../${name}/apis/`)], | ||
servers: config.xpack.api.get('servers'), | ||
services: { | ||
es: EsProvider, | ||
// Provide license and list of disabled plugins to tests so they can alter their configuration | ||
testEnv: () => ({ | ||
license, | ||
disabledPlugins, | ||
}), | ||
esSupertestWithoutAuth: config.xpack.api.get('services.esSupertestWithoutAuth'), | ||
supertest: config.kibana.api.get('services.supertest'), | ||
supertestWithoutAuth: config.xpack.api.get('services.supertestWithoutAuth'), | ||
esArchiver: config.kibana.functional.get('services.esArchiver'), | ||
kibanaServer: config.kibana.functional.get('services.kibanaServer'), | ||
}, | ||
junit: { | ||
reportName: 'X-Pack Saved Object API Integration Tests -- ' + name, | ||
}, | ||
|
||
// The saved_objects/basic archives are almost an exact replica of the ones in OSS | ||
// with the exception of a bogus "not-a-visualization" type that I added to make sure | ||
// the find filtering without a type specified worked correctly. Once we have the ability | ||
// to specify more granular access to the objects via the Kibana privileges, this should | ||
// no longer be necessary, and it's only required as long as we do read/all privileges. | ||
esArchiver: { | ||
directory: path.join(__dirname, 'fixtures', 'es_archiver') | ||
}, | ||
|
||
esTestCluster: { | ||
...config.xpack.api.get('esTestCluster'), | ||
license, | ||
serverArgs: [ | ||
...config.xpack.api.get('esTestCluster.serverArgs'), | ||
], | ||
}, | ||
|
||
kbnTestServer: { | ||
...config.xpack.api.get('kbnTestServer'), | ||
serverArgs: [ | ||
...config.xpack.api.get('kbnTestServer.serverArgs'), | ||
'--optimize.enabled=false', | ||
'--server.xsrf.disableProtection=true', | ||
...disabledPlugins.map(key => `--xpack.${key}.enabled=false`) | ||
], | ||
}, | ||
}; | ||
}; | ||
} |
90 changes: 90 additions & 0 deletions
90
...st/saved_object_api_integration/common/fixtures/es_archiver/saved_objects/basic/data.json
Large diffs are not rendered by default.
Oops, something went wrong.
283 changes: 283 additions & 0 deletions
283
...aved_object_api_integration/common/fixtures/es_archiver/saved_objects/basic/mappings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,283 @@ | ||
{ | ||
"type": "index", | ||
"value": { | ||
"index": ".kibana", | ||
"settings": { | ||
"index": { | ||
"number_of_shards": "1", | ||
"auto_expand_replicas": "0-1", | ||
"number_of_replicas": "0" | ||
} | ||
}, | ||
"mappings": { | ||
"doc": { | ||
"dynamic": "strict", | ||
"properties": { | ||
"config": { | ||
"dynamic": "true", | ||
"properties": { | ||
"buildNum": { | ||
"type": "keyword" | ||
}, | ||
"defaultIndex": { | ||
"type": "text", | ||
"fields": { | ||
"keyword": { | ||
"type": "keyword", | ||
"ignore_above": 256 | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"dashboard": { | ||
"properties": { | ||
"description": { | ||
"type": "text" | ||
}, | ||
"hits": { | ||
"type": "integer" | ||
}, | ||
"kibanaSavedObjectMeta": { | ||
"properties": { | ||
"searchSourceJSON": { | ||
"type": "text" | ||
} | ||
} | ||
}, | ||
"optionsJSON": { | ||
"type": "text" | ||
}, | ||
"panelsJSON": { | ||
"type": "text" | ||
}, | ||
"refreshInterval": { | ||
"properties": { | ||
"display": { | ||
"type": "keyword" | ||
}, | ||
"pause": { | ||
"type": "boolean" | ||
}, | ||
"section": { | ||
"type": "integer" | ||
}, | ||
"value": { | ||
"type": "integer" | ||
} | ||
} | ||
}, | ||
"timeFrom": { | ||
"type": "keyword" | ||
}, | ||
"timeRestore": { | ||
"type": "boolean" | ||
}, | ||
"timeTo": { | ||
"type": "keyword" | ||
}, | ||
"title": { | ||
"type": "text" | ||
}, | ||
"uiStateJSON": { | ||
"type": "text" | ||
}, | ||
"version": { | ||
"type": "integer" | ||
} | ||
} | ||
}, | ||
"graph-workspace": { | ||
"properties": { | ||
"description": { | ||
"type": "text" | ||
}, | ||
"kibanaSavedObjectMeta": { | ||
"properties": { | ||
"searchSourceJSON": { | ||
"type": "text" | ||
} | ||
} | ||
}, | ||
"numLinks": { | ||
"type": "integer" | ||
}, | ||
"numVertices": { | ||
"type": "integer" | ||
}, | ||
"title": { | ||
"type": "text" | ||
}, | ||
"version": { | ||
"type": "integer" | ||
}, | ||
"wsState": { | ||
"type": "text" | ||
} | ||
} | ||
}, | ||
"index-pattern": { | ||
"properties": { | ||
"fieldFormatMap": { | ||
"type": "text" | ||
}, | ||
"fields": { | ||
"type": "text" | ||
}, | ||
"intervalName": { | ||
"type": "keyword" | ||
}, | ||
"notExpandable": { | ||
"type": "boolean" | ||
}, | ||
"sourceFilters": { | ||
"type": "text" | ||
}, | ||
"timeFieldName": { | ||
"type": "keyword" | ||
}, | ||
"title": { | ||
"type": "text" | ||
} | ||
} | ||
}, | ||
"search": { | ||
"properties": { | ||
"columns": { | ||
"type": "keyword" | ||
}, | ||
"description": { | ||
"type": "text" | ||
}, | ||
"hits": { | ||
"type": "integer" | ||
}, | ||
"kibanaSavedObjectMeta": { | ||
"properties": { | ||
"searchSourceJSON": { | ||
"type": "text" | ||
} | ||
} | ||
}, | ||
"sort": { | ||
"type": "keyword" | ||
}, | ||
"title": { | ||
"type": "text" | ||
}, | ||
"version": { | ||
"type": "integer" | ||
} | ||
} | ||
}, | ||
"server": { | ||
"properties": { | ||
"uuid": { | ||
"type": "keyword" | ||
} | ||
} | ||
}, | ||
"timelion-sheet": { | ||
"properties": { | ||
"description": { | ||
"type": "text" | ||
}, | ||
"hits": { | ||
"type": "integer" | ||
}, | ||
"kibanaSavedObjectMeta": { | ||
"properties": { | ||
"searchSourceJSON": { | ||
"type": "text" | ||
} | ||
} | ||
}, | ||
"timelion_chart_height": { | ||
"type": "integer" | ||
}, | ||
"timelion_columns": { | ||
"type": "integer" | ||
}, | ||
"timelion_interval": { | ||
"type": "keyword" | ||
}, | ||
"timelion_other_interval": { | ||
"type": "keyword" | ||
}, | ||
"timelion_rows": { | ||
"type": "integer" | ||
}, | ||
"timelion_sheet": { | ||
"type": "text" | ||
}, | ||
"title": { | ||
"type": "text" | ||
}, | ||
"version": { | ||
"type": "integer" | ||
} | ||
} | ||
}, | ||
"type": { | ||
"type": "keyword" | ||
}, | ||
"updated_at": { | ||
"type": "date" | ||
}, | ||
"url": { | ||
"properties": { | ||
"accessCount": { | ||
"type": "long" | ||
}, | ||
"accessDate": { | ||
"type": "date" | ||
}, | ||
"createDate": { | ||
"type": "date" | ||
}, | ||
"url": { | ||
"type": "text", | ||
"fields": { | ||
"keyword": { | ||
"type": "keyword", | ||
"ignore_above": 2048 | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"visualization": { | ||
"properties": { | ||
"description": { | ||
"type": "text" | ||
}, | ||
"kibanaSavedObjectMeta": { | ||
"properties": { | ||
"searchSourceJSON": { | ||
"type": "text" | ||
} | ||
} | ||
}, | ||
"savedSearchId": { | ||
"type": "keyword" | ||
}, | ||
"title": { | ||
"type": "text" | ||
}, | ||
"uiStateJSON": { | ||
"type": "text" | ||
}, | ||
"version": { | ||
"type": "integer" | ||
}, | ||
"visState": { | ||
"type": "text" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"aliases": {} | ||
} | ||
} |
Oops, something went wrong.