Testing for #answer fails

25 views
Skip to first unread message

Hans Fritz

unread,
Aug 17, 2015, 5:48:38 PM8/17/15
to Adhearsion
Hi,

I'd like to make sure the call receives the #answer message.


It fails with:
Failure/Error: subject.run
fatal:
No live threads left. Deadlock?

How do I avoid this failure? What am I missing to test that the call is indeed answered?

Thanks,

Ben Langfeld

unread,
Aug 18, 2015, 7:23:40 AM8/18/15
to adhea...@googlegroups.com
Did you not get a backtrace here? What if you run RSpec with the -b option?

--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adhearsion+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hans Fritz

unread,
Aug 18, 2015, 3:09:09 PM8/18/15
to Adhearsion
This is the full trace with -b for the failing test:


Failures:

  1) OutboundCallController answers the call
     Failure/Error: subject.run
     fatal:
       No live threads left. Deadlock?
     # /Users/coaxial/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/monitor.rb:110:in `sleep'
     # /Users/coaxial/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/monitor.rb:110:in `wait'
     # /Users/coaxial/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/monitor.rb:110:in `wait'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/future-resource-1.1.0/lib/future-resource.rb:66:in `block (2 levels) in resource'
     # /Users/coaxial/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/future-resource-1.1.0/lib/future-resource.rb:65:in `block in resource'
     # /Users/coaxial/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/timeout.rb:74:in `timeout'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/future-resource-1.1.0/lib/future-resource.rb:64:in `resource'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/punchblock-2.7.2/lib/punchblock/component/component_node.rb:51:in `complete_event'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/adhearsion-2.6.2/lib/adhearsion/call_controller.rb:223:in `execute_component_and_await_completion'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/adhearsion-2.6.2/lib/adhearsion/call_controller/output/player.rb:18:in `output'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/adhearsion-2.6.2/lib/adhearsion/call_controller/output.rb:27:in `say'
     # ./app/call_controllers/outbound_call.rb:14:in `run'
     # ./spec/call_controllers/outbound_call_spec.rb:14:in `block (2 levels) in <top (required)>'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:206:in `instance_exec'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:206:in `block in run'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:430:in `block in with_around_and_singleton_context_hooks'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:388:in `block in with_around_example_hooks'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:478:in `block in run'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:616:in `run_around_example_hooks_for'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:478:in `run'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:388:in `with_around_example_hooks'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:430:in `with_around_and_singleton_context_hooks'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:203:in `run'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:559:in `block in run_examples'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:555:in `map'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:555:in `run_examples'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:521:in `run'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `block (3 levels) in run_specs'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `map'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `block (2 levels) in run_specs'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1627:in `with_suite_hooks'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:114:in `block in run_specs'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/reporter.rb:77:in `report'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:113:in `run_specs'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:89:in `run'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:73:in `run'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:41:in `invoke'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.3.2/exe/rspec:4:in `<top (required)>'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/bin/rspec:23:in `load'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/bin/rspec:23:in `<main>'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
     # /Users/coaxial/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'

Finished in 0.60279 seconds (files took 1.27 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/call_controllers/outbound_call_spec.rb:11 # OutboundCallController answers the call

Ben Langfeld

unread,
Aug 18, 2015, 3:45:08 PM8/18/15
to adhea...@googlegroups.com
So your call controller is performing output which never receives a completion event (because your tests don't generate one) and therefore the controller deadlocks.

You need to mock your output also.

--

Hans Fritz

unread,
Aug 18, 2015, 6:50:18 PM8/18/15
to adhea...@googlegroups.com
I'm still confused. What does a completion event look like? By mocking the output, are you talking about a Player object?
Is there an example I could look at somewhere? I couldn't find any, it seems the open source Adhearsion apps are rare in the wild.

--
You received this message because you are subscribed to a topic in the Google Groups "Adhearsion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adhearsion/2FtOk-R2xc0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adhearsion+...@googlegroups.com.

Ben Langfeld

unread,
Aug 18, 2015, 6:59:23 PM8/18/15
to adhea...@googlegroups.com
Normally you would mock the call to #output:

expect(subject).to receive(:output).with(...)

Hans Fritz

unread,
Aug 19, 2015, 6:04:50 PM8/19/15
to Adhearsion
Alright, I got it. I just had to mock every method in the controller that interacts with the call such as answer, say, hangup etc. It works now, thanks.
Reply all
Reply to author
Forward
0 new messages