Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Heap error is swallowed in Spock 2, feature is skipped, subsequent features don't run #1294

Closed
treyturner opened this issue Mar 11, 2021 · 1 comment · Fixed by #1295
Assignees
Labels

Comments

@treyturner
Copy link

Issue description

A Spock feature that throws an java.lang.OutOfMemoryError: Java heap space exception will have its exception apparently swallowed by Spock 2.0 (I tried both M2 and M4). The offending feature will be returned as skipped, and no subsequent features in the specification are executed.

By comparison, Spock 1.3 will throw the heap error, fail the offending feature, and still execute subsequent features, which are all more desireable behaviors.

I am happy to explain this or the MRE linked below further if/as needed.

How to reproduce

Here is a minimal reproducible example in the form of a Gradle project, which has subprojects for Spock 1.3 and Spock 2.0 so you can easily see the difference:

https://github.com/treyturner/spock-2-silent-heap-error-skips-tests

Java/JDK

java version "10.0.2" 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

Groovy version

3.0.6 and 3.0.7 - affected
2.5.14 - unaffected

Gradle

Gradle 6.7

Operating System

Windows 10 1909 (18363.1316)

IDE

IntelliJ IDEA Community Edition 2020.3.2

Build-tool dependencies used

implementation "org.apache.poi:poi:5.0.0"
implementation "org.apache.poi:poi-ooxml:5.0.0"
@treyturner treyturner changed the title Bug: Heap error is swallowed in Spock 2, test is skipped, subsequent tests don't run Bug: Heap error is swallowed in Spock 2, feature is skipped, subsequent features don't run Mar 11, 2021
@leonard84 leonard84 added the bug label Mar 11, 2021
@leonard84 leonard84 self-assigned this Mar 11, 2021
leonard84 referenced this issue in leonard84/spock Mar 11, 2021
leonard84 added a commit that referenced this issue Mar 11, 2021
@leonard84
Copy link
Member

Thanks @treyturner, btw the MCVE was just

class OomSpec extends Specification {
  def a() {
    expect:
    throw new OutOfMemoryError()
  }
}

but thanks for providing that example project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants