Merge branch 'release/2.2'
This commit is contained in:
commit
fca90fe6be
|
|
@ -39,15 +39,25 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
|
||||||
var source = Path.Combine(_app.SourceDirectory, "Program.cs");
|
var source = Path.Combine(_app.SourceDirectory, "Program.cs");
|
||||||
var contents = File.ReadAllText(source);
|
var contents = File.ReadAllText(source);
|
||||||
const string messagePrefix = "DOTNET_WATCH_ITERATION = ";
|
const string messagePrefix = "DOTNET_WATCH_ITERATION = ";
|
||||||
for (var i = 1; i <= 4; i++)
|
for (var i = 1; i <= 3; i++)
|
||||||
{
|
{
|
||||||
var message = await _app.Process.GetOutputLineStartsWithAsync(messagePrefix, TimeSpan.FromMinutes(2));
|
var message = await _app.Process.GetOutputLineStartsWithAsync(messagePrefix, TimeSpan.FromMinutes(2));
|
||||||
var count = int.Parse(message.Substring(messagePrefix.Length), CultureInfo.InvariantCulture);
|
var count = int.Parse(message.Substring(messagePrefix.Length), CultureInfo.InvariantCulture);
|
||||||
Assert.Equal(i, count);
|
Assert.Equal(i, count);
|
||||||
|
|
||||||
File.Delete(source);
|
await _app.IsWaitingForFileChange();
|
||||||
File.WriteAllText(source, contents);
|
|
||||||
await _app.HasRestarted();
|
try
|
||||||
|
{
|
||||||
|
File.SetLastWriteTime(source, DateTime.Now);
|
||||||
|
await _app.HasRestarted();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// retry
|
||||||
|
File.SetLastWriteTime(source, DateTime.Now);
|
||||||
|
await _app.HasRestarted();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,19 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
|
||||||
await _app.IsWaitingForFileChange();
|
await _app.IsWaitingForFileChange();
|
||||||
|
|
||||||
var fileToChange = Path.Combine(_app.SourceDirectory, "Program.cs");
|
var fileToChange = Path.Combine(_app.SourceDirectory, "Program.cs");
|
||||||
var programCs = File.ReadAllText(fileToChange);
|
|
||||||
File.WriteAllText(fileToChange, programCs);
|
|
||||||
|
|
||||||
await _app.HasRestarted();
|
try
|
||||||
|
{
|
||||||
|
File.SetLastWriteTime(fileToChange, DateTime.Now);
|
||||||
|
await _app.HasRestarted();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// retry
|
||||||
|
File.SetLastWriteTime(fileToChange, DateTime.Now);
|
||||||
|
await _app.HasRestarted();
|
||||||
|
}
|
||||||
|
|
||||||
var pid2 = await _app.GetProcessId();
|
var pid2 = await _app.GetProcessId();
|
||||||
Assert.NotEqual(pid, pid2);
|
Assert.NotEqual(pid, pid2);
|
||||||
await _app.HasExited(); // process should exit after run
|
await _app.HasExited(); // process should exit after run
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue