Skip to content

Conversation

@jdelStrother
Copy link
Contributor

When there's a mix of timed & untimed files, the previous behaviour could produce a list of job groups with some empty elements in JobBuilder#balancer_jobs.

This could cause, eg, flatware rspec ./spec/mailers to send an empty file list to one of the spawned workers, causing that worker to run every single spec under ./spec.

I've also updated Cucumber::CLI & RSpec::CLI so that it doesn't spawn unnecessary workers if there's not enough jobs to fill them.

WDYT?

When there's a mix of timed & untimed files, the previous behaviour
could produce a list of job groups with some empty elements.
This could cause, eg, `flatware rspec ./spec/mailers` to send an empty
file list to one of the spawned workers, causing that worker to run
every single spec under ./spec
Comment on lines 18 to +34
def cucumber(*args)
config = Cucumber.configure args
jobs = load_jobs(args)

ensure_jobs(config)
formatter = Flatware::Cucumber::Formatters::Console.new($stdout, $stderr)

Flatware.verbose = options[:log]
sink = options['sink-endpoint']
Worker.spawn(count: workers, runner: Cucumber, sink: sink)
start_sink(
jobs: config.jobs,
workers: workers,
formatter: Flatware::Cucumber::Formatters::Console.new($stdout, $stderr)
)

spawn_count = [workers, jobs].min
Worker.spawn(count: spawn_count, runner: Cucumber, sink: options['sink-endpoint'])
start_sink(jobs: jobs, workers: spawn_count, formatter: formatter)
end

private

def ensure_jobs(config)
return if config.jobs.any?
def load_jobs(args)
config = Cucumber.configure args
return config.jobs if config.jobs.any?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed more than strictly necessary here, just so that the Flatware::Cucumber::CLI#cucumber method looks more like Flatware::RSpec::CLI#rspec.

I don't use cucumber myself so would welcome some extra testing here

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant