From c92f673b384c03a8fe9ddb71155016c8f66fe64a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20Br=C3=BCnings?= Date: Fri, 20 Dec 2024 12:31:44 +0100 Subject: [PATCH] Isolate flaky timeout tests --- .../smoke/extension/GlobalTimeoutExtension.groovy | 5 +++-- .../spock/util/concurrent/BlockingVariableSpec.groovy | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/spock-specs/src/test/groovy/org/spockframework/smoke/extension/GlobalTimeoutExtension.groovy b/spock-specs/src/test/groovy/org/spockframework/smoke/extension/GlobalTimeoutExtension.groovy index cc39e73fd1..6dafd10baa 100644 --- a/spock-specs/src/test/groovy/org/spockframework/smoke/extension/GlobalTimeoutExtension.groovy +++ b/spock-specs/src/test/groovy/org/spockframework/smoke/extension/GlobalTimeoutExtension.groovy @@ -1,12 +1,13 @@ package org.spockframework.smoke.extension - +import spock.lang.Isolated import spock.timeout.BaseTimeoutExtensionSpecification import java.time.Duration import org.spockframework.runtime.SpockTimeoutError +@Isolated("The timings are quite tight and it can get flaky on weak machines if run in parallel.") class GlobalTimeoutExtension extends BaseTimeoutExtensionSpecification { def "applies timeout to features"() { given: @@ -151,7 +152,7 @@ class GlobalTimeoutExtension extends BaseTimeoutExtensionSpecification { def "can exclude fixture methods from global timeout"() { given: - enableGlobalTimeout(false, Duration.ofMillis(5)) + enableGlobalTimeout(false, Duration.ofMillis(20)) when: runner.runSpecBody(""" diff --git a/spock-specs/src/test/groovy/spock/util/concurrent/BlockingVariableSpec.groovy b/spock-specs/src/test/groovy/spock/util/concurrent/BlockingVariableSpec.groovy index e7df8a6817..78f0a54f3a 100644 --- a/spock-specs/src/test/groovy/spock/util/concurrent/BlockingVariableSpec.groovy +++ b/spock-specs/src/test/groovy/spock/util/concurrent/BlockingVariableSpec.groovy @@ -19,9 +19,10 @@ import spock.lang.* import java.util.concurrent.TimeUnit import org.spockframework.runtime.SpockTimeoutError +@Isolated("The test can get flaky on weak machines if run in parallel.") class BlockingVariableSpec extends Specification { def "variable is read after it is written"() { - def list = new BlockingVariable>() + def list = new BlockingVariable>() when: Thread.start { @@ -35,7 +36,7 @@ class BlockingVariableSpec extends Specification { } def "variable is read before it is written"() { - def list = new BlockingVariable>() + def list = new BlockingVariable>() when: Thread.start { @@ -49,7 +50,7 @@ class BlockingVariableSpec extends Specification { } def "read times out if no write occurs"() { - def list = new BlockingVariable() + def list = new BlockingVariable() when: list.get()