简体   繁体   English

TFS2015测试代理已终止-PowerShell脚本已完成,但出现错误

[英]TFS2015 Test Agent Aborted - PowerShell script completed with errors

I am running a TFS nightly build that for the last few days has not been able to complete all its tests. 我正在运行一个TFS夜间构建,该构建在过去几天中无法完成其所有测试。 It fails after several hours with a "Test run is aborted" message. 数小时后失败,并显示“测试运行已中止”消息。 Previous to this the tests always ran successfully, and no major changes(or even minor) have been made to the system that runs these tests. 在此之前,测试始终成功运行,并且未对运行这些测试的系统进行重大更改(甚至较小的更改)。

Information: 信息:

  • Two MStest runs in the build(unit tests) 在构建中运行两个MStest(单元测试)
  • Timeout is set to 20 hours 超时设置为20小时
  • Runs for approx. 运行约。 15 hours before failure 失败前15小时
  • Tests are set to continue on failure 测试将设置为继续失败

When I look in the TFS log for the latest run it lists the following(2017-04-11T06:42:47.5500707Z): 当我在TFS日志中查找最新运行时,它将列出以下内容(2017-04-11T06:42:47.5500707Z):

[warning]DistributedTests: Test run is aborted. [warning] DistributedTests:测试运行被中止。 Logging details of the run logs. 记录运行日志的详细信息。 [warning]DistributedTests: New test run created. [warning] DistributedTests:创建了新的测试运行。
[warning]Test Run queued for Project Collection Build Service [warning]测试运行已排队等待Project Collection Build Service
[warning]DistributedTests: Test discovery started. [warning] DistributedTests:测试发现已开始。
[warning]DistributedTests: Test Run Discovery Completed . [warning] DistributedTests:测试运行发现已完成。 Test run id: 533 测试运行ID:533
[warning]DistributedTests: 290 test cases discovered. [warning] DistributedTests:发现290个测试用例。
[warning]DistributedTests: Test execution started. [warning] DistributedTests:测试执行开始。 Test run id : 533 测试运行ID:533
[warning]DistributedTests: Test run timed out. [warning] DistributedTests:测试运行超时。 Test run id : 533 测试运行ID:533
[warning]DistributedTests: Test run aborted. [warning] DistributedTests:测试运行已中止。 Test run id: 533 测试运行ID:533
[error]The test run was aborted, failing the task. [错误]测试运行已中止,导致任务失败。

When I look at the run log(worker_20170410-234426-utc_864.log) I see: 当我查看运行日志(worker_20170410-234426-utc_864.log)时,我看到:

06:42:47.659516 BaseLogger.LogConsoleMessage(scope.JobId = 7ced7f31-e360-47f3-b334-ef20faeaf000, message = ##[error]The test run was aborted, failing the task.) 06:42:47.659516 Microsoft.TeamFoundation.DistributedTask.Agent.Common.AgentExecutionTerminationException: PowerShell script completed with errors. 06:42:47.659516 BaseLogger.LogConsoleMessage(scope.JobId = 7ced7f31-e360-47f3-b334-ef20faeaf000,消息= ## [错误]测试运行已中止,任务失败。)06:42:47.659516 Microsoft.TeamFoundation。 DistributedTask.Agent.Common.AgentExecutionTerminationException:PowerShell脚本已完成,但有错误。 at Microsoft.TeamFoundation.DistributedTask.Handlers.PowerShellHandler.Execute(ITaskContext context, CancellationToken cancellationToken) at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.RunTask(ITaskContext context, TaskWrapper task, CancellationTokenSource tokenSource) 在Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.RunTask(ITaskContext上下文,TaskWrapper任务,CancellationTokenSource tokenSource)在Microsoft.TeamFoundation.DistributedTask.Handlers.PowerShellHandler.Execute(ITaskContext上下文,CancellationToken cancelleToken)

In the test log , I don't see any errors in the VS, just a warning about not able to connect(I see these often): 测试日志中 ,我看不到VS中的任何错误,只是关于无法连接的警告(我经常看到这些错误):

W, 2060, 5, 2017/04/10, 16:26:03.595, XXXTESTING\\QTController.exe, Test of LoadTestResultConnectString failed: A network-related or instance-specific error occurred while establishing a connection to SQL Server. W,2060,5,2017/04/10,16:26:03.595,XXXTESTING \\ QTController.exe,LoadTestResultConnectString的测试失败:建立与SQL Server的连接时发生与网络相关或特定于实例的错误。 The server was not found or was not accessible. 服务器未找到或无法访问。 Verify that the instance name is correct and that SQL Server is configured to allow remote connections. 验证实例名称正确,并且已将SQL Server配置为允许远程连接。 (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (提供者:SQL网络接口,错误:26-指定服务器/实例时出错)

I also see an error thrown in the Application Event log at the same time: 我还同时看到了在应用程序事件日志中引发的错误:

The description for Event ID 0 from source Application cannot be found. 找不到源应用程序中事件ID 0的描述。 Either the component that raises this event is not installed on your local computer or the installation is corrupted. 引发此事件的组件未安装在本地计算机上,或者安装已损坏。 You can install or repair the component on the local computer. 您可以在本地计算机上安装或修复组件。

If the event originated on another computer, the display information had to be saved with the event. 如果事件起源于另一台计算机,则显示信息必须与事件一起保存。

The following information was included with the event: 该事件包括以下信息:

Error Handler Exception: System.ServiceModel.CommunicationException: There was an error reading from the pipe: The pipe has been ended. 错误处理程序异常:System.ServiceModel.CommunicationException:从管道读取错误:管道已结束。 (109, 0x6d). (109,0x6d)。 ---> System.IO.IOException: The read operation failed, see inner exception. ---> System.IO.IOException:读取操作失败,请参阅内部异常。 ---> System.ServiceModel.CommunicationException: There was an error reading from the pipe: The pipe has been ended. ---> System.ServiceModel.CommunicationException:管道读取错误:管道已结束。 (109, 0x6d). (109,0x6d)。 ---> System.IO.PipeException: There was an error reading from the pipe: The pipe has been ended. ---> System.IO.PipeException:管道读取错误:管道已结束。 (109, 0x6d)..... (109,0x6d).....

the message resource is present but the message is not found in the string/message table 消息资源存在,但在字符串/消息表中找不到消息

The issue is that I really don't know how to interpret these messages, each log just says "test run was aborted, failing the task", I'm not even certain the powershell issue is what caused it. 问题是我真的不知道如何解释这些消息,每个日志都只说“测试运行被中止,任务失败”,我什至不确定powershell问题是由什么引起的。 I'm also not sure that the error thrown in the application log is related, though it was thrown at exactly the same time that the run failed. 我也不确定在应用程序日志中引发的错误是否与之相关,尽管它是在运行失败的同一时间引发的。

It's also difficult to research this issue, when you really don't know what's causing the test agent to fail. 当您真的不知道导致测试代理失败的原因时,也很难研究这个问题。 There are posts related to VS , and to the TFS Test Agent , but these don't strike me as related issues, and of course there is this somewhat unhelpful post about the Powershell message . 有一些与VS有关的帖子,也有与TFS测试代理有关的帖子,但是这些帖子对我来说并不重要,当然,关于Powershell消息,这当然有些无用。

Has anyone seen this sort of issue before? 有人以前见过这种问题吗? I don't think anything on my build server has changed over the last few days(maybe updates...), what do you think would cause an issue like this to occur? 我认为最近几天构建服务器上的任何内容都没有发生变化(也许正在更新...),您认为会导致什么问题发生?

If you look at the failed build(containing tests) after it is aborted in the "Build" section of TFS, its says it was "Aborted", that's it... If you look at results of the build(containing tests) in the "Test" section of TFS it specified that the test run "Exceeded Timeout". 如果您在TFS的“构建”部分中查看失败的构建(包含测试)后发现失败,它会说它已“中止”,就是这样...如果您在以下位置查看构建(包含测试)的结果, TFS的“测试”部分指定测试运行“超出超时”。

Apparently MSTest was running up against the default value of this little gem . 显然,MSTest正在运行此小gem的默认值。 I think it defaults to 8 hours when not specified, but I'm not too sure about this. 我认为未指定时默认为8个小时,但是对此我不太确定。 Anyways I set the following setting in my "Default.testsettings" file: 无论如何,我在“ Default.testsettings”文件中设置了以下设置:

<?xml version="1.0" encoding="utf-8"?>  
<TestSettings name="TestSettings1">
  <Execution>
    <Timeouts runTimeout="200000000" />
  </Execution>
</TestSettings>

Seems to resolve the issue. 似乎可以解决问题。 Tests runs successfully and no longer time out. 测试成功运行,不再超时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM