Skip to content

Commit

Permalink
Fixes for unit tests
Browse files Browse the repository at this point in the history
Process runner test  adds -y to overwrite existing files

Add more debugging info to failing test result publishing
  • Loading branch information
atruskie committed Apr 4, 2020
1 parent 45e6232 commit bd65209
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion build/azure-pipelines-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,17 @@ jobs:
RunConfiguration.DisableAppDomain=true
displayName: Run Acoustics.Test
- pwsh: |
GetChild-Item -Recursive $(Agent.TempDirectory)/Acoustics.Test_Results
Get-Content $(Agent.TempDirectory)/Acoustics.Test_Results/*.trx
- task: PublishTestResults@2
inputs:
testResultFormat: VSTest
testResultsFiles: '**/*.trx'
searchFolder: $(Agent.TempDirectory)/Acoustics.Test_Results
testRunTitle: "Acoustics.Test for ${{ platform.rid }} ${{ configuration }}"
buildConfig: ${{ configuration }}
buildConfiguration: ${{ configuration }}
buildPlatform: $(platformTag)
publishRunAttachments: true
condition: succeededOrFailed()
Expand Down
2 changes: 1 addition & 1 deletion tests/Acoustics.Test/.runsettings
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Loggers>
<Logger friendlyName="console">
<Configuration>
<verbosity>detailed</verbosity>
<!-- <verbosity>detailed</verbosity> -->
</Configuration>
</Logger>
</Loggers>
Expand Down
8 changes: 4 additions & 4 deletions tests/Acoustics.Test/Shared/ProcessRunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public void ProcessRunnerSimple()
[RetryTestMethod(2)]
public void ProcessRunnerTimeOutDoesNotDeadlock()
{
var result = Enumerable.Range(0, 100).AsParallel().Select(this.RunFfprobeIndefinite).ToArray();
var result = Enumerable.Range(0, 100).AsParallel().Select(this.RunFfmpegIndefinite).ToArray();

Assert.IsTrue(result.All());
}

[RetryTestMethod(2)]
public void ProcessRunnerTimeOutSimple()
{
this.RunFfprobeIndefinite(0);
this.RunFfmpegIndefinite(0);
}

[TestMethod]
Expand Down Expand Up @@ -109,7 +109,7 @@ private bool RunFfprobe(int index)
return result;
}

private bool RunFfprobeIndefinite(int index)
private bool RunFfmpegIndefinite(int index)
{
var path = PathHelper.ResolveAssetPath(TestFile);
var dest = PathHelper.GetTempFile(this.TestOutputDirectory, ".mp3");
Expand All @@ -121,7 +121,7 @@ private bool RunFfprobeIndefinite(int index)

Assert.ThrowsException<ProcessRunner.ProcessMaximumRetriesException>(() =>
{
runner.Run($@"-i ""{path}"" -ar 8000 ""{dest}""", this.TestOutputDirectory.FullName);
runner.Run($@"-y -i ""{path}"" -ar 8000 ""{dest}""", this.TestOutputDirectory.FullName);
Assert.Fail($"Process running finished without timing out - this should not happen. Exit code: {runner.ExitCode}.\nStdout:\n{runner.StandardOutput}\nStdErr\n{runner.ErrorOutput}");
});
Expand Down

0 comments on commit bd65209

Please sign in to comment.