Skip to content

Commit

Permalink
fix(configuration): remove webhooks from configuration (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
enudler authored Sep 16, 2020
1 parent 6354ee6 commit 28ce997
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 128 deletions.
8 changes: 0 additions & 8 deletions docs/devguide/docs/swagger-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2471,10 +2471,6 @@ components:
type: number
description: The minimum of time waiting for runner to report before the test considered as finished.
configured only by using API.
default_webhook_url:
type: string
description: Default webhook url to send live report statistics to, can be
configured only by using API.
delay_runner_ms:
type: number
minimum: 0
Expand Down Expand Up @@ -2553,10 +2549,6 @@ components:
description: Minimum acceptable score of tests, if a score is less than this value, a webhook will be sent to the threshold webhook url.
minimum: 0
maximum: 100
benchmark_threshold_webhook_url:
type: string
format: uri
description: Url to send webhooks to incase a test receives a score less than the benchmark threshold.
benchmark_weights:
additionalProperties: false
type: object
Expand Down
8 changes: 0 additions & 8 deletions docs/openapi3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2428,10 +2428,6 @@ components:
type: number
description: The minimum of time waiting for runner to report before the test considered as finished.
configured only by using API.
default_webhook_url:
type: string
description: Default webhook url to send live report statistics to, can be
configured only by using API.
delay_runner_ms:
type: number
minimum: 0
Expand Down Expand Up @@ -2510,10 +2506,6 @@ components:
description: Minimum acceptable score of tests, if a score is less than this value, a webhook will be sent to the threshold webhook url.
minimum: 0
maximum: 100
benchmark_threshold_webhook_url:
type: string
format: uri
description: Url to send webhooks to incase a test receives a score less than the benchmark threshold.
benchmark_weights:
additionalProperties: false
type: object
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"scripts": {
"start": "node src/server.js",
"unit-tests": "nyc --check-coverage --lines 93 --reporter=html --reporter=text mocha ./tests/unit-tests --recursive",
"unit-tests": "nyc --check-coverage --lines 94 --reporter=html --reporter=text mocha ./tests/unit-tests --recursive",
"integration-tests": "bash ./tests/integration-tests/run.sh",
"local-integration-tests": "bash ./tests/integration-tests/runLocal.sh",
"lint": "eslint src/**",
Expand Down
1 change: 0 additions & 1 deletion src/configManager/helpers/configDataMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ let configDataMap = {
type: 'json'
},
[constConfig.BENCHMARK_THRESHOLD]: { value: process.env.BENCHMARK_THRESHOLD, type: 'int' },
[constConfig.BENCHMARK_THRESHOLD_WEBHOOK_URL]: { value: process.env.BENCHMARK_THRESHOLD_WEBHOOK_URL, type: 'string' },
[constConfig.BENCHMARK_WEIGHTS]: { value: process.env.BENCHMARK_WEIGHTS || JSON.stringify(BENCHMARK_WEIGHTS_DEFAULT), type: 'json' },
[constConfig.CUSTOM_RUNNER_DEFINITION]: { value: process.env.CUSTOM_RUNNER_DEFINITION, type: 'json' }

Expand Down
31 changes: 0 additions & 31 deletions src/webhooks/models/database/cassandra/cassandraConnector.js

This file was deleted.

47 changes: 0 additions & 47 deletions src/webhooks/models/database/databaseConnector.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/webhooks/models/webhookManager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const databaseConnector = require('./database/databaseConnector');
const databaseConnector = require('./database/sequelize/sequelizeConnector');
const { ERROR_MESSAGES } = require('../../common/consts');
const generateError = require('../../common/generateError');
const requestSender = require('../../common/requestSender');
Expand Down
6 changes: 0 additions & 6 deletions tests/integration-tests/configManager/configHandler-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const updateBodyWithTypes = {
},
runner_memory: 256,
benchmark_threshold: 20,
benchmark_threshold_webhook_url: 'http://slack.com',
benchmark_weights: {
percentile_ninety_five: { percentage: 20 },
percentile_fifty: { percentage: 30 },
Expand All @@ -68,7 +67,6 @@ const requestBody =
runner_memory: 256,
metrics_plugin_name: 'prometheus',
default_email_address: 'string_value_default_email_address',
default_webhook_url: 'string_value_default_webhook_url',
influx_metrics: {
host: 'string_value_influx_metrics',
username: 'string_value_username',
Expand All @@ -90,7 +88,6 @@ const requestBody =
},
minimum_wait_for_delayed_report_status_update_in_ms: 30000,
benchmark_threshold: 20,
benchmark_threshold_webhook_url: 'http://slack.com',
benchmark_weights: {
percentile_ninety_five: { percentage: 20 },
percentile_fifty: { percentage: 30 },
Expand Down Expand Up @@ -149,7 +146,6 @@ describe('update and get config', () => {
should(response.body['smtp_server'] instanceof Object);
should(response.body['smtp_server'] instanceof Number);
should(response.body['benchmark_threshold'] instanceof Number);
should(response.body['benchmark_threshold_webhook_url'] instanceof String);
should(response.body['benchmark_weights'] instanceof Object);
});
});
Expand Down Expand Up @@ -209,7 +205,6 @@ describe('update and get config', () => {
it('params below minimum', async () => {
let response = await configRequestCreator.updateConfig({
benchmark_threshold: 20,
benchmark_threshold_webhook_url: 'http://slack.com',
benchmark_weights: {
percentile_ninety_five: { percentage: 50 },
percentile_fifty: { percentage: 30 },
Expand All @@ -227,7 +222,6 @@ describe('update and get config', () => {
it('update config fail with validation type', async () => {
let response = await configRequestCreator.updateConfig({
benchmark_threshold: 20,
benchmark_threshold_webhook_url: 'http://slack.com',
benchmark_weights: { 'tps': '10' }
});
should(response.statusCode).eql(400);
Expand Down
15 changes: 7 additions & 8 deletions tests/unit-tests/configManager/configHandlerEnvVaribles-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@ describe('Manager config with env variables', function () {
should(result.runner_memory).eql(20);
should(result.runner_cpu).eql(0.35);
should(result.smtp_server).eql({
'from': 'smtp_from_test',
'port': 'smtp_port_test',
'username': 'smtp_username_test',
'password': 'smtp_password_test',
'timeout': '500',
'rejectUnauthCerts': 'true',
'secure': 'true'
from: 'smtp_from_test',
port: 'smtp_port_test',
username: 'smtp_username_test',
password: 'smtp_password_test',
timeout: '500',
rejectUnauthCerts: 'true',
secure: 'true'
});
should(result.benchmark_threshold).eql(10);
should(result.benchmark_threshold_webhook_url).eql('url_test');
});
});
2 changes: 0 additions & 2 deletions tests/unit-tests/configManager/helpers/configDataMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ const expectedTypes = {
minimum_wait_for_delayed_report_status_update_in_ms: 'int',
metrics_plugin_name: 'string',
default_email_address: undefined,
default_webhook_url: undefined,
influx_metrics: 'json',
prometheus_metrics: 'json',
smtp_server: 'json',
delay_runner_ms: 'int',
benchmark_threshold: 'int',
benchmark_threshold_webhook_url: 'string',
custom_runner_definition: 'json',
benchmark_weights: 'json'
};
Expand Down
2 changes: 1 addition & 1 deletion tests/unit-tests/webhooks/webhooksManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const sinon = require('sinon');
const { expect } = require('chai');
const uuid = require('uuid');

const databaseConnector = require('../../../src/webhooks/models/database/databaseConnector');
const databaseConnector = require('../../../src/webhooks/models/database/sequelize/sequelizeConnector');
const webhooksManager = require('../../../src/webhooks/models/webhookManager');
const webhooksFormatter = require('../../../src/webhooks/models/webhooksFormatter');
const { ERROR_MESSAGES, WEBHOOK_EVENT_TYPE_FINISHED, WEBHOOK_EVENT_TYPE_STARTED, WEBHOOK_EVENT_TYPE_FAILED } = require('../../../src/common/consts');
Expand Down
12 changes: 0 additions & 12 deletions ui/src/features/components/ConfigurationForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ class Form extends React.Component {
info: 'Delay the predator runner from sending http requests (ms)',
valueType: 'int'
},
{
name: 'default_webhook_url',
key: 'default_webhook_url',
floatingLabelText: 'Default webhook url',
info: 'Default webhook url to send live report statistics to'
},
{
name: 'interval_cleanup_finished_containers_ms',
key: 'interval_cleanup_finished_containers_ms',
Expand All @@ -101,12 +95,6 @@ class Form extends React.Component {
info: 'Minimum acceptable score of tests, if a score is less than this value, a webhook will be sent to the threshold webhook url',
valueType: 'int'
},
{
name: 'benchmark_threshold_webhook_url',
key: 'benchmark_threshold_webhook_url',
floatingLabelText: 'Threshold webhook url',
info: 'Url to send webhooks to incase a test receives a score less than the benchmark threshold'
},
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions ui/src/features/components/ConfigurationForm/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function isPositiveFloatNumberIfExist(value) {
}

if (!Number(value)) {
return 'Must be positive float'
return 'Must be positive float';
}

}
Expand All @@ -86,6 +86,6 @@ function isIntegerIfExist(value) {
}

if (!Number.isInteger(Number(value))) {
return 'Must be a integer number'
return 'Must be a integer number';
}
}

0 comments on commit 28ce997

Please sign in to comment.