ivanvanderbyl/cloudist — Issue #5: Problems running tests
Author: joevandyk
Created: 2011-11-14 19:08:09+00:00
State: open

```
[joe@laptop.local:~/projects/cloudist(master)] $ rake
WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
at /Users/joe/.rvm/gems/ree-1.8.7-2011.03@n2/gems/rake-0.9.2.2/lib/rake/rdoctask.rb
/Users/joe/.rvm/rubies/ree-1.8.7-2011.03/bin/ruby -S bundle exec rspec spec/cloudist/basic_queue_spec.rb spec/cloudist/job_spec.rb spec/cloudist/message_spec.rb spec/cloudist/messaging_spec.rb spec/cloudist/payload_spec.rb spec/cloudist/payload_spec_2_spec.rb spec/cloudist/queue_spec.rb spec/cloudist/request_spec.rb spec/cloudist/utils_spec.rb spec/cloudist_spec.rb spec/core_ext/string_spec.rb
F.....FFFFFF.FFFFF.F.F........F...Prefetch: 1
FPrefetch: 1
FPrefetch: 1
FPrefetch: 1
FPrefetch: 1
FPrefetch: 1
F......

Failures:

1) Cloudist Cloudist::Queues::BasicQueue should create a queue and exchange
Failure/Error: bq = Cloudist::Queues::BasicQueue.new("make.sandwich")
RuntimeError:
AMQP can only be used from within EM.run {}
# ./spec/../lib/cloudist/queues/basic_queue.rb:35:in `new'
# ./spec/../lib/cloudist/queues/basic_queue.rb:35:in `setup'
# ./spec/../lib/cloudist/queues/basic_queue.rb:25:in `initialize'
# ./spec/cloudist/basic_queue_spec.rb:19:in `new'
# ./spec/cloudist/basic_queue_spec.rb:19

2) Cloudist::Payload should extract published_on from data
Failure/Error: payload.headers['published_on'].should == "12345678"
expected: "12345678"
got: 1321297561.04786 (using ==)
# ./spec/cloudist/payload_spec.rb:29

3) Cloudist::Payload should extract custom event hash from data
Failure/Error: payload.body.should == {:bread=>"white"}
expected: {:bread=>"white"}
got: <#Hashie::Mash bread="white" event_hash="foo"> (using ==)
Diff:
@@ -1,2 +1,2 @@
-{:bread=>"white"}
+{"event_hash"=>"foo", "bread"=>"white"}
# ./spec/cloudist/payload_spec.rb:34

4) Cloudist::Payload should parse JSON message
Failure/Error: payload = Cloudist::Payload.new(Marshal.dump({:bread => 'white', :event_hash => 'foo'}))
JSON::ParserError:
705: unexpected token at {:event_hashfoo:
bread"
white'
# ./spec/../lib/cloudist/encoding.rb:13:in `decode'
# ./spec/../lib/cloudist/payload.rb:12:in `initialize'
# ./spec/cloudist/payload_spec.rb:39:in `new'
# ./spec/cloudist/payload_spec.rb:39

5) Cloudist::Payload should parse custom headers
Failure/Error: payload = Cloudist::Payload.new(Marshal.dump({:bread => 'white', :event_hash => 'foo'}), {:published_on => 12345})
JSON::ParserError:
705: unexpected token at {:event_hashfoo:
bread"
white'
# ./spec/../lib/cloudist/encoding.rb:13:in `decode'
# ./spec/../lib/cloudist/payload.rb:12:in `initialize'
# ./spec/cloudist/payload_spec.rb:44:in `new'
# ./spec/cloudist/payload_spec.rb:44

6) Cloudist::Payload should create a unique event hash
Failure/Error: payload.create_event_hash.size.should == 32
NoMethodError:
undefined method `create_event_hash' for #
# ./spec/../lib/cloudist/payload.rb:86:in `method_missing'
# ./spec/cloudist/payload_spec.rb:50

7) Cloudist::Payload should not create a new event hash unless it doesn't have one
Failure/Error: payload.event_hash.size.should == 32
NoMethodError:
undefined method `event_hash' for #
# ./spec/../lib/cloudist/payload.rb:86:in `method_missing'
# ./spec/cloudist/payload_spec.rb:55

8) Cloudist::Payload should format payload for sending
Failure/Error: body.should == Marshal.dump({:bread => 'white'})
expected: "\004\b{\006:\nbread\"\nwhite"
got: "{\"bread\":\"white\"}" (using ==)
Diff:
@@ -1,4 +1,2 @@
{:
-bread"
-white
+{"bread":"white"}
# ./spec/cloudist/payload_spec.rb:70

9) Cloudist::Payload should generate a unique payload ID
Failure/Error: payload.id.size.should == 32
expected: 32
got: 36 (using ==)
# ./spec/cloudist/payload_spec.rb:77

10) Cloudist::Payload should allow setting of payload ID
Failure/Error: payload.id = "2345"
NoMethodError:
undefined method `id=' for #
# ./spec/../lib/cloudist/payload.rb:86:in `method_missing'
# ./spec/cloudist/payload_spec.rb:82

11) Cloudist::Payload should allow changing of payload after being published
Failure/Error: payload.publish
NoMethodError:
undefined method `publish' for #
# ./spec/../lib/cloudist/payload.rb:86:in `method_missing'
# ./spec/cloudist/payload_spec.rb:88

12) Cloudist::Payload should freeze
Failure/Error: payload.publish
NoMethodError:
undefined method `publish' for #
# ./spec/../lib/cloudist/payload.rb:86:in `method_missing'
# ./spec/cloudist/payload_spec.rb:96

13) Cloudist::Payload should not overwrite passed in headers
Failure/Error: payload.headers[:ttl].should == "25"
expected: "25"
got: 25 (using ==)
# ./spec/cloudist/payload_spec.rb:114

14) Cloudist::Payload should be able to transport an error
Failure/Error: payload = Cloudist::Payload.new(e, {:message_type => 'error'})
NoMethodError:
undefined method `each_pair' for #
# ./spec/../lib/cloudist/payload.rb:13:in `new'
# ./spec/../lib/cloudist/payload.rb:13:in `initialize'
# ./spec/cloudist/payload_spec.rb:127:in `new'
# ./spec/cloudist/payload_spec.rb:127

15) Cloudist::Payload should parse custom headers
Failure/Error: payload = Cloudist::Payload.new(Marshal.dump({:bread => 'white'}), {:published_on => 12345, :message_id => "foo"})
JSON::ParserError:
705: unexpected token at {:
bread"
white'
# ./spec/../lib/cloudist/encoding.rb:13:in `decode'
# ./spec/../lib/cloudist/payload.rb:12:in `initialize'
# ./spec/cloudist/payload_spec_2_spec.rb:50:in `new'
# ./spec/cloudist/payload_spec_2_spec.rb:50

16) Cloudist::Request should return ttl
Failure/Error: q = Cloudist::JobQueue.new('test.queue')
RuntimeError:
AMQP can only be used from within EM.run {}
# ./spec/../lib/cloudist/queues/basic_queue.rb:35:in `new'
# ./spec/../lib/cloudist/queues/basic_queue.rb:35:in `setup'
# ./spec/../lib/cloudist/queues/basic_queue.rb:25:in `initialize'
# ./spec/../lib/cloudist/queues/job_queue.rb:10:in `initialize'
# ./spec/cloudist/request_spec.rb:8:in `new'
# ./spec/cloudist/request_spec.rb:8

17) Cloudist::Request should have a payload
Failure/Error: q = Cloudist::JobQueue.new('test.queue')
RuntimeError:
AMQP can only be used from within EM.run {}
# ./spec/../lib/cloudist/queues/basic_queue.rb:35:in `new'
# ./spec/../lib/cloudist/queues/basic_queue.rb:35:in `setup'
# ./spec/../lib/cloudist/queues/basic_queue.rb:25:in `initialize'
# ./spec/../lib/cloudist/queues/job_queue.rb:10:in `initialize'
# ./spec/cloudist/request_spec.rb:8:in `new'
# ./spec/cloudist/request_spec.rb:8

18) Cloudist::Request should be 1 minute old
Failure/Error: q = Cloudist::JobQueue.new('test.queue')
RuntimeError:
AMQP can only be used from within EM.run {}
# ./spec/../lib/cloudist/queues/basic_queue.rb:35:in `new'
# ./spec/../lib/cloudist/queues/basic_queue.rb:35:in `setup'
# ./spec/../lib/cloudist/queues/basic_queue.rb:25:in `initialize'
# ./spec/../lib/cloudist/queues/job_queue.rb:10:in `initialize'
# ./spec/cloudist/request_spec.rb:8:in `new'
# ./spec/cloudist/request_spec.rb:8

19) Cloudist::Request should not be expired
Failure/Error: q = Cloudist::JobQueue.new('test.queue')
RuntimeError:
AMQP can only be used from within EM.run {}
# ./spec/../lib/cloudist/queues/basic_queue.rb:35:in `new'
# ./spec/../lib/cloudist/queues/basic_queue.rb:35:in `setup'
# ./spec/../lib/cloudist/queues/basic_queue.rb:25:in `initialize'
# ./spec/../lib/cloudist/queues/job_queue.rb:10:in `initialize'
# ./spec/cloudist/request_spec.rb:8:in `new'
# ./spec/cloudist/request_spec.rb:8

20) Cloudist::Request should not be acked yet
Failure/Error: q = Cloudist::JobQueue.new('test.queue')
RuntimeError:
AMQP can only be used from within EM.run {}
# ./spec/../lib/cloudist/queues/basic_queue.rb:35:in `new'
# ./spec/../lib/cloudist/queues/basic_queue.rb:35:in `setup'
# ./spec/../lib/cloudist/queues/basic_queue.rb:25:in `initialize'
# ./spec/../lib/cloudist/queues/job_queue.rb:10:in `initialize'
# ./spec/cloudist/request_spec.rb:8:in `new'
# ./spec/cloudist/request_spec.rb:8

21) Cloudist::Request should be ackable
Failure/Error: q = Cloudist::JobQueue.new('test.queue')
RuntimeError:
AMQP can only be used from within EM.run {}
# ./spec/../lib/cloudist/queues/basic_queue.rb:35:in `new'
# ./spec/../lib/cloudist/queues/basic_queue.rb:35:in `setup'
# ./spec/../lib/cloudist/queues/basic_queue.rb:25:in `initialize'
# ./spec/../lib/cloudist/queues/job_queue.rb:10:in `initialize'
# ./spec/cloudist/request_spec.rb:8:in `new'
# ./spec/cloudist/request_spec.rb:8

Finished in 0.02376 seconds
46 examples, 21 failures
rake aborted!
ruby -S bundle exec rspec spec/cloudist/basic_queue_spec.rb spec/cloudist/job_spec.rb spec/cloudist/message_spec.rb spec/cloudist/messaging_spec.rb spec/cloudist/payload_spec.rb spec/cloudist/payload_spec_2_spec.rb spec/cloudist/queue_spec.rb spec/cloudist/request_spec.rb spec/cloudist/utils_spec.rb spec/cloudist_spec.rb spec/core_ext/string_spec.rb failed

Tasks: TOP => default => spec
(See full trace by running task with --trace)
```

Could be my environment? Ruby 1.9.2 on OSX, using rabbitmq 2.5.1.

Also, have you looked at using travis-ci? I think they support rabbitmq.