CA Rally - 并发冲突:[自从在此上下文中读取更新后对象已被修改] 错误
CA Rally - Concurrency conflict: [Object has been modified since being read for update in this context] Error
我有一组测试用例,我正尝试使用集会 api 将其添加到 Rally 中的测试集。
我遍历数组并为数组中的每个测试用例调用此方法。它们都被添加到同一个测试集中。
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' });
}
});
}
}
});
//});
});
}
我经常收到以下错误,进程失败
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' ] }
有其他人 运行 了解这个问题并且知道我可以做些什么来确保我不会得到它。
与其循环并一次添加一个测试用例,不如批量添加它们?
rallyApi.add({
ref: tsRef,
collection: 'TestCases',
data: [
{ _ref: refUtils.getRelative(tcRef1) },
{ _ref: refUtils.getRelative(tcRef2) }, //include multiples here
{ _ref: refUtils.getRelative(tcRef3) },
{ _ref: refUtils.getRelative(tcRef4) },
]
});
请注意,我认为这种方法限制为每批 25 条记录,因此根据您通常将多少数据关联到测试集,您可能必须将其分成 25 条记录。
要检查的另一件事是,您是否为每个调用使用相同的 rallyApi 实例?从您的代码看来是这样。只要这是真的,并且只要启用了 cookie,我认为您应该将所有请求固定到同一个应用服务器,并且不应该看到这些异常(这通常是由于在后台快速更新相关对象引起的)跨所有服务器节点的缓存同步)。
您也可以尝试在新建 rallyApi 实例时添加此配置:
{
requestOptions: { jar: true }
}
这应该确保您的请求保持 cookie。
https://rally1.rallydev.com/slm/doc/webservice/
具体来说:https://rally1.rallydev.com/slm/doc/webservice/bulk.jsp
不幸的是,我还没有想出如何通过批量上传将项目添加到集合中。我专门将缺陷引用添加到缺陷套件中。
我没有使用任何库....相反,我只是在召集集会API(这太糟糕了,让我想起了 90 年代)
为了社区的利益...我也收到了这条错误消息,但原因有所不同。我会把它放在这里,因为它是唯一在更广泛的网络上讨论过的地方。 (如果在 Rally 自己的论坛中隐藏了某个地方的讨论,请随时 link!)
我在试图保存我已经编辑了很长时间但没有保存的投资组合特征项目时遇到了错误(因为它是一个很大的领域,我不喜欢滚动浏览无穷无尽的修订版历史)。
我在该项目上有四个 image.pngs —— 来自我直接内嵌粘贴的东西,而不是通过 'Image' 按钮插入作为附件包含在内,其中一个或多个编辑器有消失了(有时确实如此)。
缺少一项或多项 image.png 'attachments' 无法放置,因此无法保存。我从附件中删除了 image.png 文件(实际图像没有从字段主体中消失!),之后它保存得很好。
我有一组测试用例,我正尝试使用集会 api 将其添加到 Rally 中的测试集。
我遍历数组并为数组中的每个测试用例调用此方法。它们都被添加到同一个测试集中。
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' });
}
});
}
}
});
//});
});
}
我经常收到以下错误,进程失败
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' ] }
有其他人 运行 了解这个问题并且知道我可以做些什么来确保我不会得到它。
与其循环并一次添加一个测试用例,不如批量添加它们?
rallyApi.add({
ref: tsRef,
collection: 'TestCases',
data: [
{ _ref: refUtils.getRelative(tcRef1) },
{ _ref: refUtils.getRelative(tcRef2) }, //include multiples here
{ _ref: refUtils.getRelative(tcRef3) },
{ _ref: refUtils.getRelative(tcRef4) },
]
});
请注意,我认为这种方法限制为每批 25 条记录,因此根据您通常将多少数据关联到测试集,您可能必须将其分成 25 条记录。
要检查的另一件事是,您是否为每个调用使用相同的 rallyApi 实例?从您的代码看来是这样。只要这是真的,并且只要启用了 cookie,我认为您应该将所有请求固定到同一个应用服务器,并且不应该看到这些异常(这通常是由于在后台快速更新相关对象引起的)跨所有服务器节点的缓存同步)。
您也可以尝试在新建 rallyApi 实例时添加此配置:
{
requestOptions: { jar: true }
}
这应该确保您的请求保持 cookie。
https://rally1.rallydev.com/slm/doc/webservice/
具体来说:https://rally1.rallydev.com/slm/doc/webservice/bulk.jsp
不幸的是,我还没有想出如何通过批量上传将项目添加到集合中。我专门将缺陷引用添加到缺陷套件中。
我没有使用任何库....相反,我只是在召集集会API(这太糟糕了,让我想起了 90 年代)
为了社区的利益...我也收到了这条错误消息,但原因有所不同。我会把它放在这里,因为它是唯一在更广泛的网络上讨论过的地方。 (如果在 Rally 自己的论坛中隐藏了某个地方的讨论,请随时 link!)
我在试图保存我已经编辑了很长时间但没有保存的投资组合特征项目时遇到了错误(因为它是一个很大的领域,我不喜欢滚动浏览无穷无尽的修订版历史)。
我在该项目上有四个 image.pngs —— 来自我直接内嵌粘贴的东西,而不是通过 'Image' 按钮插入作为附件包含在内,其中一个或多个编辑器有消失了(有时确实如此)。
缺少一项或多项 image.png 'attachments' 无法放置,因此无法保存。我从附件中删除了 image.png 文件(实际图像没有从字段主体中消失!),之后它保存得很好。