Skip to content

Commit

Permalink
Copying over the security only saved object api tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kobelb committed Sep 4, 2018
1 parent cef2e78 commit 94054a2
Show file tree
Hide file tree
Showing 17 changed files with 2,894 additions and 0 deletions.
74 changes: 74 additions & 0 deletions x-pack/test/saved_object_api_integration/common/config.js
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`)
],
},
};
};
}

Large diffs are not rendered by default.

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": {}
}
}
Loading

0 comments on commit 94054a2

Please sign in to comment.