Fix for wrong JSON format on OSTF tab
- iterating over testsets, not tests Closes-bug: #1466468 Change-Id: Ic19c489833b3ad8c5c21e7445997bbe3e30a8cff
This commit is contained in:
parent
233b8345f9
commit
78677f8e9a
@ -141,38 +141,45 @@ function($, _, i18n, Backbone, React, models, utils, componentMixins, controls)
|
|||||||
runTests: function() {
|
runTests: function() {
|
||||||
var testruns = new models.TestRuns(),
|
var testruns = new models.TestRuns(),
|
||||||
oldTestruns = new models.TestRuns(),
|
oldTestruns = new models.TestRuns(),
|
||||||
selectedTests = this.props.tests.where({checked: true});
|
testsetIds = this.props.testsets.pluck('id');
|
||||||
this.setState({actionInProgress: true});
|
this.setState({actionInProgress: true});
|
||||||
_.each(selectedTests, function(test) {
|
_.each(testsetIds, function(testsetId) {
|
||||||
var testsetId = test.get('testset'),
|
var testsToRun = _.pluck(this.props.tests.where({
|
||||||
testrunConfig = {tests: _.pluck(selectedTests, 'id')},
|
testset: testsetId,
|
||||||
addCredentials = _.bind(function(obj) {
|
checked: true
|
||||||
obj.ostf_os_access_creds = {
|
}), 'id');
|
||||||
ostf_os_username: this.state.credentials.user,
|
if (testsToRun.length) {
|
||||||
ostf_os_tenant_name: this.state.credentials.tenant,
|
var testrunConfig = {tests: testsToRun},
|
||||||
ostf_os_password: this.state.credentials.password
|
addCredentials = _.bind(function(obj) {
|
||||||
};
|
obj.ostf_os_access_creds = {
|
||||||
return obj;
|
ostf_os_username: this.state.credentials.user,
|
||||||
}, this);
|
ostf_os_tenant_name: this.state.credentials.tenant,
|
||||||
if (this.props.testruns.where({testset: testsetId}).length) {
|
ostf_os_password: this.state.credentials.password
|
||||||
_.each(this.props.testruns.where({testset: testsetId}), function(testrun) {
|
};
|
||||||
_.extend(testrunConfig, addCredentials({
|
return obj;
|
||||||
id: testrun.id,
|
}, this);
|
||||||
status: 'restarted'
|
|
||||||
}));
|
if (this.props.testruns.where({testset: testsetId}).length) {
|
||||||
oldTestruns.add(new models.TestRun(testrunConfig));
|
_.each(this.props.testruns.where({testset: testsetId}), function(testrun) {
|
||||||
}, this);
|
_.extend(testrunConfig, addCredentials({
|
||||||
} else {
|
id: testrun.id,
|
||||||
_.extend(testrunConfig, {
|
status: 'restarted'
|
||||||
testset: testsetId,
|
}));
|
||||||
metadata: addCredentials({
|
oldTestruns.add(new models.TestRun(testrunConfig));
|
||||||
config: {},
|
}, this);
|
||||||
cluster_id: this.props.cluster.id
|
} else {
|
||||||
})
|
_.extend(testrunConfig, {
|
||||||
});
|
testset: testsetId,
|
||||||
testruns.add(new models.TestRun(testrunConfig));
|
metadata: addCredentials({
|
||||||
|
config: {},
|
||||||
|
cluster_id: this.props.cluster.id
|
||||||
|
})
|
||||||
|
});
|
||||||
|
testruns.add(new models.TestRun(testrunConfig));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
var requests = [];
|
var requests = [];
|
||||||
if (testruns.length) {
|
if (testruns.length) {
|
||||||
requests.push(Backbone.sync('create', testruns));
|
requests.push(Backbone.sync('create', testruns));
|
||||||
|
Loading…
Reference in New Issue
Block a user