From 899d3547de428f8c40dd6fde2502a92ade75d2af Mon Sep 17 00:00:00 2001 From: Brian Pratt Date: Tue, 14 Nov 2023 15:10:44 -0800 Subject: [PATCH] Avoid running TestToolService on machines where it is consistently flaky (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. --- pwiz_tools/Skyline/TestFunctional/ToolServiceTest.cs | 6 ++++++ pwiz_tools/Skyline/TestUtil/AbstractUnitTest.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/pwiz_tools/Skyline/TestFunctional/ToolServiceTest.cs b/pwiz_tools/Skyline/TestFunctional/ToolServiceTest.cs index 156fcbcde9..d3cf9c7ee9 100644 --- a/pwiz_tools/Skyline/TestFunctional/ToolServiceTest.cs +++ b/pwiz_tools/Skyline/TestFunctional/ToolServiceTest.cs @@ -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 accumulatedExceptions = new List(); for (int attemptNumber = 0; attemptNumber < MAX_TEST_ATTEMPTS; attemptNumber++) { diff --git a/pwiz_tools/Skyline/TestUtil/AbstractUnitTest.cs b/pwiz_tools/Skyline/TestUtil/AbstractUnitTest.cs index 06ae6cd7c3..8e66448325 100644 --- a/pwiz_tools/Skyline/TestUtil/AbstractUnitTest.cs +++ b/pwiz_tools/Skyline/TestUtil/AbstractUnitTest.cs @@ -121,6 +121,12 @@ protected bool RunSmallMoleculeTestVersions set { TestContext.Properties["RunSmallMoleculeTestVersions"] = value.ToString(CultureInfo.InvariantCulture); } } + /// + /// Controls whether or not certain machines run the often flaky TestToolService + /// + 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"; + /// /// Perf tests (long running, huge-data-downloading) should be declared /// in the TestPerf namespace so that they can be skipped when the RunPerfTests