Skip to content

Commit 80703f7

Browse files
authored
fix(config): allow unlimuted text for config values (#394)
* fix(config): allow unlimited text for config values #393
1 parent bedc452 commit 80703f7

File tree

4 files changed

+60
-4
lines changed

4 files changed

+60
-4
lines changed

.circleci/docker-build.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh -e
22

33
if [ "$CIRCLE_BRANCH" != "master" ] ; then
4-
TAG=predator-$CIRCLE_BRANCH
4+
TAG=`echo predator-$CIRCLE_BRANCH | tr -d /`
55
IMAGE=zooz/predator-builds:$TAG
66
else
77
IMAGE=zooz/predator:latest
@@ -10,4 +10,5 @@ fi
1010
echo "Building Docker image $IMAGE on branch: $CIRCLE_BRANCH"
1111
docker build -t $IMAGE .
1212
echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --password-stdin
13-
docker push $IMAGE
13+
docker push $IMAGE
14+

src/configManager/models/database/sequelize/sequelizeConnector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async function initSchemas() {
6565
primaryKey: true
6666
},
6767
value: {
68-
type: Sequelize.DataTypes.STRING
68+
type: Sequelize.DataTypes.TEXT
6969
}
7070
});
7171
await config.sync();
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const Sequelize = require('sequelize');
2+
3+
module.exports.up = async (query, DataTypes) => {
4+
let configTable = await query.describeTable('configs');
5+
6+
if (configTable.value) {
7+
await query.changeColumn(
8+
'configs', 'value', {
9+
type: Sequelize.TEXT
10+
});
11+
}
12+
};
13+
14+
module.exports.down = async (query, DataTypes) => {
15+
};

tests/integration-tests/configManager/configHandler-test.js

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const defaultBody = {
2222
client_errors_ratio: { percentage: 20 },
2323
rps: { percentage: 20 }
2424
}
25+
2526
};
2627
const updateBodyWithTypes = {
2728
influx_metrics: {
@@ -160,6 +161,45 @@ describe('update and get config', () => {
160161
});
161162
});
162163

164+
describe('Update config with large json for custom runner definition', () => {
165+
it('params below minimum', async () => {
166+
let response = await configRequestCreator.updateConfig({
167+
custom_runner_definition: {
168+
spec: {
169+
template: {
170+
spec: {
171+
containers: [{
172+
resources: {
173+
limits: {
174+
memory: '512Mi',
175+
cpu: '1'
176+
},
177+
requests: {
178+
memory: '192Mi',
179+
cpu: '1'
180+
}
181+
}
182+
}],
183+
nodeSelector: {
184+
lifecycle: 'C5nSpot'
185+
},
186+
tolerations: [
187+
{
188+
key: 'instances',
189+
operator: 'Equal',
190+
value: 'c5n',
191+
effect: 'NoSchedule'
192+
}
193+
]
194+
}
195+
}
196+
}
197+
}
198+
});
199+
should(response.statusCode).eql(200);
200+
});
201+
});
202+
163203
describe('Update config validation', () => {
164204
it('update config fail with validation require fields', async () => {
165205
let response = await configRequestCreator.updateConfig(requestBodyNotValidRequire);
@@ -222,7 +262,7 @@ describe('update and get config', () => {
222262
it('update config fail with validation type', async () => {
223263
let response = await configRequestCreator.updateConfig({
224264
benchmark_threshold: 20,
225-
benchmark_weights: { 'tps': '10' }
265+
benchmark_weights: { tps: '10' }
226266
});
227267
should(response.statusCode).eql(400);
228268
should(response.body.message).eql(validationError);

0 commit comments

Comments
 (0)