Skip to content

Commit

Permalink
fix deprecations in specs
Browse files Browse the repository at this point in the history
  • Loading branch information
janxious committed Jan 8, 2016
1 parent ccff0d9 commit 25927fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
22 changes: 11 additions & 11 deletions spec/agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def wait(n=0.2)
agent.gauge('connection_test', 1, 1234)
# nope:9999 does not resolve to anything, the agent will not resolve
# the address and refuse to start a worker thread
agent.should_not be_running
expect(agent.send(:running?)).to eq(false)
end
end

Expand Down Expand Up @@ -396,7 +396,7 @@ def wait(n=0.2)
wait
# The agent thread should have stopped running since the network write would
# have failed. The queue will still contain the metric that has yet to be sent
agent.should_not be_running
expect(agent.send(:running?)).to eq(false)
agent.queue.size.should == 1

end
Expand All @@ -413,7 +413,7 @@ def wait(n=0.2)
wait
# The agent thread should have stopped running since the network write would
# have failed. The queue will still contain the metric that has yet to be sent
agent.should_not be_running
expect(agent.send(:running?)).to eq(false)
agent.queue.size.should == 1
wait
# Start the server back up again
Expand All @@ -423,7 +423,7 @@ def wait(n=0.2)
agent.gauge('connection_failure', 1, 1234)
wait
# The agent should now be running the background thread, and the queue should be empty
agent.should be_running
expect(agent.send(:running?)).to eq(true)
agent.queue.size.should == 0
end

Expand Down Expand Up @@ -510,10 +510,10 @@ def wait(n=0.2)
Resolv.stub(:getaddresses) { attempted_resolutions +=1 ; sleep 1 }
agent.gauge('test', 1)
attempted_resolutions.should == 1
agent.should_not be_running
expect(agent.send(:running?)).to eq(false)
agent.gauge('test', 1)
attempted_resolutions.should == 1
agent.should_not be_running
expect(agent.send(:running?)).to eq(false)
end
end

Expand All @@ -525,10 +525,10 @@ def wait(n=0.2)
Resolv.stub(:getaddresses) { attempted_resolutions +=1 ; sleep 1 }
agent.gauge('test', 1)
attempted_resolutions.should == 1
agent.should_not be_running
expect(agent.send(:running?)).to eq(false)
agent.gauge('test', 1)
attempted_resolutions.should == 1
agent.should_not be_running
expect(agent.send(:running?)).to eq(false)
sleep 2
agent.gauge('test', 1)
attempted_resolutions.should == 2
Expand All @@ -550,7 +550,7 @@ def wait(n=0.2)
wait 2
attempted_resolutions.should == 1
attempted_opens.should == 1
agent.should be_running
expect(agent.send(:running?)).to eq(true)

# Setup a failure for the next command so we'll break out of the inner
# loop in run_worker_loop causing another call to open_socket
Expand All @@ -569,7 +569,7 @@ def wait(n=0.2)
attempted_opens.should == 2
# We don't resolve again yet, we just disconnect
attempted_resolutions.should == 1
agent.should_not be_running
expect(agent.send(:running?)).to eq(false)

# Make test_connection succeed on the next command
test_connection_fail = false
Expand All @@ -582,7 +582,7 @@ def wait(n=0.2)
wait 5
attempted_resolutions.should == 2
attempted_opens.should == 3
agent.should be_running
expect(agent.send(:running?)).to eq(true)
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
config.after(:all) do
end

config.raise_errors_for_deprecations!

end


Expand Down

0 comments on commit 25927fc

Please sign in to comment.