From 900506752f226da25169377651916b512a78aa9b Mon Sep 17 00:00:00 2001 From: cpovirk Date: Tue, 26 Sep 2023 14:12:58 -0700 Subject: [PATCH] Skip a couple `ServiceManager` tests when running Java 8 on Windows. I've found them to be [flaky](https://github.com/google/guava/pull/6731#issuecomment-1736298607). We already [skip](https://github.com/google/guava/issues/2130) some tests under Windows, so what's two more (especially only under Java 8, which I didn't include when setting up [Windows CI](https://github.com/google/guava/issues/2686) and which I was testing only as part of https://github.com/google/guava/issues/6634)? RELNOTES=n/a PiperOrigin-RevId: 568645480 --- .../util/concurrent/ServiceManagerTest.java | 14 ++++++++++++++ .../util/concurrent/ServiceManagerTest.java | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/android/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java b/android/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java index b81dbaef6415..02815e3d151e 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java @@ -16,6 +16,8 @@ package com.google.common.util.concurrent; +import static com.google.common.base.StandardSystemProperty.JAVA_SPECIFICATION_VERSION; +import static com.google.common.base.StandardSystemProperty.OS_NAME; import static com.google.common.truth.Truth.assertThat; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import static java.util.Arrays.asList; @@ -121,6 +123,10 @@ protected void doStop() { } public void testServiceStartupTimes() { + if (isWindows() && isJava8()) { + // Flaky there: https://github.com/google/guava/pull/6731#issuecomment-1736298607 + return; + } Service a = new NoOpDelayedService(150); Service b = new NoOpDelayedService(353); ServiceManager serviceManager = new ServiceManager(asList(a, b)); @@ -639,4 +645,12 @@ public void failure(Service service) { failedServices.add(service); } } + + private static boolean isWindows() { + return OS_NAME.value().startsWith("Windows"); + } + + private static boolean isJava8() { + return JAVA_SPECIFICATION_VERSION.value().equals("1.8"); + } } diff --git a/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java b/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java index 01990e5f5435..44a667d1446f 100644 --- a/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/ServiceManagerTest.java @@ -16,6 +16,8 @@ package com.google.common.util.concurrent; +import static com.google.common.base.StandardSystemProperty.JAVA_SPECIFICATION_VERSION; +import static com.google.common.base.StandardSystemProperty.OS_NAME; import static com.google.common.truth.Truth.assertThat; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; import static java.util.Arrays.asList; @@ -122,6 +124,10 @@ protected void doStop() { } public void testServiceStartupTimes() { + if (isWindows() && isJava8()) { + // Flaky there: https://github.com/google/guava/pull/6731#issuecomment-1736298607 + return; + } Service a = new NoOpDelayedService(150); Service b = new NoOpDelayedService(353); ServiceManager serviceManager = new ServiceManager(asList(a, b)); @@ -133,6 +139,10 @@ public void testServiceStartupTimes() { } public void testServiceStartupDurations() { + if (isWindows() && isJava8()) { + // Flaky there: https://github.com/google/guava/pull/6731#issuecomment-1736298607 + return; + } Service a = new NoOpDelayedService(150); Service b = new NoOpDelayedService(353); ServiceManager serviceManager = new ServiceManager(asList(a, b)); @@ -651,4 +661,12 @@ public void failure(Service service) { failedServices.add(service); } } + + private static boolean isWindows() { + return OS_NAME.value().startsWith("Windows"); + } + + private static boolean isJava8() { + return JAVA_SPECIFICATION_VERSION.value().equals("1.8"); + } }