Skip to content

Commit

Permalink
Isolate flaky timeout tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leonard84 committed Dec 20, 2024
1 parent 9a3ab97 commit 2436da9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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("""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<List<String>>()
def list = new BlockingVariable<List<Integer>>()

when:
Thread.start {
Expand All @@ -35,7 +36,7 @@ class BlockingVariableSpec extends Specification {
}

def "variable is read before it is written"() {
def list = new BlockingVariable<List<String>>()
def list = new BlockingVariable<List<Integer>>()

when:
Thread.start {
Expand All @@ -49,7 +50,7 @@ class BlockingVariableSpec extends Specification {
}

def "read times out if no write occurs"() {
def list = new BlockingVariable<String>()
def list = new BlockingVariable<Integer>()

when:
list.get()
Expand Down

0 comments on commit 2436da9

Please sign in to comment.