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

Limit Parallelism for some specs #786

Closed
fraquack opened this issue May 28, 2019 · 3 comments
Closed

Limit Parallelism for some specs #786

fraquack opened this issue May 28, 2019 · 3 comments
Assignees
Labels
enhancement ✨ Suggestions for adding new features or improving existing ones.
Milestone

Comments

@fraquack
Copy link

I'd like to use both Parallelism and System Extensions in my project.
Unfortunately System Extensions can't run concurrently.
A good trade-off would be to limit only the concurrent execution of specs that make use of System Extensions. I'm thinking about a sort of tag to identify these specs, translated in a lock that prevents their concurrent execution.

For instance:

class FooTest: StringSpec(concurrentTag = "environmentVariables"){
  withEnvironment("FooKey", "FooValue") {
    System.getenv("FooKey") shouldBe "FooValue"
  }
}

class BarTest: StringSpec(concurrentTag = "environmentVariables"){
  withEnvironment("FooKey", "BarValue") {
    System.getenv("FooKey") shouldBe "BarValue"
  }
}

Would this implementation be possible?

@sksamuel
Copy link
Member

The problem is if you disable parallelism for one spec, you have to ensure that no other specs are running when you start this one, and then carry on with other specs afterwards.

Perhaps one solution would be a flag on config - singleThreaded = true or parallelize = false or whatever nomenclature you prefer, that essentially tells the engine to run these specs at the end, single threaded, after all the others have completed.

@sksamuel sksamuel added the enhancement ✨ Suggestions for adding new features or improving existing ones. label May 28, 2019
@fraquack
Copy link
Author

Perhaps one solution would be a flag on config - singleThreaded = true or parallelize = false or whatever nomenclature you prefer, that essentially tells the engine to run these specs at the end, single threaded, after all the others have completed.

This is actually better than my original proposal, because you can use the real environment variables in the test, mocking them only at the end.

@sksamuel sksamuel added this to the 3.4 milestone Jun 9, 2019
@sksamuel sksamuel mentioned this issue Jun 9, 2019
39 tasks
@sksamuel sksamuel self-assigned this Jul 3, 2019
sksamuel added a commit that referenced this issue Jul 14, 2019
@sksamuel
Copy link
Member

Added for 3.4.
Annotate your class with @DoNotParallelize and those specs will never run in parallel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ Suggestions for adding new features or improving existing ones.
Projects
None yet
Development

No branches or pull requests

2 participants