ngauthier / hydra Goto Github PK
View Code? Open in Web Editor NEWDistributed testing framework
License: MIT License
Distributed testing framework
License: MIT License
Should Hydra tasks exit with a non-0 exit status if tests fail? We are relying on that for our CI builds. Putting this at the end of Master#initialize fixed the problem for us, although it's quite hacky.
failed = @event_listeners.any? { |l| l.instance_variable_get("@errors") }
exit(failed ? 1 : 0)
rake hydra:cucumber fails.
Versions:
Hydra: 0.22.2
Cucumber 0.9.0
``run_cucumber_file': undefined method options=' for #Cucumber::StepMother:0x10362d4d8 (NoMethodError)`
/Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/runner.rb:148:in `run_cucumber_file': undefined method options=' for #<Cucumber::StepMother:0x10362d4d8> (NoMethodError)
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/runner.rb:41:in `run_file'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/message/worker_messages.rb:25:in `handle'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/runner.rb:71:in `process_messages'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/runner.rb:26:in `initialize'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/worker.rb:86:in `new'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/worker.rb:86:in `boot_runners'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/safe_fork.rb:15:in `fork'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/safe_fork.rb:7:in `fork'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/worker.rb:84:in `boot_runners'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/worker.rb:82:in `times'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/worker.rb:82:in `boot_runners'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/worker.rb:24:in `initialize'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/master.rb:163:in `new'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/master.rb:163:in `boot_local_worker'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/safe_fork.rb:15:in `fork'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/safe_fork.rb:7:in `fork'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/master.rb:161:in `boot_local_worker'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/master.rb:148:in `boot_workers'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/master.rb:143:in `each'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/master.rb:143:in `boot_workers'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/master.rb:87:in `initialize'
from /Users/robaldred/.rvm/gems/ruby-1.8.7-p249@kitten/gems/hydra-0.22.2/lib/hydra/tasks.rb:112:in `new'
I wanted to test that a simple test would show as failed when so I changed a .should_not to a .should (rspec) and it there was no indication of failure. I am running REE and Rails 3 if that helps. Let me know if I am doing something wrong or if you need more info (which I am sure you will).
It seems that 'test-unit' is required as a dependency.
Otherwise, the message "no such file to load -- test/unit/testresult" is displayed.
Adding "gem 'test-unit' to my Gemfile solved the problem.
As expected 'rake hydra:units' doesn't work unless hydra is bundled - so it seems like it's an either or situation. I don't think hydra should be blocking the execution of individual tests.
Trying to debug right now, but testing are running ok when using simple rspec, and when using hydra, it starts using my spanish i18n for some reason....breaking few of my tests.
default locale is definitely set to the correct language, but for some reason it stills gets the spanish locale.
Hello,
My co-worker and I spent some time trying to use hydra out of the box with our current Cucumber setup and couldn't get it to work right so we gave up using it. We hacked together a script that sort of runs scenarios in parallel, which involves tagging all of our scenarios with a unique tag, but it isn't the best solution. I'd like to fill you in on our current setup and see if you plan to support it, or if it is currently supported, how we can configure Hydra to work with our project.
Here's a list of the libraries we are using:
We are testing a PHP project which is why we are using cuke4php. Cuke4PHP implements the Cucumber wire protocol so we can implement step definitions in PHP. Here's how the process would work running in sequence:
cuke4php path/to/features
from the command linecucumber path/to/features
.Here are some things that we learned when creating our own forking script. Cuke4Php server will only work for one scenario at a time. So if we want to run Cucumber in parallel, we need a Cuke4Php server running for each fork. This is easy to do and happens automatically by running cuke4php from the command line. The problem is Hydra (as far as I know) does not have any way to configure how it works. The hydra:cucumber rake task does a bunch of magic behind the scenes. If we could configure some "before" and "after" tasks, that would probably suffice, but I don't know what the best approach to this would be.
Does Hydra support anything like this? Is there any workarounds we can do until it does? What do you recommend?
Hi,
This is no specifically related with hydra, but how could I define a function which will invokes an emacs command (defun + interactive) with a modifier(C-u) on?
Hello,
I'm having trouble with Hydra hanging part way through a run. Sometimes gets as far as 20 specs, sometimes as few as 2. Then it just sits there, with no advancement after 10x as long as all my specs take to run serially.
I am only running locally (one worker), and things run fine when I specify only one runner. This is a rails app, and many specs use the same models as one another, so my best guess is that my database is getting frotzed by simultaneous access to the same objects. Sound like a good theory? After things go south, even running only 1 worker fails until I blow away my db and start from scratch.
I went through closed tickets, and found #43. This is a question about separate db's per runner, and the answer is "yes, but you have to do it yourself" - however the answer points to an init file for workers, not for runners. So...
How would you use a worker init file to get separate DB's per runner?
Also, would it be hard to port the worker init file feature to 0.20.0? If I'm seeing things correctly, it's not in there. Sadly we're on RSpec 1.x and Rails 2.x.
Thanks!
the progressbar hijacking is wrong because the path changed
Even though factory_girl is configured within the test environment, individual specs don't seem to be loading what's required.
Here's the relevant files and output: https://gist.github.com/7e8577ebc18ab217d666
/Users/steven/.rvm/gems/ree-1.8.7-2010.01/gems/hydra-0.16.3/lib/hydra/safe_fork.rb:12:in 'fork': undefined method 'merge' for nil:NilClass (NoMethodError)
When I try to kill the parent hydra process using Ctrl + C, the workers continue to do their work.
It would be nice if the workers are also killed when the parent dies.
Not so much a bug as a feature request/question.
Is there any way that hydra could run with ci_reporter (https://github.com/nicksieger/ci_reporter) functionality enabled?
We're trying to set up a good integration with Jenkins, but since hydra replaces a lot of the rake functionality I'm not sure if this is possible or not.
Not sure if this quite falls under the umbrella of Hydra, but could be a useful monkey patch until/if this optimization makes it into the latest Rails.
It would be nice to see the current number of runners who have successfully executed a test as part of the progress.
Failing to set a RAILS_ENV at the command line gives a warning even when I'm not using Hydra.
It's like this:
$ rake db:reset
WARNING: RAILS_ENV is "development". Make sure to set it properly (ex: "RAILS_ENV=test rake hydra")
Forgive the dumb question but I haven't been able to find an answer online. Using traditional fixtures and Test::Unit I can run unit tests in 1 minute 16 seconds:
time rake test:units
235 tests, 3813 assertions, 0 failures, 0 errors
real 1m16.273s
user 0m40.823s
sys 0m2.352s
I installed the hydra gem and added the following to my Rakefile:
Hydra::TestTask.new('hydra') do |t|
t.add_files 'test/unit/**/*_test.rb'
end
My config/hydra.yml looks like this:
workers:
- type: local
runners: 2
Running my unit tests inside hydra results in a slowdown:
time RAILS_ENV=test rake hydra
(in /home/brian/co/manage)
Hydra Testing [##############################>] 87/87
real 2m5.797s
user 0m0.384s
sys 0m0.208s
I'm wondering if this is because I'm not using RSpec or Factory Girl or Cucumber or anything else that the cool kids are using these days. The database is Postgres and I have transaction fixtures and concurrent connections enabled. Any help would be appreciated. Thanks!
Brian
When running specs with Hydra, nothing is returned. The exit status code is not set, and no output is returned when a spec fails:
[1] ‡ RAILS_ENV=test rake hydra:spec
(in /Users/brianrose/Projects/protosite)
DEPRECATION WARNING: RAILS_ENV is deprecated. Please use ::Rails.env. (called from call at /Users/brianrose/.rvm/gems/ruby-1.8.7-p174@protosite/gems/rake-0.8.7/lib/rake.rb:636)
Hydra Testing [##############################>] 84/84
If I run 'rake spec', I have a failing spec. Any idea what might be going on?
I'm running Hydra 0.22.1 and RSpec 2.0.0.beta.20.
There are some useful cucumber command line arguments, like tags and "--guess" that would be useful to be able to pass through to the runner in some fashion.
hydra-0.23.1 requires the gem "test-unit" - could this be broken out in some way?
I see this in a Rakefile that loads libs using Bundler.require(...)
+no such file to load -- test/unit/testresult
+/home/hedge/.rvm/gems/ruby-1.9.2-p0@fog/gems/hydra-0.23.1/lib/hydra/runner.rb:2:in `require'
+/home/hedge/.rvm/gems/ruby-1.9.2-p0@fog/gems/hydra-0.23.1/lib/hydra/runner.rb:2:in `<top (required)>'
+/home/hedge/.rvm/gems/ruby-1.9.2-p0@fog/gems/hydra-0.23.1/lib/hydra.rb:7:in `require'
+/home/hedge/.rvm/gems/ruby-1.9.2-p0@fog/gems/hydra-0.23.1/lib/hydra.rb:7:in `<top (required)>'
Hey there, I'm having an issue with hydra with rspec where shared examples aren't able to be used for some reason (shared_examples_for).
It's able to load my environment and successfully run tests, but when it comes to one that uses shared examples defined in another file that was loaded on startup, it errors out.
I created a demo project that has the full stacktrace of the error that you should be able to reproduce:
RAILS_ENV=test rake hydra
https://github.com/adamfortuna/hydra-rspec-failure-demo
Here's a briefer overview:
In spec_helper.rb we load up some rspec shared examples:
Dir[File.expand_path('../support/**/*.rb', __FILE__)].each do |file|
require(file)
end
shared_examples_for "a demo example" do
it "doesnt error out" do
true.should == true
end
end
Then attempt to use these later on in a test:
require 'spec_helper'
describe ApplicationHelper do
it_should_behave_like "a demo example"
end
Which results in this error:
1303850302.11934 RUNNER| Running file: spec/helpers/application_helper_spec.rb
1303850302.18619 RUNNER| Could not find shared example group named "a demo example"
/Users/adam/.rvm/gems/ree-1.8.7-2010.02/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/example_group.rb:65:in `it_should_behave_like': Could not find shared example group named "a demo example" (RuntimeError)
Full dump, gem versions and the rest in the repo, but it might just be a setup error on my part. I've tried this with various different rspec/hydra gem versions, but right now the demo is running 'hydra', '0.23.0' and 'rspec', '2.0.0.beta.19'. This spec can be run by itself, but errors out when run form hydra. Any ideas?
Hi there,
We're trying to set up hydra, and it works fine for all of our specs in spec/models, but for some reason, our controller tests fail when we try to call a controller action. Here's a sample stack trace:
SystemStackError in 'StaticController should render layout 'basic_with_header_and_footer' for 'learn_more' action'
stack level too deep
/Users/zozi/zozi/vendor/plugins/render_component/lib/components.rb:138:in process_cleanup_without_render_component' /Users/zozi/zozi/vendor/plugins/render_component/lib/components.rb:138:in
process_cleanup'
/Users/zozi/.gem/ruby/1.8/gems/compass-0.8.17/lib/compass/app_integration/rails/action_controller.rb:7:in process' /Users/zozi/zozi/spec/controllers/test_controller_spec.rb:13: /Users/zozi/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in
call'
/Users/zozi/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in execute' /Users/zozi/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in
each'
It looks like calling get :action_name is what causes the spec to fail.
Is there a reason why model specs work, but controller specs fail?
Thanks in advance!
Hi,
First of all, let me say that Hydra looks very promising. I want to use it on a project that has a 10+ minutes rspec suite runtime.
My hydra.yml looks like this:
workers:
- type: local
runners: 2
But I get the following stack trace:
If I change the number of runners to 1 it seems to work? Seems to be some transactional/db-issue?
/Jørgen
Fixture::FormatError: a YAML error occurred parsing test/fixtures/whatever.yml.
The exact error was:
ArgumentError: wrong number of arguments (4 for 1)
vendor/rails/activerecord/lib/active_record/fixtures.rb:746:in `parse_yaml_string'
When running:
$ RAILS_ENV=test rake hydra:spec --trace
(in /Users/jch/projects/pharmmd)
rake aborted!
cannot remove Object::ClassMethods
/Users/jch/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:603:in `remove_const'
/Users/jch/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:603:in `remove_constant'
/Users/jch/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:603:in `instance_eval'
/Users/jch/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:603:in `remove_constant'
/Users/jch/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:549:in `new_constants_in'
/Users/jch/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:549:in `each'
/Users/jch/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:549:in `new_constants_in'
/Users/jch/.rvm/gems/ree-1.8.7-2010.02/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
/Users/jch/projects/my_project/Rakefile:20
/Users/jch/.rvm/gems/ree-1.8.7-2010.02/gems/hydra-0.22.2/lib/hydra/tasks.rb:79:in `initialize'
Rakefile line 20 attempts to load spec/spec_helper, which in turn fails when trying to load config/environment.rb
require 'hydra'
require 'hydra/tasks'
# set up a new hydra testing task named 'hydra:spec' run with "rake hydra:spec"
Hydra::TestTask.new('hydra:spec') do |t|
require 'spec/spec_helper' # fails here after trying to load config/environment.rb
t.add_files 'spec/**/*_spec.rb'
end
The app is on Rails version 2.3.4. I tried this using my system ruby (1.8.7) and also got the same error. It runs fine if I do a normal 'rake spec'. Let me know if any other details would be helpful.
I've got a project I'm not that far along on, but I wanted to use it to play with hydra. The specs run just fine outside of hydra, but I get in hydra it can't find ActionController making me think it's not properly loading the rails environment when running in hydra. I can't seem to find any other setup stuff I need to do, let me know what I missed.
Fix: HydraFormatter must also define the method example_pending(*args), and do nothing - similar to how dump_summary is defined.
hydra = Typhoeus::Hydra.new
###############
# Cache
###############
hydra.cache_getter do |request|
Rails.cache.read(request.cache_key) rescue nil
end
hydra.cache_setter do |request|
Rails.cache.write(request.cache_key,request.response, expires_in: request.cache_timeout)
end
ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-darwin11.4.2]
Rails 3.2.8
Trying to setup Hydra to run multiple workers on a quite slow rspec suite, and overall it seems to be doing the job but I'm running into a problem I'm not sure how best to fix:
Mysql::Error: SAVEPOINT active_record_1 does not exist: ROLLBACK TO SAVEPOINT active_record_1
This error shows up every so often (definitely non-deterministic as can be expected). We're using factory_girl for test data and 1.8.7 (both MRI and REE).
Tests are failing for me (on a clean checkout) like this:
[ree-1.8.7] [06:46:10] $ rake
(in /Users/bhelmkamp/p/active/hydra)
/Users/bhelmkamp/.rvm/gems/ree-1.8.7-2010.01/gems/jeweler-1.4.0/lib/jeweler/commands/check_dependencies.rb:13:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
All dependencies seem to be installed.
/Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/bin/ruby -I"lib:lib:test" "/Users/bhelmkamp/.rvm/gems/ree-1.8.7-2010.01/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/fixtures/sync_test.rb" "test/master_test.rb" "test/message_test.rb" "test/pipe_test.rb" "test/runner_test.rb" "test/ssh_test.rb" "test/sync_test.rb" "test/worker_test.rb"
Loaded suite /Users/bhelmkamp/.rvm/gems/ree-1.8.7-2010.01/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
....../test/../lib/hydra/ssh.rb:30:in write': Broken pipe (Errno::EPIPE) from ./test/../lib/hydra/ssh.rb:30:in
initialize'
from ./test/../lib/hydra/master.rb:174:in new' from ./test/../lib/hydra/master.rb:174:in
boot_ssh_worker'
from ./test/../lib/hydra/master.rb:196:in process_messages' from ./test/../lib/hydra/master.rb:193:in
initialize'
from ./test/../lib/hydra/master.rb:193:in new' from ./test/../lib/hydra/master.rb:193:in
process_messages'
from ./test/../lib/hydra/master.rb:192:in each' from ./test/../lib/hydra/master.rb:192:in
process_messages'
from ./test/../lib/hydra/master.rb:86:in initialize' from ./test/master_test.rb:84:in
new'
from ./test/master_test.rb:84:in __bind_1282474024_539126' from /Users/bhelmkamp/.rvm/gems/ree-1.8.7-2010.01/gems/shoulda-2.11.1/lib/shoulda/context.rb:382:in
call'
from /Users/bhelmkamp/.rvm/gems/ree-1.8.7-2010.01/gems/shoulda-2.11.1/lib/shoulda/context.rb:382:in test: with a file to test and a destination to verify should run a test via ssh. ' from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit/testcase.rb:78:in
send'
from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit/testcase.rb:78:in run' from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit/testsuite.rb:34:in
run'
from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit/testsuite.rb:33:in each' from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit/testsuite.rb:33:in
run'
from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit/testsuite.rb:34:in run' from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit/testsuite.rb:33:in
each'
from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit/testsuite.rb:33:in run' from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in
run_suite'
from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in start_mediator' from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in
start'
from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in run' from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit/autorunner.rb:216:in
run'
from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
from /Users/bhelmkamp/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/test/unit.rb:279
from /Users/bhelmkamp/.rvm/gems/ree-1.8.7-2010.01/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
rake aborted!
Command failed with status (1): [/Users/bhelmkamp/.rvm/rubies/ree-1.8.7-201...]
(See full trace by running task with --trace)
Hii all,
I have installed the required gems for hydra and updated my rake file with the following code
Hydra::TestTask.new('hydra:unit') do |t|
t.add_files 'features/step_definitions/*.rb'
end
Hydra::TestTask.new('hydra:cucumber') do |t|
t.add_files 'features/hydra/checkout.feature'
end
task :hydra => ['hydra:unit', 'hydra:cucumber']
While i'm trying to run my rake using the command >rake hydra or >rake hydra:cucumber
I am getting a error like
rake aborted!
undefined method `run=' for Test::Unit:Module
Any solution ??
Using filter_run
in RSpec 2 causes Hydra to think the specs failed. I created a skeleton app that works and added branch using filter_run
which always fails.
$ RAILS_ENV=test rake hydra
Run filtered using {:focused=>true}
Hydra Testing [##############################>] 1/1
rake aborted!
Hydra: Not all tests passes
(See full trace by running task with --trace)
Commenting the line in RSpec that prints the filtered message "fixes" the issue.
$ RAILS_ENV=test rake hydra
Hydra Testing [##############################>] 1/1
I'll gladly take a look. Any direction would be appreciated.
Sadly, it doesn't work with Rails 3 Beta 4. I get these errors:
rake hydra:units
(in [...])
DEPRECATION WARNING: RAILS_ENV is deprecated! Use Rails.env instead. (called from /home/igel/.bundle/ruby/1.8/gems/hydra-0.19.4/lib/hydra/tasks.rb:108)
WARNING: RAILS_ENV is "development". Make sure to set it properly (ex: "RAILS_ENV=test rake hydra")
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
no such file to load -- test_helper
Hydra Testing [##############################>] 19/19
Setting RAILS_ENV just removes the warning about being in dev environment.
My setup (On Ubuntu 10.4):
rails --version
Rails 3.0.0.beta4
gem --version
1.3.7
ruby --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
Hi,
I configured hydra for my rails app. All my tests are failing when am running with hydra. It also does not print the reason why it is failing. Couple of things I would like to know:
--format -d
, but seems like it does not have any effect for hydra.My setup is:
And the following is what I've added in the Rakefile:
# require the hydra codebase
require 'hydra'
# require the hydra rake task helpers
require 'hydra/tasks'
# set up a new hydra testing task named 'hydra:spec' run with "rake hydra:spec"
Hydra::TestTask.new('hydra:spec') do |t|
# you may or may not need this, depending on how you require
# spec_helper in your test files:
require './spec/spec_helper'
# add all files in the spec directory that end with "_spec.rb"
t.add_files './spec/models/*.rb'
end
The following the stack trace what I get when I run with --trace option for rake:
Hydra: Not all tests passes /var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/hydra-0.23.3/lib/hydra/tasks.rb:120:in
block in define'
/var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:636:in call' /var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:636:in
block in execute'
/var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:631:in each' /var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:631:in
execute'
/var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:597:in block in invoke_with_call_chain' /var/lib/hudson/.rvm/rubies/ruby-1.9.2-rc1/lib/ruby/1.9.1/monitor.rb:201:in
mon_synchronize'
/var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' /var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:583:in
invoke'
/var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task' /var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:2029:in
block (2 levels) in top_level'
/var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:2029:in each' /var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:2029:in
block in top_level'
/var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:2023:in
top_level'
/var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:2001:in block in run' /var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:2068:in
standard_exception_handling'
/var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/lib/rake.rb:1998:in run' /var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/gems/rake-0.8.7/bin/rake:31:in
<top (required)>'
/var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/bin/rake:19:in load' /var/lib/hudson/.rvm/gems/ruby-1.9.2-rc1/bin/rake:19:in
Please let me know how to fix the issue.
Thanks,
Leena
Code is railing on a file open :( I've placed a puts statement just before the offending line to find out what file is not happy about and its '/tmp/hydra_heuristics.yml' which sure enough doesn't exist. Is there some kind of generator that needs to be run or something like that?
Full stack trace:
** Invoke hydra:cucumber (first_time)
** Execute hydra:cucumber
********************
""
dom-> /tmp/hydra_heuristics.yml
rake aborted!
no implicit conversion from nil to integer
/Users/Dom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych.rb:298:in `initialize'
/Users/Dom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych.rb:298:in `open'
/Users/Dom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych.rb:298:in `load_file'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/hydra-0.24.0/lib/hydra/master.rb:232:in `sort_files_from_report'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/hydra-0.24.0/lib/hydra/master.rb:78:in `initialize'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/hydra-0.24.0/lib/hydra/tasks.rb:137:in `new'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/hydra-0.24.0/lib/hydra/tasks.rb:137:in `block in define'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/Dom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/bin/rake:19:in `load'
/Users/Dom/.rvm/gems/ruby-1.9.3-p194/bin/rake:19:in `<main>'
Tasks: TOP => hydra:cucumber
Is it possible to set RAILS_ENV=cucumber without specifying it every time in the command line? If I do not specify it tells me its running in development mode.
I'm trying to test my multi-core hydra runs locally.
Is there a way to actually exit the whole test once the worker processes have been spawned?
Using Ctrl+c will bring me back to the shell, but the spawned processes will still write logging output to stdout and the tests continue to run.
Cheers,
Marc
I'm undertaking an effort to make Hydra more compatible with Cucumber 0.8.5 (latest). I've forked the project on GitHub, and I'm making my changes directly to that fork.
After my first change, I realized I should be running the tests you've provided! Unfortunately, they hang when I run them, even on your HEAD revision. I wanted to verify with you that this is unexpected behavior. After letting the tests run for a few minutes, I terminated them manually and got the callstack below.
(in ~/proj/foss/hydra)
~/.rvm/gems/ruby-1.8.7-p299@hydra-dev/gems/jeweler-1.4.0/lib/jeweler/commands/check_dependencies.rb:13:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
All dependencies seem to be installed.
/.rvm/rubies/ruby-1.8.7-p299/bin/ruby -I"lib:lib:test" "/.rvm/gems/ruby-1.8.7-p299@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/sync_test.rb" "test/runner_test.rb" "test/pipe_test.rb" "test/fixtures/sync_test.rb" "test/worker_test.rb" "test/message_test.rb" "test/master_test.rb" "test/ssh_test.rb"
Loaded suite ~/.rvm/gems/ruby-1.8.7-p299@global/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
.....^C./test/../lib/hydra/master.rb:216:in join': Interrupt from ./test/../lib/hydra/master.rb:216:in
process_messages'
from ./test/../lib/hydra/master.rb:216:in each' from ./test/../lib/hydra/master.rb:216:in
process_messages'
from ./test/../lib/hydra/master.rb:86:in initialize' from ./test/master_test.rb:84:in
new'
from ./test/master_test.rb:84:in __bind_1282173670_488554' from ~/.rvm/gems/ruby-1.8.7-p299@hydra-dev/gems/shoulda-2.10.3/lib/shoulda/context.rb:362:in
call'
from ~/.rvm/gems/ruby-1.8.7-p299@hydra-dev/gems/shoulda-2.10.3/lib/shoulda/context.rb:362:in test: with a file to test and a destination to verify should run a test via ssh. ' from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/testcase.rb:78:in
send'
from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/testcase.rb:78:in run' from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/testsuite.rb:34:in
run'
from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/testsuite.rb:33:in each' from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/testsuite.rb:33:in
run'
from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/testsuite.rb:34:in run' from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/testsuite.rb:33:in
each'
from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/testsuite.rb:33:in run' from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in
run_suite'
from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in start_mediator' from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in
start'
from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in run' from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/autorunner.rb:216:in
run'
from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
from ~/.rvm/rubies/ruby-1.8.7-p299/lib/ruby/1.8/test/unit.rb:279
from ~/.rvm/gems/ruby-1.8.7-p299@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
rake aborted!
Hi - I am using bundler 1.0.0 in my rails 2.3.5 app with RSpec and I have gone through the setup as described in the "Getting Started" Wiki page.
My rake file:
require 'rubygems'
require 'hydra'
require 'hydra/tasks'
Hydra::TestTask.new('hydra:para' => ['environment']) do |t|
t.add_files 'spec/__spec.rb'
t.verbose = true
end
Hydra::TestTask.new('hydra:serial' => ['environment']) do |t|
t.add_files 'spec/lib/tpsi/__spec.rb'
t.serial = true
t.verbose = true
end
task :hydra => ['hydra:para', 'hydra:serial']
When I run "RAILS_ENV=test rake hydra", I get the following output:
Loading bundler environment...
DEPRECATION WARNING: require "activesupport" is deprecated and will be removed in Rails 3. Use require "active_support" instead.. (called from /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/activesupport.rb:2)
RAILS_ENV: test
ENVIRONMENT INVOKED with /opt/ree/bin/rake
1283370597.54386 MASTER| Initialized
1283370597.54396 MASTER| Files: (["spec/spec_helper_spec.rb"])
1283370597.54401 MASTER| Workers: ([{"type"=>"local", "runners"=>2}])
1283370597.54403 MASTER| Verbose: (true)
Hydra Testing [> ] 0/11283370597.54447 MASTER| Booting 1 workers
1283370597.5446 MASTER| worker opts {"type"=>"local", "runners"=>2}
1283370597.54467 MASTER| Booting local worker
1283370597.55527 MASTER| Processing Messages
1283370597.55565 MASTER| Workers: [{:type=>:local, :pid=>99843, :io=>#<Hydra::Pipe @reader=#IO:0x501b828, @writer=#IO:0x501cd2c>, :idle=>false}]
1283370597.55684 MASTER| Listening to {:type=>:local, :pid=>99843, :io=>#<Hydra::Pipe @reader=#IO:0x501b828, @writer=#IO:0x501cd2c>, :idle=>false}
1283370597.56579 WORKER| Booting 2 Runners
1283370597.58258 WORKER| 2 Runners booted
1283370597.58334 WORKER| Processing Messages
1283370597.59384 MASTER| got message: #Hydra::Messages::Worker::WorkerBegin:0x50077c4
1283370597.60178 RUNNER| Booted. Sending Request for file
1283370597.60458 RUNNER| Processing Messages
1283370597.60678 WORKER| Received Message from Runner
1283370597.60766 WORKER| #Hydra::Messages::Runner::RequestFile:0x4fe7c80
1283370597.60807 MASTER| got message: #Hydra::Messages::Worker::RequestFile:0x500639c
1283370597.60832 MASTER| Sending "spec/spec_helper_spec.rb"
1283370597.60906 WORKER| Received Message from Master
1283370597.60916 WORKER| #<Hydra::Messages::Master::RunFile:0x4fe7118 @file="spec/spec_helper_spec.rb">
1283370597.61033 RUNNER| Received message from worker
1283370597.61041 RUNNER| #<Hydra::Messages::Worker::RunFile:0x4ff98cc @file="spec/spec_helper_spec.rb">
1283370597.61044 RUNNER| Running file: spec/spec_helper_spec.rb
1283370597.61367 RUNNER| Booted. Sending Request for file
1283370597.61418 RUNNER| Processing Messages
1283370597.61449 WORKER| Received Message from Runner
1283370597.61454 WORKER| #Hydra::Messages::Runner::RequestFile:0x4fe6470
1283370597.61473 MASTER| got message: #Hydra::Messages::Worker::RequestFile:0x50058ac
1283370597.61477 MASTER| No more files to send
1283370597.62201 WORKER| Received Message from Runner
1283370597.62228 WORKER| #<Hydra::Messages::Runner::Results:0x4fe5a0c @output="no such file to load -- rspec", @file="spec/spec_helper_spec.rb">
1283370597.62284 MASTER| got message: #Hydra::Messages::Worker::Results:0x5005514
1283370597.62321 MASTER| 0 Files Remaining
no such file to load -- rspec
Hydra Testing [##############################>] 1/11283370597.6436 MASTER| Shutting down all workers
Hydra Testing [##############1283370597.64435 WORKER| Received Message from Master
1283370597.64446 WORKER| #Hydra::Messages::Master::Shutdown:0x4fe514c
1283370597.64501 WORKER| Notifying 2 Runners of Shutdown
1283370597.64506 WORKER| Sending Shutdown to Runner
1283370597.64539 WORKER| {:pid=>99844, :io=>#<Hydra::Pipe @reader=#IO:0x5007b84, @writer=#IO:0x5007bc0>, :idle=>true}
1283370597.64575 RUNNER| Received message from worker
1283370597.64579 RUNNER| #Hydra::Messages::Worker::Shutdown:0x4feeddc
1283370597.64553 WORKER| Sending Shutdown to Runner
1283370597.64673 WORKER| {:pid=>99845, :io=>#<Hydra::Pipe @reader=#IO:0x4ff9cf0, @writer=#IO:0x4ff9d2c>, :idle=>true}
1283370597.64784 RUNNER| Received message from worker
1283370597.64795 RUNNER| #Hydra::Messages::Worker::Shutdown:0x4fe7dd4
rake aborted!
No files, nothing to do
spec_helper_spec.rb is a simple spec that validates some helpers that get loaded by spec_helper.rb. Normally, it loads 'spec_helper.rb'. But even if I make spec/spec_helper_spec.rb a completely empty file, I get the error. rspec is in my bundle for the 'test' environment. I have tried a lot of different things, and I can't get past this problem. It appears Hydra itself is trying to load 'rspec' and can't find it.
I found a few google references to prior issues about this, but they don't seem to exist here anymore. Any suggestions?
Thanks,
Bill
Hey guys,
Maybe this has been solved (which I'm hoping) but I was setting up hydra as our CI runner and testing locally on my laptop. I find that from time to time and much more often when there are test failures that the runners never seem to report back at the very end of the test run, generally one or two don't report back. The bigger issue with this in mind is that the test run never finishes running and gets stuck waiting on the all of the files to get run while the Master reports that it has no more files to send to any workers. As far as I can tell the runners are hitting a seg fault or anything (running on rvm which is awesome but I've had issues with 1.8.7 on certain machines). As an added note I'm using the multi db listener modified slightly from the Weplay example. Thanks for your guys' time up front.
When running Test::Unit tests, it is convention to have the test/ directory in the Ruby load path, and when running RSpec tests it's convention to have spec/ in the load path.
I think Hydra's TestTask should support a "libs" option that mirrors Ruby's TestTask "libs" and sets up the load path.
Can I use hydra if I have rspec tests where the before(:each) block contains something like
before(:each) do
User.destroy_all
@user = Factory(:user)
end
Or any other tests that rely on counting database record numbers? (For example a test that uploads initial / additional CSV files and checks that the correct number of rows are inserted into the DB).
All these tests are in the same rspec describe block, I am not sure at what level hydra splits out tests.
I am also using MongoMapper and MongoDB, not ActiveRecord and an SQL Database
From what I have read in some of the other posts these kinds of tests will fail due to sharing a database?
Is there any way to use a different database per runner process?
First I tried hydra with Rails 3.0.x app that uses Mongodb via Mongoid ORM in Ruby 1.9
Later I came to know that its not compatible with Ruby 1.9
Then I switched the env to ruby-1.8.7-p352 and started the rake again.
Now it runs but it keeps hanging on the last file saying No more files remaining.
Hydra Testing [############################> ] 54/561317296880.73323 MASTER| Sending "spec/models/worker_spec.rb"
1317296880.75142 WORKER| Received Message from Master
1317296880.75158 WORKER| #<Hydra::Messages::Master::RunFile:0x108d8f578 @file="spec/models/worker_spec.rb">
1317296882.2506 WORKER| Received Message from Runner
1317296882.25112 WORKER| #<Hydra::Messages::Runner::Results:0x108d8c968 @file="spec/models/worker_spec.rb", @output=".">
1317296882.2803 MASTER| got message: #<Hydra::Messages::Worker::Results:0x108dde240>
1317296882.28061 MASTER| 1 Files Remaining
Hydra Testing [#############################> ] 55/561317296882.29699 MASTER| No more files to send
What causes this?
I installed hydra as a gem, and was able to run a full rake task. But then if I try to run one individual test, like so:
ruby test/unit/blog_post_test.rb
... it just seems to load the environment and then exit without running any tests.
There is a workaround, which is just to simply install it as a plugin instead of a gem. For some reason that works fine--maybe there's some load-order thing going on?
I can run global tasks locally and on the remote machine, I can sync the project to the remote machine. Hydra can create an ssh worker on the remote machine, but it just won't run any tests on the remote machine! They all run, but only locally.
I think the remote worker is dying shortly after being booted, and therefore not requesting files? Is this a bug?
EDIT: 'mini' is defined in ~/.ssh/config - it's a Mac Mini on the local network, which has my public key.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.