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

Commit 7c64324

Browse files
author
Chris Wiechmann
committed
Version-Check
1 parent ec3236d commit 7c64324

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

apibuilder4elastic/conf/default.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ module.exports = {
2626
// These version are used, that Filebeat and Logstash are configured as required
2727
// by the API-Builder release
2828
versions: {
29-
filebeat: 2,
30-
logstash: 2
29+
filebeat: "2",
30+
logstash: "2"
3131
},
3232
// Payload configuration settings
3333
payload: {

apibuilder4elastic/test/versionCheck/testVersionCheck.js

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ describe('Endpoints', function () {
2020

2121
describe('Check version', () => {
2222
it('[Check-Version-0001] Should return version issue for Filebeat', () => {
23-
const filebeatVersion = 1;
24-
const logstashVersion = 1;
23+
const filebeatVersion = "1";
24+
const logstashVersion = "1";
2525
return requestAsync({
2626
method: 'GET',
2727
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/version/check?filebeatVersion=${filebeatVersion}&logstashVersion=${logstashVersion}`,
@@ -34,8 +34,8 @@ describe('Endpoints', function () {
3434
});
3535

3636
it('[Check-Version-0002] Should return version issue for Filebeat', () => {
37-
const filebeatVersion = 2;
38-
const logstashVersion = 1;
37+
const filebeatVersion = "2";
38+
const logstashVersion = "1";
3939
return requestAsync({
4040
method: 'GET',
4141
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/version/check?filebeatVersion=${filebeatVersion}&logstashVersion=${logstashVersion}`,
@@ -48,8 +48,8 @@ describe('Endpoints', function () {
4848
});
4949

5050
it('[Check-Version-0003] Should return version check ok', () => {
51-
const filebeatVersion = 2;
52-
const logstashVersion = 2;
51+
const filebeatVersion = "2";
52+
const logstashVersion = "2";
5353
return requestAsync({
5454
method: 'GET',
5555
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/version/check?filebeatVersion=${filebeatVersion}&logstashVersion=${logstashVersion}`,
@@ -61,13 +61,29 @@ describe('Endpoints', function () {
6161
});
6262
});
6363

64-
it('[Check-Version-0004] Should return 400 if parameters are missing', () => {
64+
it('[Check-Version-0004] Should return 200 with an error status if parameters are missing', () => {
6565
return requestAsync({
6666
method: 'GET',
6767
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/version/check`,
6868
json: true
6969
}).then(({ response, body }) => {
70-
expect(response.statusCode).to.equal(400);
70+
expect(response.statusCode).to.equal(200);
71+
expect(body.message).to.equal(`Filebeat version does not match to API-Builder release`);
72+
expect(body.versionStatus).to.equal(`error`);
73+
});
74+
});
75+
76+
it('[Check-Version-0005] Should return with an error status wit invalid versions', () => {
77+
const filebeatVersion = "something";
78+
const logstashVersion = "wrong";
79+
return requestAsync({
80+
method: 'GET',
81+
uri: `http://localhost:${server.apibuilder.port}/api/elk/v1/api/version/check?filebeatVersion=${filebeatVersion}&logstashVersion=${logstashVersion}`,
82+
json: true
83+
}).then(({ response, body }) => {
84+
expect(response.statusCode).to.equal(200);
85+
expect(body.message).to.equal(`Filebeat version does not match to API-Builder release`);
86+
expect(body.versionStatus).to.equal(`error`);
7187
});
7288
});
7389
});

filebeat/filebeat.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ filebeat.inputs:
1515
logtype: openlog
1616
gatewayName: ${GATEWAY_NAME:"API-Gateway"}
1717
gatewayRegion: ${GATEWAY_REGION:"N/A"}
18-
filebeatVersion: 2
18+
filebeatVersion: "2"
1919

2020
- type: log
2121
paths: ["/var/log/trace/*.trc"]
@@ -30,7 +30,7 @@ filebeat.inputs:
3030
logtype: trace
3131
gatewayName: ${GATEWAY_NAME:"API-Gateway"}
3232
gatewayRegion: ${GATEWAY_REGION:"N/A"}
33-
filebeatVersion: 2
33+
filebeatVersion: "2"
3434

3535
- type: log
3636
paths: ["/var/log/events/*.log", "/var/log/events/processed/*.log.PROCESSED"]
@@ -42,7 +42,7 @@ filebeat.inputs:
4242
logtype: events
4343
gatewayName: ${GATEWAY_NAME:"API-Gateway"}
4444
gatewayRegion: ${GATEWAY_REGION:"N/A"}
45-
filebeatVersion: 2
45+
filebeatVersion: "2"
4646

4747
- type: log
4848
paths: ["/var/log/audit/*.log"]
@@ -54,7 +54,7 @@ filebeat.inputs:
5454
logtype: domainaudit
5555
gatewayName: ${GATEWAY_NAME:"API-Gateway"}
5656
gatewayRegion: ${GATEWAY_REGION:"N/A"}
57-
filebeatVersion: 2
57+
filebeatVersion: "2"
5858

5959
# Required for Trace-Messages logged by the API-Gateway
6060
processors:

0 commit comments

Comments
 (0)