Skip to content

Commit

Permalink
Skip certain long-running non-essential tests on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Feb 22, 2025
1 parent 473482e commit eaa00f5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 33 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
- "3.3.7"
- "3.2.7"

env:
CI: true

services:
rabbitmq:
image: rabbitmq:4-management
Expand All @@ -39,4 +42,4 @@ jobs:
run: BUNNY_RABBITMQCTL=DOCKER:${{job.services.rabbitmq.id}} BUNNY_RABBITMQ_PLUGINS=DOCKER:${{job.services.rabbitmq.id}} bin/ci/before_build.sh

- name: Run tests
run: bundle exec rspec -c
run: bundle exec rspec -c -fd spec/higher_level_api spec/lower_level_api spec/issues
1 change: 1 addition & 0 deletions lib/bunny/transport.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ def self.ping!(host, port, timeout)
end

def initialize_socket
@logger.debug("Usong connection timeout of #{@connect_timeout} when connecting to #{@host}:#{@port}")
begin
@socket = Bunny::SocketImpl.open(@host, @port,
:keepalive => @opts[:keepalive],
Expand Down
48 changes: 25 additions & 23 deletions spec/higher_level_api/integration/connection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -511,34 +511,36 @@ def local_hostname
end
end

context "initialized with unreachable host or port" do
it "fails to connect" do
expect do
c = described_class.new(port: 38000)
c.start
end.to raise_error(Bunny::TCPConnectionFailed)
end

it "is not connected" do
begin
c = described_class.new(port: 38000)
c.start
rescue Bunny::TCPConnectionFailed => e
true
unless ENV["CI"]
context "initialized with unreachable host or port" do
it "fails to connect" do
expect do
c = described_class.new(port: 38000, connection_timeout: 2)
c.start
end.to raise_error(Bunny::TCPConnectionFailed)
end

expect(subject.status).to eq :not_connected
end
it "is not connected" do
begin
c = described_class.new(port: 38000, connection_timeout: 2)
c.start
rescue Bunny::TCPConnectionFailed => e
true
end

it "is not open" do
begin
c = described_class.new(port: 38000)
c.start
rescue Bunny::TCPConnectionFailed => e
true
expect(subject.status).to eq :not_connected
end

expect(subject).not_to be_open
it "is not open" do
begin
c = described_class.new(port: 38000, connection_timeout: 2)
c.start
rescue Bunny::TCPConnectionFailed => e
true
end

expect(subject).not_to be_open
end
end
end

Expand Down
20 changes: 11 additions & 9 deletions spec/issues/issue202_spec.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
require "spec_helper"

describe Bunny::Session do
context "with unreachable host" do
it "raises Bunny::TCPConnectionFailed" do
begin
conn = Bunny.new(:hostname => "127.0.0.254", :port => 1433)
conn.start
unless ENV["CI"]
describe Bunny::Session do
context "with unreachable host" do
it "raises Bunny::TCPConnectionFailed" do
begin
conn = Bunny.new(hostname: "127.0.0.254", port: 1433, connection_timeout: 2)
conn.start

fail "expected 192.192.192.192 to be unreachable"
rescue Bunny::TCPConnectionFailed => e
fail "expected 192.192.192.192 to be unreachable"
rescue Bunny::TCPConnectionFailed => e
end
end
end
end
end
end

0 comments on commit eaa00f5

Please sign in to comment.