Skip to content

@Ignore / @IgnoreIf not working as expected #1169

Closed

Description

@jameskleeh

Issue description

Tests annotated with @ignore or @IgnoreIf({ << a true condition >> }) are executed in the github actions CI

How to reproduce

I can't reproduce the issue locally. I can only reproduce on CI

https://github.com/micronaut-projects/micronaut-core/runs/697317541?check_suite_focus=true#step:7:701

Here is the test at that commit:
https://github.com/micronaut-projects/micronaut-core/blob/2a721c30de89ad52b3a7a9294341a1fd1c841f56/discovery-client/src/test/groovy/io/micronaut/discovery/propertystore/AWSParameterStoreClientSpec.groovy#L48

Note that with Spock 1 / Groovy 2.5 this is not an issue

Additional Environment information

Gradle 6, Spock 2.0 M2, Groovy 3

Java/JDK

That specific build is failing on JDK8

Groovy version

3.0.3

Gradle

6.3

Operating System

The CI is running on a variant of Linux

IDE

N/A

Build-tool dependencies used

Gradle/Grails

testImplementation 'org.spockframework:spock-core:2.0-M2-groovy-3.0'

Given that this only fails on CI it seems there is probably some odd set of circumstances, however I wanted to see if perhaps you had any ideas for me to debug, etc.. Thanks!

Activity

  1. Vampire commented on May 25, 2020

    @Vampire
    Member

    My guess would be, that with 1.x the shared fields were not initialized if the spec was ignored and that now the shared fields are initialized unconditionally.
    It probably does not fail for you locally as you have the region configured locally for example in ~/.aws/config.
    So the bug here probably is that the shared field initializers are executed for ignored specs.

  2. Vampire commented on May 25, 2020

    @Vampire
    Member

    Jep, 1.3 code in BaseSpecRunner:

    public int run() {
      // Sometimes a spec run is requested even though the spec has been excluded
      // (e.g. if JUnit is in control). In such a case, the best thing we can do
      // is to treat the spec as skipped.
      if (spec.isExcluded() || spec.isSkipped()) {
        supervisor.specSkipped(spec);
        return OK;
      }
    
      createSpecInstance(true);
      runSharedInitializer();
      runSpec();
    
      return resetStatus(SPEC);
    }

    And now it is triggered unconditionally in SpecNode#prepare.
    @leonard84 can you have a look into this as you did all the JUnit 5 changes?
    I guess this should better be fixed before 2.0 final.

  3. jameskleeh commented on May 26, 2020

    @jameskleeh
    Author

    @Vampire Thanks for looking into it

  4. added this to the 2.0 milestone on Jul 1, 2020
  5. leonard84 commented on Aug 20, 2020

    @leonard84
    Member

    @marcphilipp any idea why it might ignore the shouldBeSkipped check?

  6. marcphilipp commented on Aug 20, 2020

    @marcphilipp
    Member

    Node.prepare is called before Node.shouldBeSkipped. Is that the underlying issue?

  7. leonard84 commented on Aug 21, 2020

    @leonard84
    Member

    Probably, so we should check the skip state there and don't create the shared instance if we want to skip the spec anyway.

  8. added 2 commits that reference this issue on Aug 21, 2020
    a6c5003
    a0a13a8
  9. added 2 commits that reference this issue on Sep 7, 2020
    0201c20
    0fcb27e
  10. added a commit that references this issue on Sep 8, 2020
    464097e
  11. jameskleeh commented on Sep 8, 2020

    @jameskleeh
    Author

    Thanks for the fix @leonard84 !

  12. leonard84 commented on Sep 9, 2020

    @leonard84
    Member

    @jameskleeh could you verify that it fixes you problem?

  13. jameskleeh commented on Sep 30, 2020

    @jameskleeh
    Author

    @leonard84 I'd love to. Can you do a release with this change?

  14. Vampire commented on Sep 30, 2020

    @Vampire
    Member

    Just try it in the snapshot version. Add https://oss.sonatype.org/content/repositories/snapshots as repository and use 2.0-SNAPSHOT as version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions