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

build a skip or disable feature for individual tests #277

Closed
loran-steinberger opened this issue Apr 27, 2022 · 2 comments
Closed

build a skip or disable feature for individual tests #277

loran-steinberger opened this issue Apr 27, 2022 · 2 comments
Labels
for/user-attention This issue needs user attention (feedback, rework, etc...) status/has-workaround This has a known workaround described

Comments

@loran-steinberger
Copy link

Motivation

As a user of blockhound, I would like to implement a test which I know will break and commit to my repo.
To prevent this test from breaking my build pipeline, a skip feature would prevent it from being run.

Desired solution

a utility function or annotation that marks tests as skipped by test runner

@pderop
Copy link
Contributor

pderop commented Jan 25, 2023

Hi @loran-steinberger ,

regarding this old issue ...
why not using a BlockHound integration plugin that would allow your test to block without breaking the test ?

Something like this:

package com.example;

public class MyTest {
    static {
        BlockHound.install(b -> {
            b.allowBlockingCallsInside("com.example.MyTest", "block");
        });
    }

    void block() throws InterruptedException {
        Thread.sleep(100);
    }

    @Test
    void testBlockHound2() throws ExecutionException, InterruptedException, TimeoutException {
        Mono.delay(Duration.ofSeconds(1))
                .doOnNext(it -> {
                    try {
                        block(); // this method can block, because we have allowed it to do so
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                })
                .block();
    }
}

@pderop pderop added for/user-attention This issue needs user attention (feedback, rework, etc...) status/has-workaround This has a known workaround described labels Jan 25, 2023
@pderop
Copy link
Contributor

pderop commented Jan 25, 2023

@loran-steinberger ,

I'm closing this one, because as said previously, BlockHound integration plugins can be used in order to avoid a blocking test to fail.
Of course, feel free to reopen if needed !
thanks.

@pderop pderop closed this as completed Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for/user-attention This issue needs user attention (feedback, rework, etc...) status/has-workaround This has a known workaround described
Projects
None yet
Development

No branches or pull requests

2 participants