Skip to content

Commit

Permalink
Reenable further file tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
skh committed Jun 26, 2020
1 parent 6304146 commit e4bddfd
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 69 deletions.
132 changes: 63 additions & 69 deletions x-pack/test/ingest_manager_api_integration/apis/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@ export default function ({ getService }: FtrProviderContext) {

const server = dockerServers.get('registry');
describe('package file', () => {
// it('fetches a .png screenshot image', async () => {
// const supertest = getService('supertest');
// await supertest
// .get(
// '/api/ingest_manager/epm/packages/auditd/2.0.4/img/screenshots/auditbeat-file-integrity-dashboard.png'
// )
// .set('kbn-xsrf', 'xxx')
// .expect('Content-Type', 'image/png')
// .expect(200);
// });
it('fetches a .png screenshot image', async function () {
if (server.enabled) {
await supertest
.get(
'/api/ingest_manager/epm/packages/filetest/0.1.0/img/screenshots/metricbeat_dashboard.png'
)
.set('kbn-xsrf', 'xxx')
.expect('Content-Type', 'image/png')
.expect(200);
} else {
warnAndSkipTest(this, log);
}
});

it('fetches an .svg icon image', async function () {
if (server.enabled) {
Expand All @@ -37,66 +40,57 @@ export default function ({ getService }: FtrProviderContext) {
}
});

// it('fetches an auditbeat .conf rule file', async () => {
// const supertest = getService('supertest');
// await supertest
// .get(
// '/api/ingest_manager/epm/packages/auditd/2.0.4/auditbeat/rules/sample-rules-linux-32bit.conf'
// )
// .set('kbn-xsrf', 'xxx')
// .expect('Content-Type', 'application/json; charset=utf-8')
// .expect(200);
// });

// it('fetches an auditbeat .yml config file', async () => {
// const supertest = getService('supertest');
// await supertest
// .get('/api/ingest_manager/epm/packages/auditd/2.0.4/auditbeat/config/config.yml')
// .set('kbn-xsrf', 'xxx')
// .expect('Content-Type', 'text/yaml; charset=UTF-8')
// .expect(200);
// });

// it('fetches a .json kibana visualization file', async () => {
// const supertest = getService('supertest');
// await supertest
// .get(
// '/api/ingest_manager/epm/packages/auditd/2.0.4/kibana/visualization/b21e0c70-c252-11e7-8692-232bd1143e8a-ecs.json'
// )
// .set('kbn-xsrf', 'xxx')
// .expect('Content-Type', 'application/json; charset=utf-8')
// .expect(200);
// });

// it('fetches a .json kibana dashboard file', async () => {
// const supertest = getService('supertest');
// await supertest
// .get(
// '/api/ingest_manager/epm/packages/auditd/2.0.4/kibana/dashboard/7de391b0-c1ca-11e7-8995-936807a28b16-ecs.json'
// )
// .set('kbn-xsrf', 'xxx')
// .expect('Content-Type', 'application/json; charset=utf-8')
// .expect(200);
// });
it('fetches a .json kibana visualization file', async function () {
if (server.enabled) {
await supertest
.get(
'/api/ingest_manager/epm/packages/filetest/0.1.0/kibana/visualization/sample_visualization.json'
)
.set('kbn-xsrf', 'xxx')
.expect('Content-Type', 'application/json; charset=utf-8')
.expect(200);
} else {
warnAndSkipTest(this, log);
}
});

// it('fetches an .json index pattern file', async () => {
// const supertest = getService('supertest');
// await supertest
// .get('/api/ingest_manager/epm/packages/auditd/2.0.4/kibana/index-pattern/auditbeat-*.json')
// .set('kbn-xsrf', 'xxx')
// .expect('Content-Type', 'application/json; charset=utf-8')
// .expect(200);
// });
it('fetches a .json kibana dashboard file', async function () {
if (server.enabled) {
await supertest
.get(
'/api/ingest_manager/epm/packages/filetest/0.1.0/kibana/dashboard/sample_dashboard.json'
)
.set('kbn-xsrf', 'xxx')
.expect('Content-Type', 'application/json; charset=utf-8')
.expect(200);
} else {
warnAndSkipTest(this, log);
}
});

// it('fetches a .json search file', async () => {
// const supertest = getService('supertest');
// await supertest
// .get(
// '/api/ingest_manager/epm/packages/auditd/2.0.4/kibana/search/0f10c430-c1c3-11e7-8995-936807a28b16-ecs.json'
// )
// .set('kbn-xsrf', 'xxx')
// .expect('Content-Type', 'application/json; charset=utf-8')
// .expect(200);
// });
it('fetches a .json search file', async function () {
if (server.enabled) {
await supertest
.get('/api/ingest_manager/epm/packages/filetest/0.1.0/kibana/search/sample_search.json')
.set('kbn-xsrf', 'xxx')
.expect('Content-Type', 'application/json; charset=utf-8')
.expect(200);
} else {
warnAndSkipTest(this, log);
}
});
});

// Disabled for now as we don't serve prebuilt index patterns in current packages.
// it('fetches an .json index pattern file', async function () {
// if (server.enabled) {
// await supertest
// .get('/api/ingest_manager/epm/packages/filetest/0.1.0/kibana/index-pattern/sample-*.json')
// .set('kbn-xsrf', 'xxx')
// .expect('Content-Type', 'application/json; charset=utf-8')
// .expect(200);
// } else {
// warnAndSkipTest(this, log);
// }
// });
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# filetest

This package contains randomly collected files from other packages to be used in API integration tests.

It also serves as an example how to serve a package from the fixtures directory with the package registry docker container. For this, also see the `x-pack/test/ingest_manager_api_integration/config.ts` how the `test_packages` directory is mounted into the docker container, and `x-pack/test/ingest_manager_api_integration/apis/fixtures/package_registry_config.yml` how to pass the directory to the registry.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"attributes": {
"description": "Logs Kafka integration dashboard",
"hits": 0,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"filter\":[],\"highlightAll\":true,\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"version\":true}"
},
"optionsJSON": "{\"darkTheme\":false}",
"panelsJSON": "[{\"embeddableConfig\":{},\"gridData\":{\"h\":12,\"i\":\"1\",\"w\":24,\"x\":0,\"y\":0},\"panelIndex\":\"1\",\"panelRefName\":\"panel_0\",\"version\":\"7.3.0\"},{\"embeddableConfig\":{\"columns\":[\"kafka.log.class\",\"kafka.log.trace.class\",\"kafka.log.trace.full\"],\"sort\":[\"@timestamp\",\"desc\"]},\"gridData\":{\"h\":12,\"i\":\"2\",\"w\":24,\"x\":24,\"y\":0},\"panelIndex\":\"2\",\"panelRefName\":\"panel_1\",\"version\":\"7.3.0\"},{\"embeddableConfig\":{\"columns\":[\"log.level\",\"kafka.log.component\",\"message\"],\"sort\":[\"@timestamp\",\"desc\"]},\"gridData\":{\"h\":20,\"i\":\"3\",\"w\":48,\"x\":0,\"y\":20},\"panelIndex\":\"3\",\"panelRefName\":\"panel_2\",\"version\":\"7.3.0\"},{\"embeddableConfig\":{},\"gridData\":{\"h\":8,\"i\":\"4\",\"w\":48,\"x\":0,\"y\":12},\"panelIndex\":\"4\",\"panelRefName\":\"panel_3\",\"version\":\"7.3.0\"}]",
"timeRestore": false,
"title": "[Logs Kafka] Overview ECS",
"version": 1
},
"id": "sample_dashboard",
"references": [
{
"id": "number-of-kafka-stracktraces-by-class-ecs",
"name": "panel_0",
"type": "visualization"
},
{
"id": "Kafka stacktraces-ecs",
"name": "panel_1",
"type": "search"
},
{
"id": "sample_search",
"name": "panel_2",
"type": "search"
},
{
"id": "sample_visualization",
"name": "panel_3",
"type": "visualization"
}
],
"type": "dashboard"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"attributes": {
"columns": [
"log.level",
"kafka.log.component",
"message"
],
"description": "",
"hits": 0,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"filter\":[{\"$state\":{\"store\":\"appState\"},\"meta\":{\"alias\":null,\"disabled\":false,\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index\",\"key\":\"dataset.name\",\"negate\":false,\"params\":{\"query\":\"kafka.log\",\"type\":\"phrase\"},\"type\":\"phrase\",\"value\":\"log\"},\"query\":{\"match\":{\"dataset.name\":{\"query\":\"kafka.log\",\"type\":\"phrase\"}}}}],\"highlightAll\":true,\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\",\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"version\":true}"
},
"sort": [
[
"@timestamp",
"desc"
]
],
"title": "All logs [Logs Kafka] ECS",
"version": 1
},
"id": "All Kafka logs-ecs",
"references": [
{
"id": "logs-*",
"name": "kibanaSavedObjectMeta.searchSourceJSON.index",
"type": "index-pattern"
},
{
"id": "logs-*",
"name": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index",
"type": "index-pattern"
}
],
"type": "search"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"attributes": {
"description": "",
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"filter\":[]}"
},
"savedSearchRefName": "search_0",
"title": "Log levels over time [Logs Kafka] ECS",
"uiStateJSON": "{}",
"version": 1,
"visState": "{\"aggs\":[{\"enabled\":true,\"id\":\"1\",\"params\":{},\"schema\":\"metric\",\"type\":\"count\"},{\"enabled\":true,\"id\":\"2\",\"params\":{\"extended_bounds\":{},\"field\":\"@timestamp\",\"interval\":\"auto\",\"min_doc_count\":1},\"schema\":\"segment\",\"type\":\"date_histogram\"},{\"enabled\":true,\"id\":\"3\",\"params\":{\"customLabel\":\"Log Level\",\"field\":\"log.level\",\"order\":\"desc\",\"orderBy\":\"1\",\"size\":5},\"schema\":\"group\",\"type\":\"terms\"}],\"params\":{\"addLegend\":true,\"addTimeMarker\":false,\"addTooltip\":true,\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"labels\":{\"show\":true,\"truncate\":100},\"position\":\"bottom\",\"scale\":{\"type\":\"linear\"},\"show\":true,\"style\":{},\"title\":{\"text\":\"@timestamp per day\"},\"type\":\"category\"}],\"grid\":{\"categoryLines\":false,\"style\":{\"color\":\"#eee\"}},\"legendPosition\":\"right\",\"seriesParams\":[{\"data\":{\"id\":\"1\",\"label\":\"Count\"},\"drawLinesBetweenPoints\":true,\"mode\":\"stacked\",\"show\":\"true\",\"showCircles\":true,\"type\":\"histogram\",\"valueAxis\":\"ValueAxis-1\"}],\"times\":[],\"type\":\"histogram\",\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"labels\":{\"filter\":false,\"rotate\":0,\"show\":true,\"truncate\":100},\"name\":\"LeftAxis-1\",\"position\":\"left\",\"scale\":{\"mode\":\"normal\",\"type\":\"linear\"},\"show\":true,\"style\":{},\"title\":{\"text\":\"Count\"},\"type\":\"value\"}]},\"title\":\"Log levels over time [Logs Kafka] ECS\",\"type\":\"histogram\"}"
},
"id": "sample_visualization",
"references": [
{
"id": "All Kafka logs-ecs",
"name": "search_0",
"type": "search"
}
],
"type": "visualization"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ requirement:
kibana:
versions: ">7.7.0"

screenshots:
- src: "/img/screenshots/metricbeat_dashboard.png"
title: "metricbeat dashboard"
size: "1855x949"
type: "image/png"
icons:
- src: "/img/logo.svg"
size: "16x16"
Expand Down

0 comments on commit e4bddfd

Please sign in to comment.