Skip to content

Commit 5b70c21

Browse files
Merge branch 'master' into move-index-patterns-to-new-plugins-2
2 parents 676f2be + 1367814 commit 5b70c21

9 files changed

Lines changed: 53 additions & 13 deletions

File tree

test/visual_regression/tests/discover/chart_visualization.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default function ({ getService, getPageObjects }) {
2727
const kibanaServer = getService('kibanaServer');
2828
const PageObjects = getPageObjects(['common', 'discover', 'header', 'timePicker']);
2929
const visualTesting = getService('visualTesting');
30+
const find = getService('find');
3031
const defaultSettings = {
3132
defaultIndex: 'logstash-*',
3233
'discover:sampleSize': 1
@@ -48,10 +49,12 @@ export default function ({ getService, getPageObjects }) {
4849

4950
describe('query', function () {
5051
this.tags(['skipFirefox']);
52+
let renderCounter = 0;
5153

5254
it('should show bars in the correct time zone', async function () {
5355
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
5456
await PageObjects.discover.waitUntilSearchingHasFinished();
57+
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
5558
await visualTesting.snapshot({
5659
show: ['discoverChart'],
5760
});
@@ -61,6 +64,7 @@ export default function ({ getService, getPageObjects }) {
6164
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
6265
await PageObjects.discover.waitUntilSearchingHasFinished();
6366
await PageObjects.discover.setChartInterval('Hourly');
67+
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
6468
await visualTesting.snapshot({
6569
show: ['discoverChart'],
6670
});
@@ -70,6 +74,7 @@ export default function ({ getService, getPageObjects }) {
7074
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
7175
await PageObjects.discover.waitUntilSearchingHasFinished();
7276
await PageObjects.discover.setChartInterval('Daily');
77+
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
7378
await visualTesting.snapshot({
7479
show: ['discoverChart'],
7580
});
@@ -79,6 +84,7 @@ export default function ({ getService, getPageObjects }) {
7984
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
8085
await PageObjects.discover.waitUntilSearchingHasFinished();
8186
await PageObjects.discover.setChartInterval('Weekly');
87+
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
8288
await visualTesting.snapshot({
8389
show: ['discoverChart'],
8490
});
@@ -92,6 +98,7 @@ export default function ({ getService, getPageObjects }) {
9298
});
9399
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
94100
await PageObjects.discover.waitUntilSearchingHasFinished();
101+
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
95102
await visualTesting.snapshot({
96103
show: ['discoverChart'],
97104
});
@@ -101,6 +108,7 @@ export default function ({ getService, getPageObjects }) {
101108
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
102109
await PageObjects.discover.waitUntilSearchingHasFinished();
103110
await PageObjects.discover.setChartInterval('Monthly');
111+
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
104112
await visualTesting.snapshot({
105113
show: ['discoverChart'],
106114
});
@@ -110,6 +118,7 @@ export default function ({ getService, getPageObjects }) {
110118
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
111119
await PageObjects.discover.waitUntilSearchingHasFinished();
112120
await PageObjects.discover.setChartInterval('Yearly');
121+
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
113122
await visualTesting.snapshot({
114123
show: ['discoverChart'],
115124
});
@@ -119,6 +128,7 @@ export default function ({ getService, getPageObjects }) {
119128
await PageObjects.header.awaitGlobalLoadingIndicatorHidden();
120129
await PageObjects.discover.waitUntilSearchingHasFinished();
121130
await PageObjects.discover.setChartInterval('Auto');
131+
await find.byCssSelector(`.echChart[data-ech-render-count="${++renderCounter}"]`);
122132
await visualTesting.snapshot({
123133
show: ['discoverChart'],
124134
});

x-pack/legacy/plugins/actions/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ action types.
1919

2020
## Usage
2121

22-
1. Enable the actions plugin in the `kibana.yml` by setting `xpack.actions.enabled: true`.
23-
2. Develop and register an action type (see action types -> example).
24-
3. Create an action by using the RESTful API (see actions -> create action).
25-
4. Use alerts to execute actions or execute manually (see firing actions).
22+
1. Develop and register an action type (see action types -> example).
23+
2. Create an action by using the RESTful API (see actions -> create action).
24+
3. Use alerts to execute actions or execute manually (see firing actions).
2625

2726
## Kibana Actions Configuration
2827
Implemented under the [Actions Config](./server/actions_config.ts).

x-pack/legacy/plugins/actions/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function actions(kibana: any) {
3333
config(Joi: Root) {
3434
return Joi.object()
3535
.keys({
36-
enabled: Joi.boolean().default(false),
36+
enabled: Joi.boolean().default(true),
3737
whitelistedHosts: Joi.array()
3838
.items(
3939
Joi.string()

x-pack/legacy/plugins/alerting/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ A Kibana alert detects a condition and executes one or more actions when that co
2323

2424
## Usage
2525

26-
1. Enable the alerting plugin in the `kibana.yml` by setting `xpack.alerting.enabled: true`.
27-
2. Develop and register an alert type (see alert types -> example).
28-
3. Create an alert using the RESTful API (see alerts -> create).
26+
1. Develop and register an alert type (see alert types -> example).
27+
2. Create an alert using the RESTful API (see alerts -> create).
2928

3029
## Limitations
3130

x-pack/legacy/plugins/alerting/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function alerting(kibana: any) {
3434
config(Joi: Root) {
3535
return Joi.object()
3636
.keys({
37-
enabled: Joi.boolean().default(false),
37+
enabled: Joi.boolean().default(true),
3838
})
3939
.default();
4040
},

x-pack/legacy/plugins/alerting/server/lib/alerts_client_factory.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ test('createAPIKey() returns { created: false } when security is disabled', asyn
9393
expect(createAPIKeyResult).toEqual({ created: false });
9494
});
9595

96+
test('createAPIKey() returns { created: false } when security is enabled but ES security is disabled', async () => {
97+
const factory = new AlertsClientFactory(alertsClientFactoryParams);
98+
factory.create(KibanaRequest.from(fakeRequest), fakeRequest);
99+
const constructorCall = jest.requireMock('../alerts_client').AlertsClient.mock.calls[0][0];
100+
101+
securityPluginSetup.authc.createAPIKey.mockResolvedValueOnce(null);
102+
const createAPIKeyResult = await constructorCall.createAPIKey();
103+
expect(createAPIKeyResult).toEqual({ created: false });
104+
});
105+
96106
test('createAPIKey() returns an API key when security is enabled', async () => {
97107
const factory = new AlertsClientFactory({
98108
...alertsClientFactoryParams,
@@ -105,3 +115,17 @@ test('createAPIKey() returns an API key when security is enabled', async () => {
105115
const createAPIKeyResult = await constructorCall.createAPIKey();
106116
expect(createAPIKeyResult).toEqual({ created: true, result: { api_key: '123', id: 'abc' } });
107117
});
118+
119+
test('createAPIKey() throws when security plugin createAPIKey throws an error', async () => {
120+
const factory = new AlertsClientFactory({
121+
...alertsClientFactoryParams,
122+
securityPluginSetup: securityPluginSetup as any,
123+
});
124+
factory.create(KibanaRequest.from(fakeRequest), fakeRequest);
125+
const constructorCall = jest.requireMock('../alerts_client').AlertsClient.mock.calls[0][0];
126+
127+
securityPluginSetup.authc.createAPIKey.mockRejectedValueOnce(new Error('TLS disabled'));
128+
await expect(constructorCall.createAPIKey()).rejects.toThrowErrorMatchingInlineSnapshot(
129+
`"TLS disabled"`
130+
);
131+
});

x-pack/legacy/plugins/alerting/server/lib/alerts_client_factory.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@ export class AlertsClientFactory {
5353
if (!securityPluginSetup) {
5454
return { created: false };
5555
}
56+
const createAPIKeyResult = await securityPluginSetup.authc.createAPIKey(request, {
57+
name: `source: alerting, generated uuid: "${uuid.v4()}"`,
58+
role_descriptors: {},
59+
});
60+
if (!createAPIKeyResult) {
61+
return { created: false };
62+
}
5663
return {
5764
created: true,
58-
result: (await securityPluginSetup.authc.createAPIKey(request, {
59-
name: `source: alerting, generated uuid: "${uuid.v4()}"`,
60-
role_descriptors: {},
61-
}))!,
65+
result: createAPIKeyResult,
6266
};
6367
},
6468
});

x-pack/test/api_integration/apis/features/features/features.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ export default function({ getService }: FtrProviderContext) {
115115
'maps',
116116
'uptime',
117117
'siem',
118+
'alerting',
119+
'actions',
118120
].sort()
119121
);
120122
});

x-pack/test/api_integration/apis/security/privileges.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ export default function({ getService }: FtrProviderContext) {
3737
uptime: ['all', 'read'],
3838
apm: ['all', 'read'],
3939
siem: ['all', 'read'],
40+
actions: ['all', 'read'],
41+
alerting: ['all', 'read'],
4042
},
4143
global: ['all', 'read'],
4244
space: ['all', 'read'],

0 commit comments

Comments
 (0)