Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit d0e4e10

Browse files
author
Chris Wiechmann
committed
Now, during test setup the test-index with the correct template
1 parent ae24395 commit d0e4e10

File tree

9 files changed

+10
-10
lines changed

9 files changed

+10
-10
lines changed

elk-traffic-monitor-api/test/_base.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ function requestAsync(uri, options, cb) {
6666
});
6767
}
6868

69-
async function sendToElasticsearch(elasticConfig, index, dataset) {
69+
async function sendToElasticsearch(elasticConfig, index, template, dataset) {
7070
console.log(`Creating connection to ElasticSearch cluster: ${elasticConfig.node}`)
7171
const client = new Client({
7272
node: elasticConfig.node
7373
});
74-
const mappingConfig = JSON.parse(fs.readFileSync('../logstash/config/traffic_details_index_template.json')).mappings;
74+
const mappingConfig = JSON.parse(fs.readFileSync(`../logstash/config/${template}`)).mappings;
7575
const createdIndexResponse = await client.indices.create({
7676
index: index,
7777
body: {

elk-traffic-monitor-api/test/asAdmin/test_circuitpath.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('Traffic Monitor API', function () {
4040
server.started
4141
.then(() => {
4242
const entryset = require('../documents/basic/circuitpath_test_documents');
43-
sendToElasticsearch(elasticConfig, indexName, entryset)
43+
sendToElasticsearch(elasticConfig, indexName, 'traffic_details_index_template.json', entryset)
4444
.then(() => {
4545
resolve();
4646
})

elk-traffic-monitor-api/test/asAdmin/test_getinfo_endpoint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('Endpoints', function () {
4040
server.started
4141
.then(() => {
4242
const entryset = require('../documents/basic/getinfo_test_documents');
43-
sendToElasticsearch(elasticConfig, indexName, entryset)
43+
sendToElasticsearch(elasticConfig, indexName, 'traffic_details_index_template.json', entryset)
4444
.then(() => {
4545
resolve();
4646
})

elk-traffic-monitor-api/test/asAdmin/test_search_count_AsAdmin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('Endpoints', function () {
4040
server.started
4141
.then(() => {
4242
const entryset = require('../documents/basic/search_count_documents');
43-
sendToElasticsearch(elasticConfig, indexName, entryset)
43+
sendToElasticsearch(elasticConfig, indexName, 'traffic_details_index_template.json', entryset)
4444
.then(() => {
4545
resolve();
4646
})

elk-traffic-monitor-api/test/asAdmin/test_search_endpoint_AsAdmin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ describe('Endpoints', function () {
4141
server.started
4242
.then(() => {
4343
const entryset = require('../documents/basic/search_test_documents');
44-
sendToElasticsearch(elasticConfig, indexName, entryset)
44+
sendToElasticsearch(elasticConfig, indexName, 'traffic_details_index_template.json', entryset)
4545
.then(() => {
4646
resolve();
4747
})

elk-traffic-monitor-api/test/asAdmin/test_trace_endpoint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('Traffic Monitor API', function () {
4040
server.started
4141
.then(() => {
4242
const entryset = require('../documents/basic/trace_test_documents');
43-
sendToElasticsearch(elasticConfig, indexName, entryset)
43+
sendToElasticsearch(elasticConfig, indexName, 'trace_messages_index_template.json', entryset)
4444
.then(() => {
4545
resolve();
4646
})

elk-traffic-monitor-api/test/restricted/test_circuitpath_restricted.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('Traffic Monitor API', function () {
3030
server.started
3131
.then(() => {
3232
const entryset = require('../documents/basic/circuitpath_test_documents');
33-
sendToElasticsearch(elasticConfig, indexName, entryset)
33+
sendToElasticsearch(elasticConfig, indexName, 'traffic_details_index_template.json', entryset)
3434
.then(() => {
3535
resolve();
3636
})

elk-traffic-monitor-api/test/restricted/test_getinfo_endpoint_restricted.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('Endpoints', function () {
3030
server.started
3131
.then(() => {
3232
const entryset = require('../documents/basic/getinfo_test_documents');
33-
sendToElasticsearch(elasticConfig, indexName, entryset)
33+
sendToElasticsearch(elasticConfig, indexName, 'traffic_details_index_template.json', entryset)
3434
.then(() => {
3535
resolve();
3636
})

elk-traffic-monitor-api/test/restricted/test_search_restricted.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('Endpoints', function () {
3030
server.started
3131
.then(() => {
3232
const entryset = require('../documents/basic/search_count_documents');
33-
sendToElasticsearch(elasticConfig, indexName, entryset)
33+
sendToElasticsearch(elasticConfig, indexName, 'traffic_details_index_template.json', entryset)
3434
.then(() => {
3535
resolve();
3636
})

0 commit comments

Comments
 (0)