I have an array of testcases that I am attempting to add to a testset in Rally using the rally api's.
I iterate through the array and call this method for every testcase in the array. They are all being added to the same testset.
RallyConnect.prototype.addTestCaseToSet = function (tcObjectID, tcRef, tsObjectID, tsRef) {
return new Promise((resolve, reject) => {
// check to make sure it doesn't already exist
rallyApi.query({
ref: '/testset/' + tsObjectID + '/testcases',
fetch: "true",
query: queryUtils.where('ObjectID', '=', tcObjectID)
}, function (error, result) {
if (error) {
reject(error);
} else {
if (result.TotalResultCount > 0) {
resolve({ tsRef: tsRef, tcRef: tcRef, action: 'exists' });
} else {
rallyApi.add({
ref: tsRef,
collection: 'TestCases',
data: [{ _ref: refUtils.getRelative(tcRef) }]
}, function (error, result) {
if (error) {
reject(error);
} else {
resolve({ tsRef: tsRef, tcRef: tcRef, action:
'added' });
}
});
}
}
});
//});
});
}
I get the following error quite a bit and the process fails
Error: Could not add artifact to collection
at generateError (C:\src\testing_utility\node_modules\rally\dist\request.js:38:11)
at Request._callback (C:\src\testing_utility\node_modules\rally\dist\request.js:118:22)
at Request.self.callback (C:\src\testing_utility\node_modules\rally\node_modules\request\request.js:187:22)
at emitTwo (events.js:125:13)
at Request.emit (events.js:213:7)
at Request.<anonymous> (C:\src\testing_utility\node_modules\rally\node_modules\request\request.js:1044:10)
at emitOne (events.js:115:13)
at Request.emit (events.js:210:7)
at Gunzip.<anonymous> (C:\src\testing_utility\node_modules\rally\node_modules\request\request.js:965:12)
at emitNone (events.js:110:20)
errors:
[ 'Could not add artifact to collection',
'Concurrency conflict: [Object has been modified since being read for update in this context] - ConcurrencyConflictException : Modified since read on update
: Object Class : com.f4tech.slm.domain.TestSet : ObjectID : 203533554680' ] }
Has anyone else run into this issues and know what I can do to ensure I don't get it.