mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Merge master
This commit is contained in:
commit
44718237b2
9 changed files with 77 additions and 13 deletions
|
@ -24,7 +24,7 @@ module.exports = function (kibana) {
|
|||
key: Joi.string()
|
||||
}).default(),
|
||||
apiVersion: Joi.string().default('2.0'),
|
||||
minimumVerison: Joi.string().default('2.1.0')
|
||||
minimumVersion: Joi.string().default('2.1.0')
|
||||
}).default();
|
||||
},
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ describe('plugins/elasticsearch', function () {
|
|||
var plugin;
|
||||
|
||||
beforeEach(function () {
|
||||
var get = sinon.stub().withArgs('elasticserach.minimumVerison').returns('1.4.3');
|
||||
var get = sinon.stub().withArgs('elasticserach.minimumVersion').returns('1.4.3');
|
||||
var config = function () { return { get: get }; };
|
||||
server = {
|
||||
log: _.noop,
|
||||
|
|
|
@ -55,7 +55,7 @@ describe('plugins/elasticsearch', function () {
|
|||
});
|
||||
|
||||
it('should set the cluster green if everything is ready', function () {
|
||||
get.withArgs('elasticsearch.minimumVerison').returns('1.4.4');
|
||||
get.withArgs('elasticsearch.minimumVersion').returns('1.4.4');
|
||||
get.withArgs('kibana.index').returns('.my-kibana');
|
||||
client.ping.returns(Promise.resolve());
|
||||
client.cluster.health.returns(Promise.resolve({ timed_out: false, status: 'green' }));
|
||||
|
@ -74,7 +74,7 @@ describe('plugins/elasticsearch', function () {
|
|||
it('should set the cluster red if the ping fails, then to green', function () {
|
||||
|
||||
get.withArgs('elasticsearch.url').returns('http://localhost:9200');
|
||||
get.withArgs('elasticsearch.minimumVerison').returns('1.4.4');
|
||||
get.withArgs('elasticsearch.minimumVersion').returns('1.4.4');
|
||||
get.withArgs('kibana.index').returns('.my-kibana');
|
||||
client.ping.onCall(0).returns(Promise.reject(new NoConnections()));
|
||||
client.ping.onCall(1).returns(Promise.resolve());
|
||||
|
@ -98,7 +98,7 @@ describe('plugins/elasticsearch', function () {
|
|||
|
||||
it('should set the cluster red if the health check status is red, then to green', function () {
|
||||
get.withArgs('elasticsearch.url').returns('http://localhost:9200');
|
||||
get.withArgs('elasticsearch.minimumVerison').returns('1.4.4');
|
||||
get.withArgs('elasticsearch.minimumVersion').returns('1.4.4');
|
||||
get.withArgs('kibana.index').returns('.my-kibana');
|
||||
client.ping.returns(Promise.resolve());
|
||||
client.cluster.health.onCall(0).returns(Promise.resolve({ timed_out: false, status: 'red' }));
|
||||
|
@ -121,7 +121,7 @@ describe('plugins/elasticsearch', function () {
|
|||
|
||||
it('should set the cluster yellow if the health check timed_out and create index', function () {
|
||||
get.withArgs('elasticsearch.url').returns('http://localhost:9200');
|
||||
get.withArgs('elasticsearch.minimumVerison').returns('1.4.4');
|
||||
get.withArgs('elasticsearch.minimumVersion').returns('1.4.4');
|
||||
get.withArgs('kibana.index').returns('.my-kibana');
|
||||
client.ping.returns(Promise.resolve());
|
||||
client.cluster.health.onCall(0).returns(Promise.resolve({ timed_out: true, status: 'red' }));
|
||||
|
|
|
@ -7,7 +7,7 @@ module.exports = function (server) {
|
|||
server.log(['plugin', 'debug'], 'Checking Elasticsearch version');
|
||||
|
||||
var client = server.plugins.elasticsearch.client;
|
||||
var minimumElasticsearchVersion = server.config().get('elasticsearch.minimumVerison');
|
||||
var minimumElasticsearchVersion = server.config().get('elasticsearch.minimumVersion');
|
||||
|
||||
return client.nodes.info()
|
||||
.then(function (info) {
|
||||
|
|
39
src/server/http/__tests__/index.js
Normal file
39
src/server/http/__tests__/index.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
import expect from 'expect.js';
|
||||
import KbnServer from '../../KbnServer';
|
||||
|
||||
describe('cookie validation', function () {
|
||||
let kbnServer;
|
||||
beforeEach(function () {
|
||||
kbnServer = new KbnServer();
|
||||
return kbnServer.ready();
|
||||
});
|
||||
afterEach(function () {
|
||||
return kbnServer.close();
|
||||
});
|
||||
|
||||
it('allows non-strict cookies', function (done) {
|
||||
kbnServer.server.inject({
|
||||
method: 'GET',
|
||||
url: '/',
|
||||
headers: {
|
||||
cookie: 'test:80=value;test_80=value'
|
||||
}
|
||||
}, (res) => {
|
||||
expect(res.payload).not.to.contain('Invalid cookie header');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an error if the cookie can\'t be parsed', function (done) {
|
||||
kbnServer.server.inject({
|
||||
method: 'GET',
|
||||
url: '/',
|
||||
headers: {
|
||||
cookie: 'a'
|
||||
}
|
||||
}, (res) => {
|
||||
expect(res.payload).to.contain('Invalid cookie header');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -14,6 +14,9 @@ module.exports = function (kbnServer, server, config) {
|
|||
var connectionOptions = {
|
||||
host: config.get('server.host'),
|
||||
port: config.get('server.port'),
|
||||
state: {
|
||||
strictHeader: false
|
||||
},
|
||||
routes: {
|
||||
cors: config.get('server.cors')
|
||||
}
|
||||
|
|
|
@ -85,11 +85,7 @@ class UiExports {
|
|||
|
||||
return _.chain(patterns)
|
||||
.map(function (pattern) {
|
||||
var matches = names.filter(matcher(pattern));
|
||||
if (!matches.length) {
|
||||
throw new Error('Unable to find uiExports for pattern ' + pattern);
|
||||
}
|
||||
return matches;
|
||||
return names.filter(matcher(pattern));
|
||||
})
|
||||
.flattenDeep()
|
||||
.reduce(function (found, name) {
|
||||
|
|
26
src/ui/__tests__/ui_exports.js
Normal file
26
src/ui/__tests__/ui_exports.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
import expect from 'expect.js';
|
||||
|
||||
import UiExports from '../UiExports';
|
||||
|
||||
describe('UiExports', function () {
|
||||
describe('#find()', function () {
|
||||
it('finds exports based on the passed export names', function () {
|
||||
var uiExports = new UiExports({});
|
||||
uiExports.aliases.foo = ['a', 'b', 'c'];
|
||||
uiExports.aliases.bar = ['d', 'e', 'f'];
|
||||
|
||||
expect(uiExports.find(['foo'])).to.eql(['a', 'b', 'c']);
|
||||
expect(uiExports.find(['bar'])).to.eql(['d', 'e', 'f']);
|
||||
expect(uiExports.find(['foo', 'bar'])).to.eql(['a', 'b', 'c', 'd', 'e', 'f']);
|
||||
});
|
||||
|
||||
it('allows query types that match nothing', function () {
|
||||
var uiExports = new UiExports({});
|
||||
uiExports.aliases.foo = ['a', 'b', 'c'];
|
||||
|
||||
expect(uiExports.find(['foo'])).to.eql(['a', 'b', 'c']);
|
||||
expect(uiExports.find(['bar'])).to.eql([]);
|
||||
expect(uiExports.find(['foo', 'bar'])).to.eql(['a', 'b', 'c']);
|
||||
});
|
||||
});
|
||||
});
|
2
test/fixtures/scenarioManager.js
vendored
2
test/fixtures/scenarioManager.js
vendored
|
@ -9,7 +9,7 @@ function ScenarioManager(server) {
|
|||
// NOTE: some large sets of test data can take several minutes to load
|
||||
this.client = new elasticsearch.Client({
|
||||
host: server,
|
||||
requestTimeout: 3000000
|
||||
requestTimeout: 300000
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue