Skip to content

Commit

Permalink
Merge branch 'master' into feat/favorites
Browse files Browse the repository at this point in the history
  • Loading branch information
enudler committed Sep 18, 2020
2 parents 4c7e3bf + c8ddbf8 commit 9f57c02
Show file tree
Hide file tree
Showing 44 changed files with 1,947 additions and 211 deletions.
5 changes: 3 additions & 2 deletions .circleci/docker-build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh -e

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

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async function initSchemas() {
primaryKey: true
},
value: {
type: Sequelize.DataTypes.STRING
type: Sequelize.DataTypes.TEXT
}
});
await config.sync();
Expand Down
15 changes: 15 additions & 0 deletions src/database/sequlize-handler/migrations/07_config_large.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const Sequelize = require('sequelize');

module.exports.up = async (query, DataTypes) => {
let configTable = await query.describeTable('configs');

if (configTable.value) {
await query.changeColumn(
'configs', 'value', {
type: Sequelize.TEXT
});
}
};

module.exports.down = async (query, DataTypes) => {
};
42 changes: 41 additions & 1 deletion tests/integration-tests/configManager/configHandler-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const defaultBody = {
client_errors_ratio: { percentage: 20 },
rps: { percentage: 20 }
}

};
const updateBodyWithTypes = {
influx_metrics: {
Expand Down Expand Up @@ -160,6 +161,45 @@ describe('update and get config', () => {
});
});

describe('Update config with large json for custom runner definition', () => {
it('params below minimum', async () => {
let response = await configRequestCreator.updateConfig({
custom_runner_definition: {
spec: {
template: {
spec: {
containers: [{
resources: {
limits: {
memory: '512Mi',
cpu: '1'
},
requests: {
memory: '192Mi',
cpu: '1'
}
}
}],
nodeSelector: {
lifecycle: 'C5nSpot'
},
tolerations: [
{
key: 'instances',
operator: 'Equal',
value: 'c5n',
effect: 'NoSchedule'
}
]
}
}
}
}
});
should(response.statusCode).eql(200);
});
});

describe('Update config validation', () => {
it('update config fail with validation require fields', async () => {
let response = await configRequestCreator.updateConfig(requestBodyNotValidRequire);
Expand Down Expand Up @@ -222,7 +262,7 @@ describe('update and get config', () => {
it('update config fail with validation type', async () => {
let response = await configRequestCreator.updateConfig({
benchmark_threshold: 20,
benchmark_weights: { 'tps': '10' }
benchmark_weights: { tps: '10' }
});
should(response.statusCode).eql(400);
should(response.body.message).eql(validationError);
Expand Down
4 changes: 4 additions & 0 deletions ui/src/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import GetReports from '../features/get-last-reports';
import GetTestReports from '../features/get-test-reports';
import Configuration from '../features/get-configuration';
import ReportPage from '../features/report-page';
import Webhooks from '../features/webhooks';
import { Route, Redirect } from 'react-router';
import { connect } from 'react-redux';
import { ConnectedRouter } from 'react-router-redux';
Expand Down Expand Up @@ -48,6 +49,9 @@ class App extends React.Component {
<Route exact path='/processors' render={props => (
<GetProcessors {...props} />
)} />
<Route exact path='/webhooks' render={props => (
<Webhooks {...props} />
)} />
<Route exact path='/settings' render={props => (
<Configuration {...props} />
)} />
Expand Down
4 changes: 3 additions & 1 deletion ui/src/App/rootSagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import { processorsRegister } from '../features/redux/saga/processorsSagas';
import { reportsRegister } from '../features/redux/saga/reportsSagas';
import { jobsRegister } from '../features/redux/saga/jobsSagas';
import { configRegister } from '../features/redux/saga/configSagas';
import { webhooksRegister } from '../features/redux/saga/webhooksSagas';

export default function * rootSaga () {
yield all([
processorsRegister(),
testsRegister(),
reportsRegister(),
jobsRegister(),
configRegister()
configRegister(),
webhooksRegister()
]);
}
164 changes: 83 additions & 81 deletions ui/src/components/CollapsibleItem/CollapsibleItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,96 +10,98 @@ import Section from './components/CollapsibleItemSection.export'
import css from './styles/index.scss'

const TYPES = {
DEFAULT: 'DEFAULT',
ERROR: 'ERROR',
SUCCESS: 'SUCCESS',
CLICKER: 'CLICKER'
DEFAULT: 'DEFAULT',
ERROR: 'ERROR',
SUCCESS: 'SUCCESS',
CLICKER: 'CLICKER'
}

const { CARD_TYPES } = Card
const {CARD_TYPES} = Card

const CollapsibleItem = ({
icon,
title,
sections,
body,
onClick,
expanded,
disabled,
editable,
toggleable,
className,
titlePrefix,
type,
...rest
}) => {
const resolvedClassName = classnames(css.collapsible, className, { [css.disabled]: disabled })
let cardType = CARD_TYPES.DEFAULT
if (type === TYPES.ERROR) {
cardType = CARD_TYPES.ERROR
} else if (type === TYPES.SUCCESS) {
cardType = CARD_TYPES.SUCCESS
} else if (type === TYPES.CLICKER) {
cardType = CARD_TYPES.CLICKER
} else if (disabled) {
cardType = CARD_TYPES.DISABLED
}
return (
<Card
type={cardType}
hover
hovering={expanded}
clickable={false}
className={resolvedClassName}
{...rest}
>
<Header
onClick={onClick}
expanded={expanded}
disabled={disabled}
toggleable={toggleable}
editable={editable}
icon={icon}
title={title}
sections={sections}
titlePrefix={titlePrefix}
/>
<Body
disabled={disabled}
expanded={expanded}
body={body}
/>
</Card>
)
icon,
title,
sections,
body,
onClick,
expanded,
disabled,
editable,
toggleable,
className,
titlePrefix,
iconWrapperStyle,
type,
...rest
}) => {
const resolvedClassName = classnames(css.collapsible, className, {[css.disabled]: disabled})
let cardType = CARD_TYPES.DEFAULT
if (type === TYPES.ERROR) {
cardType = CARD_TYPES.ERROR
} else if (type === TYPES.SUCCESS) {
cardType = CARD_TYPES.SUCCESS
} else if (type === TYPES.CLICKER) {
cardType = CARD_TYPES.CLICKER
} else if (disabled) {
cardType = CARD_TYPES.DISABLED
}
return (
<Card
type={cardType}
hover
hovering={expanded}
clickable={false}
className={resolvedClassName}
{...rest}
>
<Header
onClick={onClick}
expanded={expanded}
disabled={disabled}
toggleable={toggleable}
editable={editable}
icon={icon}
iconWrapperStyle={iconWrapperStyle}
title={title}
sections={sections}
titlePrefix={titlePrefix}
/>
<Body
disabled={disabled}
expanded={expanded}
body={body}
/>
</Card>
)
}

CollapsibleItem.propTypes = {
onClick: PropTypes.func,
editable: PropTypes.bool,
expanded: PropTypes.bool,
toggleable: PropTypes.bool,
type: PropTypes.oneOf(Object.values(TYPES)),
disabled: PropTypes.bool,
icon: PropTypes.string,
title: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
sections: PropTypes.oneOfType([
PropTypes.element,
PropTypes.arrayOf(PropTypes.element)
]),
body: PropTypes.element,
className: PropTypes.string,
titlePrefix: PropTypes.array
onClick: PropTypes.func,
editable: PropTypes.bool,
expanded: PropTypes.bool,
toggleable: PropTypes.bool,
type: PropTypes.oneOf(Object.values(TYPES)),
disabled: PropTypes.bool,
icon: PropTypes.string,
title: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
sections: PropTypes.oneOfType([
PropTypes.element,
PropTypes.arrayOf(PropTypes.element)
]),
body: PropTypes.element,
className: PropTypes.string,
titlePrefix: PropTypes.array
}
CollapsibleItem.defaultProps = {
onClick: _.noop,
type: TYPES.DEFAULT,
editable: false,
expanded: false,
disabled: false,
toggleable: false,
icon: '',
title: null,
sections: null
onClick: _.noop,
type: TYPES.DEFAULT,
editable: false,
expanded: false,
disabled: false,
toggleable: false,
icon: '',
title: null,
sections: null
}

CollapsibleItem.TYPES = TYPES
Expand Down
Loading

0 comments on commit 9f57c02

Please sign in to comment.