Fix dotnet watch tests on Helix (#19021)

This commit is contained in:
Brennan 2020-02-14 11:34:11 -08:00 committed by GitHub
parent 7e094d7b7d
commit 50ef4faf14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 21 deletions

View File

@ -19,7 +19,8 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
_app = new AppWithDeps(logger); _app = new AppWithDeps(logger);
} }
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/8267")] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task ChangeFileInDependency() public async Task ChangeFileInDependency()
{ {
await _app.StartWatcherAsync(); await _app.StartWatcherAsync();

View File

@ -21,6 +21,7 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
private BufferBlock<string> _source; private BufferBlock<string> _source;
private ITestOutputHelper _logger; private ITestOutputHelper _logger;
private TaskCompletionSource<int> _exited; private TaskCompletionSource<int> _exited;
private bool _started;
public AwaitableProcess(ProcessSpec spec, ITestOutputHelper logger) public AwaitableProcess(ProcessSpec spec, ITestOutputHelper logger)
{ {
@ -72,6 +73,7 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
_process.Exited += OnExit; _process.Exited += OnExit;
_process.Start(); _process.Start();
_started = true;
_process.BeginErrorReadLine(); _process.BeginErrorReadLine();
_process.BeginOutputReadLine(); _process.BeginOutputReadLine();
_logger.WriteLine($"{DateTime.Now}: process start: '{_process.StartInfo.FileName} {_process.StartInfo.Arguments}'"); _logger.WriteLine($"{DateTime.Now}: process start: '{_process.StartInfo.FileName} {_process.StartInfo.Arguments}'");
@ -150,7 +152,7 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
if (_process != null) if (_process != null)
{ {
if (!_process.HasExited) if (_started && !_process.HasExited)
{ {
_process.KillTree(); _process.KillTree();
} }

View File

@ -22,8 +22,8 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
_app = new KitchenSinkApp(logger); _app = new KitchenSinkApp(logger);
} }
[ConditionalFact] [Fact]
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/8267")] [Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task RunsWithDotnetWatchEnvVariable() public async Task RunsWithDotnetWatchEnvVariable()
{ {
Assert.True(string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DOTNET_WATCH")), "DOTNET_WATCH cannot be set already when this test is running"); Assert.True(string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DOTNET_WATCH")), "DOTNET_WATCH cannot be set already when this test is running");
@ -36,7 +36,7 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
} }
[Fact] [Fact]
[Flaky("https://github.com/dotnet/aspnetcore-internal/issues/1826", FlakyOn.All)] [Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task RunsWithIterationEnvVariable() public async Task RunsWithIterationEnvVariable()
{ {
await _app.StartWatcherAsync(); await _app.StartWatcherAsync();

View File

@ -21,9 +21,10 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
_app = new GlobbingApp(logger); _app = new GlobbingApp(logger);
} }
[Theory(Skip = "https://github.com/dotnet/aspnetcore/issues/8267")] [Theory]
[InlineData(true)] [InlineData(true)]
[InlineData(false)] [InlineData(false)]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task ChangeCompiledFile(bool usePollingWatcher) public async Task ChangeCompiledFile(bool usePollingWatcher)
{ {
_app.UsePollingWatcher = usePollingWatcher; _app.UsePollingWatcher = usePollingWatcher;
@ -41,7 +42,8 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
Assert.Equal(2, types); Assert.Equal(2, types);
} }
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/8267")] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task DeleteCompiledFile() public async Task DeleteCompiledFile()
{ {
await _app.StartWatcherAsync(); await _app.StartWatcherAsync();
@ -57,7 +59,8 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
Assert.Equal(1, types); Assert.Equal(1, types);
} }
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/8267")] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task DeleteSourceFolder() public async Task DeleteSourceFolder()
{ {
await _app.StartWatcherAsync(); await _app.StartWatcherAsync();
@ -73,7 +76,8 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
Assert.Equal(1, types); Assert.Equal(1, types);
} }
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/8987")] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task RenameCompiledFile() public async Task RenameCompiledFile()
{ {
await _app.StartWatcherAsync(); await _app.StartWatcherAsync();
@ -85,8 +89,8 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
await _app.HasRestarted(); await _app.HasRestarted();
} }
[ConditionalFact] [Fact]
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/8267")] [Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task ChangeExcludedFile() public async Task ChangeExcludedFile()
{ {
await _app.StartWatcherAsync(); await _app.StartWatcherAsync();
@ -99,8 +103,8 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
Assert.NotSame(restart, finished); Assert.NotSame(restart, finished);
} }
[ConditionalFact] [Fact]
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/8267")] [Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task ListsFiles() public async Task ListsFiles()
{ {
await _app.PrepareAsync(); await _app.PrepareAsync();

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing;
@ -24,7 +23,8 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
_output = logger; _output = logger;
} }
[Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/8267")] [Fact]
[Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task RestartProcessOnFileChange() public async Task RestartProcessOnFileChange()
{ {
await _app.StartWatcherAsync(new[] { "--no-exit" }); await _app.StartWatcherAsync(new[] { "--no-exit" });
@ -42,8 +42,8 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
Assert.NotEqual(processIdentifier, processIdentifier2); Assert.NotEqual(processIdentifier, processIdentifier2);
} }
[ConditionalFact] [Fact]
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/8267")] [Flaky("<No longer needed; tracked in Kusto>", FlakyOn.All)]
public async Task RestartProcessThatTerminatesAfterFileChange() public async Task RestartProcessThatTerminatesAfterFileChange()
{ {
await _app.StartWatcherAsync(); await _app.StartWatcherAsync();

View File

@ -8,7 +8,6 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.CommandLineUtils;
using Xunit.Abstractions; using Xunit.Abstractions;
namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
@ -89,9 +88,15 @@ namespace Microsoft.DotNet.Watcher.Tools.FunctionalTests
}; };
args.AddRange(arguments); args.AddRange(arguments);
var dotnetPath = typeof(WatchableApp).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>() var dotnetPath = "dotnet";
.Single(s => s.Key == "DotnetPath").Value;
// Fallback to embedded path to dotnet when not on helix
if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("helix")))
{
dotnetPath = typeof(WatchableApp).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
.Single(s => s.Key == "DotnetPath").Value;
}
var spec = new ProcessSpec var spec = new ProcessSpec
{ {
Executable = dotnetPath, Executable = dotnetPath,