-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test suite run with concurrent workers
Part of #1
- Loading branch information
Showing
8 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require_relative "shared" | ||
|
||
RSpec.describe do | ||
it_behaves_like "kinda slow example" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require_relative "shared" | ||
|
||
RSpec.describe do | ||
it_behaves_like "kinda slow example" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require_relative "shared" | ||
|
||
RSpec.describe do | ||
it_behaves_like "kinda slow example" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require_relative "shared" | ||
|
||
RSpec.describe do | ||
it_behaves_like "kinda slow example" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require_relative "shared" | ||
|
||
RSpec.describe do | ||
it_behaves_like "kinda slow example" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
RSpec.shared_examples "kinda slow example" do | ||
it do | ||
sleep 2 | ||
expect(true).to be true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require "test_helpers" | ||
|
||
class TestConcurrentWorkers < RSpecQTest | ||
# The 'passing_concurrent' suite contains 5 spec files with a single example, | ||
# taking 1". We spawn that many workers so we expect roughly 1 second total | ||
# execution time. We add 1 second more to account for fork and rspec boot | ||
# overhead | ||
def test_passing_suite | ||
build_id = rand_id | ||
pids = [] | ||
job_count = 5 | ||
|
||
start = Process.clock_gettime(Process::CLOCK_MONOTONIC) | ||
|
||
job_count.times do | ||
pids << start_worker(build_id: build_id, suite: "passing_concurrent") | ||
end | ||
|
||
pids.each { |p| Process.wait(p) } | ||
|
||
elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start | ||
|
||
assert_operator elapsed, :<, 5 | ||
|
||
queue = RSpecQ::Queue.new(build_id, "foo", REDIS_HOST) | ||
|
||
assert_queue_well_formed(queue) | ||
assert queue.build_successful? | ||
assert_equal job_count, queue.example_count | ||
assert_equal job_count, queue.redis.zcard(queue.key_worker_heartbeats) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters