Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,6 @@
<value>Protocol version check failed. Make sure test runner and host are compatible.</value>
</data>
<data name="VersionCheckTimedout" xml:space="preserve">
<value>Failed to negotiate protocol. Wait for response timed out.</value>
<value>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
<note />
</trans-unit>
<trans-unit id="VersionCheckTimedout">
<source>Failed to negotiate protocol. Wait for response timed out.</source>
<target state="translated">Nepovedlo se vyjednat protokol. Při čekání na odpověď vypršel časový limit.</target>
<note />
<source>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</source>
<target state="new">Nepovedlo se vyjednat protokol. Při čekání na odpověď vypršel časový limit.</target>
<note></note>
</trans-unit>
</body>
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
<note />
</trans-unit>
<trans-unit id="VersionCheckTimedout">
<source>Failed to negotiate protocol. Wait for response timed out.</source>
<target state="translated">Fehler beim Verhandeln des Protokolls. Timeout beim Warten auf Antwort.</target>
<note />
<source>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</source>
<target state="new">Fehler beim Verhandeln des Protokolls. Timeout beim Warten auf Antwort.</target>
<note></note>
</trans-unit>
</body>
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
<note />
</trans-unit>
<trans-unit id="VersionCheckTimedout">
<source>Failed to negotiate protocol. Wait for response timed out.</source>
<target state="translated">No se pudo negociar el protocolo. Se agotó el tiempo de espera para la respuesta.</target>
<note />
<source>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</source>
<target state="new">No se pudo negociar el protocolo. Se agotó el tiempo de espera para la respuesta.</target>
<note></note>
</trans-unit>
</body>
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
<note />
</trans-unit>
<trans-unit id="VersionCheckTimedout">
<source>Failed to negotiate protocol. Wait for response timed out.</source>
<target state="translated">Échec de la négociation du protocole. Expiration du délai d'attente de la réponse.</target>
<note />
<source>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</source>
<target state="new">Échec de la négociation du protocole. Expiration du délai d'attente de la réponse.</target>
<note></note>
</trans-unit>
</body>
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
<note />
</trans-unit>
<trans-unit id="VersionCheckTimedout">
<source>Failed to negotiate protocol. Wait for response timed out.</source>
<target state="translated">Non è stato possibile negoziare il protocollo. Si è verificato un timeout durante l'attesa della risposta.</target>
<note />
<source>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</source>
<target state="new">Non è stato possibile negoziare il protocollo. Si è verificato un timeout durante l'attesa della risposta.</target>
<note></note>
</trans-unit>
</body>
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
<note />
</trans-unit>
<trans-unit id="VersionCheckTimedout">
<source>Failed to negotiate protocol. Wait for response timed out.</source>
<target state="translated">プロトコルをネゴシエートできませんでした。応答がタイムアウトするまでしばらくお待ちください。</target>
<note />
<source>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</source>
<target state="new">プロトコルをネゴシエートできませんでした。応答がタイムアウトするまでしばらくお待ちください。</target>
<note></note>
</trans-unit>
</body>
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
<note />
</trans-unit>
<trans-unit id="VersionCheckTimedout">
<source>Failed to negotiate protocol. Wait for response timed out.</source>
<target state="translated">프로토콜을 협상하지 못했습니다. 응답 시간이 초과될 때까지 기다려 주세요.</target>
<note />
<source>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</source>
<target state="new">프로토콜을 협상하지 못했습니다. 응답 시간이 초과될 때까지 기다려 주세요.</target>
<note></note>
</trans-unit>
</body>
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
<note />
</trans-unit>
<trans-unit id="VersionCheckTimedout">
<source>Failed to negotiate protocol. Wait for response timed out.</source>
<target state="translated">Nie można negocjować protokołu. Zaczekaj na przekroczenie limitu czasu odpowiedzi.</target>
<note />
<source>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</source>
<target state="new">Nie można negocjować protokołu. Zaczekaj na przekroczenie limitu czasu odpowiedzi.</target>
<note></note>
</trans-unit>
</body>
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
<note />
</trans-unit>
<trans-unit id="VersionCheckTimedout">
<source>Failed to negotiate protocol. Wait for response timed out.</source>
<target state="translated">Falha ao negociar o protocolo. Aguarde a resposta atingir o tempo limite.</target>
<note />
<source>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</source>
<target state="new">Falha ao negociar o protocolo. Aguarde a resposta atingir o tempo limite.</target>
<note></note>
</trans-unit>
</body>
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
<note />
</trans-unit>
<trans-unit id="VersionCheckTimedout">
<source>Failed to negotiate protocol. Wait for response timed out.</source>
<target state="translated">Не удалось согласовать протокол. Подождите, пока истечет время ожидания ответа.</target>
<note />
<source>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</source>
<target state="new">Не удалось согласовать протокол. Подождите, пока истечет время ожидания ответа.</target>
<note></note>
</trans-unit>
</body>
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
<note />
</trans-unit>
<trans-unit id="VersionCheckTimedout">
<source>Failed to negotiate protocol. Wait for response timed out.</source>
<target state="translated">Protokol üzerinde anlaşmaya varılamadı. Yanıt beklenirken zaman aşımı gerçekleşti.</target>
<note />
<source>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</source>
<target state="new">Protokol üzerinde anlaşmaya varılamadı. Yanıt beklenirken zaman aşımı gerçekleşti.</target>
<note></note>
</trans-unit>
</body>
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<note></note>
</trans-unit>
<trans-unit id="VersionCheckTimedout">
<source>Failed to negotiate protocol. Wait for response timed out.</source>
<source>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</source>
<target state="new">Failed to negotiate protocol. Wait for response timed out.</target>
<note></note>
</trans-unit>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
<note />
</trans-unit>
<trans-unit id="VersionCheckTimedout">
<source>Failed to negotiate protocol. Wait for response timed out.</source>
<target state="translated">未能协商协议。等待响应超时。</target>
<note />
<source>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</source>
<target state="new">未能协商协议。等待响应超时。</target>
<note></note>
</trans-unit>
</body>
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
<note />
</trans-unit>
<trans-unit id="VersionCheckTimedout">
<source>Failed to negotiate protocol. Wait for response timed out.</source>
<target state="translated">無法交涉通訊協定。請等候回應逾時。</target>
<note />
<source>Failed to negotiate protocol, Timeout: {0} milliseconds occured while waiting for response, Set enviroment variable {1} to increase timeout.</source>
<target state="new">無法交涉通訊協定。請等候回應逾時。</target>
<note></note>
</trans-unit>
</body>
</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities
using System.Collections.Generic;
using System.Globalization;
using System.Threading;

using CoreUtilities.Helpers;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;

using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions;
using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces;
using CommonResources = Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources.Resources;

/// <summary>
Expand All @@ -26,6 +27,8 @@ public class TestRequestSender : ITestRequestSender

private readonly IDataSerializer dataSerializer;

private readonly IEnvironment environment;

private readonly ManualResetEventSlim connected;

private readonly ManualResetEventSlim clientExited;
Expand Down Expand Up @@ -60,7 +63,7 @@ public class TestRequestSender : ITestRequestSender
/// <param name="protocolConfig">Protocol configuration.</param>
/// <param name="connectionInfo">Transport layer to set up connection</param>
public TestRequestSender(ProtocolConfig protocolConfig, TestHostConnectionInfo connectionInfo)
: this(connectionInfo, JsonDataSerializer.Instance, protocolConfig, ClientProcessExitWaitTimeout)
: this(connectionInfo, JsonDataSerializer.Instance, protocolConfig, ClientProcessExitWaitTimeout, new PlatformEnvironment())
{
this.SetCommunicationEndPoint();
}
Expand All @@ -69,9 +72,11 @@ internal TestRequestSender(
TestHostConnectionInfo connectionInfo,
IDataSerializer serializer,
ProtocolConfig protocolConfig,
int clientExitedWaitTime)
int clientExitedWaitTime,
IEnvironment environment)
{
this.dataSerializer = serializer;
this.environment = environment;
this.connected = new ManualResetEventSlim(false);
this.clientExited = new ManualResetEventSlim(false);
this.clientExitedWaitTime = clientExitedWaitTime;
Expand All @@ -95,13 +100,15 @@ internal TestRequestSender(
/// <param name="serializer">Serializer implementation.</param>
/// <param name="protocolConfig">Protocol configuration.</param>
/// <param name="clientExitedWaitTime">Time to wait for client process exit.</param>
/// <param name="environment"> Environment implementation.</param>
internal TestRequestSender(
ICommunicationEndPoint communicationEndPoint,
TestHostConnectionInfo connectionInfo,
IDataSerializer serializer,
ProtocolConfig protocolConfig,
int clientExitedWaitTime)
: this(connectionInfo, serializer, protocolConfig, clientExitedWaitTime)
int clientExitedWaitTime,
IEnvironment environment)
: this(connectionInfo, serializer, protocolConfig, clientExitedWaitTime, environment)
{
this.communicationEndpoint = communicationEndPoint;
}
Expand Down Expand Up @@ -198,9 +205,10 @@ public void CheckVersionWithTestHost()
this.channel.Send(data);

// Wait for negotiation response
if (!protocolNegotiated.WaitOne(60 * 1000))
var timeout = EnvironmentHelper.GetConnectionTimeout(this.environment, Constants.VstestTimeoutIncreaseByTimes, 90);
if (!protocolNegotiated.WaitOne(timeout))
{
throw new TestPlatformException(string.Format(CultureInfo.CurrentUICulture, CommonResources.VersionCheckTimedout));
throw new TestPlatformException(string.Format(CultureInfo.CurrentUICulture, CommonResources.VersionCheckTimedout, timeout, Constants.VstestTimeoutIncreaseByTimes));
}
}
finally
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation. All rights reserved.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to add more in CoreUtilities dll? can we move this to Testplatform.Utilities?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoreUtilities have basic utilities on BCL. TestPlatform.Utilities has OM + BCL Utilities.

// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.VisualStudio.TestPlatform.CoreUtilities.Helpers
{
using System;
using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces;

public class EnvironmentHelper

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is an IEnvironment Interface in platform abstractions, should it not move there?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will go for PlatformAbstration if there is need to do #if defs. This function not required that.

{
/// <summary>
/// Caluclate timeout based on environment and default value.
/// </summary>
/// <param name="environment">IEnvironment implementation. </param>
/// <param name="envVar"> Environment variable. </param>
/// <param name="defaultValue"> Default value in seconds. </param>
/// <returns cref="int"> Return value in milliseconds. </returns>
public static int GetConnectionTimeout(IEnvironment environment, string envVar, int defaultValue)
{
var increaseTimeoutByTimes = 1.0;
environment.GetEnviromentVariable(envVar, ref increaseTimeoutByTimes);
var timeout = increaseTimeoutByTimes * defaultValue * 1000;
return Convert.ToInt32(Math.Round(timeout));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client
using System.Linq;
using System.Reflection;
using System.Threading;

using CoreUtilities.Helpers;
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces;
using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Extensions;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
Expand Down Expand Up @@ -43,6 +43,7 @@ public abstract class ProxyOperationManager
private string testHostProcessStdError;
private bool testHostLaunched;
private IRequestData requestData;
private IEnvironment environment;

#region Constructors

Expand All @@ -53,17 +54,39 @@ public abstract class ProxyOperationManager
/// <param name="testHostManager">Test host manager instance.</param>
/// <param name="clientConnectionTimeout">Client Connection Timeout.</param>
protected ProxyOperationManager(IRequestData requestData, ITestRequestSender requestSender, ITestRuntimeProvider testHostManager, int clientConnectionTimeout)
:this(requestData, requestSender, testHostManager, clientConnectionTimeout, new ProcessHelper(), new PlatformEnvironment())
{
}

/// <summary>
/// Initializes a new instance of the <see cref="ProxyOperationManager"/> class
/// </summary>
/// <param name="requestSender">Request Sender instance.</param>
/// <param name="testHostManager">Test host manager instance.</param>
/// <param name="clientConnectionTimeout">Client Connection Timeout.</param>
/// <param name="processHelper">IProcessHelper implementation. </param>
/// <param name="environment">IEnvironment implementation.</param>
internal ProxyOperationManager(
IRequestData requestData,
ITestRequestSender requestSender,
ITestRuntimeProvider testHostManager,
int clientConnectionTimeout,
IProcessHelper processHelper,
IEnvironment environment)
{
this.RequestSender = requestSender;
this.connectionTimeout = clientConnectionTimeout;
this.testHostManager = testHostManager;
this.processHelper = new ProcessHelper();
this.processHelper = processHelper;
this.environment = environment;
this.initialized = false;
this.testHostLaunched = false;
this.testHostProcessId = -1;
this.requestData = requestData;
}



#endregion

#region Properties
Expand Down Expand Up @@ -93,14 +116,8 @@ protected ProxyOperationManager(IRequestData requestData, ITestRequestSender req
/// </returns>
public virtual bool SetupChannel(IEnumerable<string> sources, CancellationToken cancellationToken)
{
var connTimeout = this.connectionTimeout;
var connTimeout = EnvironmentHelper.GetConnectionTimeout(this.environment, Constants.VstestTimeoutIncreaseByTimes, this.connectionTimeout);

var userSpecifiedTimeout = Environment.GetEnvironmentVariable("VSTEST_CONNECTION_TIMEOUT");
if(!string.IsNullOrEmpty(userSpecifiedTimeout) && Int32.TryParse(userSpecifiedTimeout, out int result))
{
connTimeout = result * 1000;
}

if (!this.initialized)
{
this.testHostProcessStdError = string.Empty;
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.TestPlatform.CrossPlatEngine/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public class Constants
internal const string ParentProcessIdOption = "--parentprocessid";

/// <summary>
/// The connection timeout for clients in milliseconds.
/// The connection timeout for clients in seconds.
/// </summary>
internal const int ClientConnectionTimeout = 60 * 1000;
internal const int ClientConnectionTimeout = 90;
}
}
Loading