From e054eac3bd2f7bdb558db12239d2158e8c3cd115 Mon Sep 17 00:00:00 2001 From: moozzyk Date: Tue, 12 Apr 2016 15:51:53 -0700 Subject: [PATCH] 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 --- .../Properties/AssemblyInfo.cs | 3 +++ .../Scenario/ProjectToolScenario.cs | 8 +++++++- test/dotnet-watch.FunctionalTests/Waiters.cs | 19 +++++++++++++++---- 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 test/dotnet-watch.FunctionalTests/Properties/AssemblyInfo.cs diff --git a/test/dotnet-watch.FunctionalTests/Properties/AssemblyInfo.cs b/test/dotnet-watch.FunctionalTests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..d776ca34eb --- /dev/null +++ b/test/dotnet-watch.FunctionalTests/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using Xunit; + +[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)] \ No newline at end of file diff --git a/test/dotnet-watch.FunctionalTests/Scenario/ProjectToolScenario.cs b/test/dotnet-watch.FunctionalTests/Scenario/ProjectToolScenario.cs index c4976ef3ac..e2f548e7a2 100644 --- a/test/dotnet-watch.FunctionalTests/Scenario/ProjectToolScenario.cs +++ b/test/dotnet-watch.FunctionalTests/Scenario/ProjectToolScenario.cs @@ -67,12 +67,18 @@ namespace Microsoft.DotNet.Watcher.FunctionalTests var projectFile = Path.Combine(WorkFolder, projectName, "project.json"); 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)); projectJson.Add("tools", new JObject( new JProperty(toolName, new JObject( - new JProperty("version", "1.0.0-*"), + new JProperty("version", "1.0.0-" + versionSuffix), new JProperty("imports", "portable-net451+win8"))))); File.WriteAllText(projectFile, projectJson.ToString()); diff --git a/test/dotnet-watch.FunctionalTests/Waiters.cs b/test/dotnet-watch.FunctionalTests/Waiters.cs index b24a11e054..a65a80feb3 100644 --- a/test/dotnet-watch.FunctionalTests/Waiters.cs +++ b/test/dotnet-watch.FunctionalTests/Waiters.cs @@ -14,6 +14,8 @@ namespace Microsoft.DotNet.Watcher.FunctionalTests { var watch = new Stopwatch(); + Exception lastException = null; + watch.Start(); while (watch.Elapsed < timeout) { @@ -23,14 +25,21 @@ namespace Microsoft.DotNet.Watcher.FunctionalTests watch.Stop(); return; } - catch + catch (Exception e) { + lastException = e; } Thread.Sleep(500); } 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) @@ -41,8 +50,10 @@ namespace Microsoft.DotNet.Watcher.FunctionalTests { process = Process.GetProcessById(processId); } - catch + catch (Exception e) { + Console.WriteLine("Could not get process id:"); + Console.WriteLine(e); } var watch = new Stopwatch(); @@ -60,7 +71,7 @@ namespace Microsoft.DotNet.Watcher.FunctionalTests bool isStopped = process == null || process.HasExited; if (isStopped != expectedToStop) { - throw new Exception(errorMessage); + throw new InvalidOperationException(errorMessage); } } }