Fixing tests to use the package that was just built
Disabling parallel run to prevent random issues Adding additional details that should help diagnose failures
This commit is contained in:
parent
8f1f3c0772
commit
e054eac3bd
|
|
@ -0,0 +1,3 @@
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]
|
||||||
|
|
@ -67,12 +67,18 @@ namespace Microsoft.DotNet.Watcher.FunctionalTests
|
||||||
var projectFile = Path.Combine(WorkFolder, projectName, "project.json");
|
var projectFile = Path.Combine(WorkFolder, projectName, "project.json");
|
||||||
Console.WriteLine($"Adding {toolName} to {projectFile}");
|
Console.WriteLine($"Adding {toolName} to {projectFile}");
|
||||||
|
|
||||||
|
var versionSuffix = Environment.GetEnvironmentVariable("DOTNET_BUILD_VERSION");
|
||||||
|
if (string.IsNullOrEmpty(versionSuffix))
|
||||||
|
{
|
||||||
|
versionSuffix = "*";
|
||||||
|
}
|
||||||
|
|
||||||
var projectJson = JObject.Parse(File.ReadAllText(projectFile));
|
var projectJson = JObject.Parse(File.ReadAllText(projectFile));
|
||||||
projectJson.Add("tools",
|
projectJson.Add("tools",
|
||||||
new JObject(
|
new JObject(
|
||||||
new JProperty(toolName,
|
new JProperty(toolName,
|
||||||
new JObject(
|
new JObject(
|
||||||
new JProperty("version", "1.0.0-*"),
|
new JProperty("version", "1.0.0-" + versionSuffix),
|
||||||
new JProperty("imports", "portable-net451+win8")))));
|
new JProperty("imports", "portable-net451+win8")))));
|
||||||
|
|
||||||
File.WriteAllText(projectFile, projectJson.ToString());
|
File.WriteAllText(projectFile, projectJson.ToString());
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ namespace Microsoft.DotNet.Watcher.FunctionalTests
|
||||||
{
|
{
|
||||||
var watch = new Stopwatch();
|
var watch = new Stopwatch();
|
||||||
|
|
||||||
|
Exception lastException = null;
|
||||||
|
|
||||||
watch.Start();
|
watch.Start();
|
||||||
while (watch.Elapsed < timeout)
|
while (watch.Elapsed < timeout)
|
||||||
{
|
{
|
||||||
|
|
@ -23,14 +25,21 @@ namespace Microsoft.DotNet.Watcher.FunctionalTests
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
lastException = e;
|
||||||
}
|
}
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
}
|
}
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
|
|
||||||
throw new Exception($"{file} is not readable.");
|
if (lastException != null)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Last exception:");
|
||||||
|
Console.WriteLine(lastException);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new InvalidOperationException($"{file} is not readable.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WaitForProcessToStop(int processId, TimeSpan timeout, bool expectedToStop, string errorMessage)
|
public static void WaitForProcessToStop(int processId, TimeSpan timeout, bool expectedToStop, string errorMessage)
|
||||||
|
|
@ -41,8 +50,10 @@ namespace Microsoft.DotNet.Watcher.FunctionalTests
|
||||||
{
|
{
|
||||||
process = Process.GetProcessById(processId);
|
process = Process.GetProcessById(processId);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Could not get process id:");
|
||||||
|
Console.WriteLine(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
var watch = new Stopwatch();
|
var watch = new Stopwatch();
|
||||||
|
|
@ -60,7 +71,7 @@ namespace Microsoft.DotNet.Watcher.FunctionalTests
|
||||||
bool isStopped = process == null || process.HasExited;
|
bool isStopped = process == null || process.HasExited;
|
||||||
if (isStopped != expectedToStop)
|
if (isStopped != expectedToStop)
|
||||||
{
|
{
|
||||||
throw new Exception(errorMessage);
|
throw new InvalidOperationException(errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue