Skip to content

Commit

Permalink
Avoid running TestToolService on machines where it is consistently fl…
Browse files Browse the repository at this point in the history
…aky (just BRENDANX-UW7 for now)

N.B. you can argue that placing the logic in AbstractUnitTest instead of the test itself is overly ornate, but I wanted it near other machine-specific test logic.
  • Loading branch information
bspratt authored Nov 14, 2023
1 parent d348552 commit 899d354
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pwiz_tools/Skyline/TestFunctional/ToolServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ public void TestToolService()
private const int MAX_TEST_ATTEMPTS = 2;
protected override void DoTest()
{
if (SkipTestToolService) // This test is flaky on certain machines, avoid gumming up the logs
{
Console.Write(MSG_SKIPPING_TEST_TOOL_SERVICE); // Log this via console for TestRunner
return;
}

List<Exception> accumulatedExceptions = new List<Exception>();
for (int attemptNumber = 0; attemptNumber < MAX_TEST_ATTEMPTS; attemptNumber++)
{
Expand Down
6 changes: 6 additions & 0 deletions pwiz_tools/Skyline/TestUtil/AbstractUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ protected bool RunSmallMoleculeTestVersions
set { TestContext.Properties["RunSmallMoleculeTestVersions"] = value.ToString(CultureInfo.InvariantCulture); }
}

/// <summary>
/// Controls whether or not certain machines run the often flaky TestToolService
/// </summary>
protected bool SkipTestToolService => Environment.MachineName.Equals(@"BRENDANX-UW7");
public const string MSG_SKIPPING_TEST_TOOL_SERVICE = @"AbstractUnitTest.SkipTestToolService is set for this machine, no test was actually performed";

/// <summary>
/// Perf tests (long running, huge-data-downloading) should be declared
/// in the TestPerf namespace so that they can be skipped when the RunPerfTests
Expand Down

0 comments on commit 899d354

Please sign in to comment.