3

parallel_tests Gem を使用してスペックを並行して実行しようとすると、次のエラー メッセージが表示されます。

foo:~/Projects/cucumber-capybara-saucelabs/spec/requests [] ➜ rake parallel:spec
(in /Volumes/Storage/Projects/cucumber-capybara-saucelabs)
8 processes for 5 specs, ~ 0 specs per process
Starting Rails server on port 3001...
Starting Rails server on port 3001...
Starting Rails server on port 3001...
Starting Rails server on port 3001...
Starting Rails server on port 3001...
[2013-05-22 14:40:12] INFO  WEBrick 1.3.1
[2013-05-22 14:40:12] INFO  ruby 1.9.3 (2013-02-22) [x86_64-darwin12.3.0]
[2013-05-22 14:40:12] INFO  WEBrick::HTTPServer#start: pid=33256 port=3001
Rails server running!
Rails server running!
Rails server running!
Rails server running!
[2013-05-22 14:40:12] INFO  WEBrick 1.3.1
[2013-05-22 14:40:12] INFO  WEBrick 1.3.1
[2013-05-22 14:40:12] INFO  ruby 1.9.3 (2013-02-22) [x86_64-darwin12.3.0]
[2013-05-22 14:40:12] INFO  WEBrick 1.3.1
[2013-05-22 14:40:12] INFO  ruby 1.9.3 (2013-02-22) [x86_64-darwin12.3.0]
[2013-05-22 14:40:12] INFO  ruby 1.9.3 (2013-02-22) [x86_64-darwin12.3.0]
[2013-05-22 14:40:12] WARN  TCPServer Error: Address already in use - bind(2)
[2013-05-22 14:40:12] WARN  TCPServer Error: Address already in use - bind(2)
[2013-05-22 14:40:12] WARN  TCPServer Error: Address already in use - bind(2)
/Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/utils.rb:85:in `initialize': Address already in use - bind(2) (/Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/utils.rb:85:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
    from /Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/utils.rb:85:in `new'
    from /Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/utils.rb:85:in `block in create_listeners'
    from /Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/utils.rb:82:in `each'
    from /Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/utils.rb:82:in `create_listeners'
    from /Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/server.rb:82:in `listen'
    from /Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/server.rb:70:in `initialize'
    from /Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/httpserver.rb:45:in `initialize'
    from /Users/foo/.rvm/gems/ruby-1.9.3-p392@rails-3/gems/rack-1.4.5/lib/rack/handler/webrick.rb:10:in `new'
    from /Users/foo/.rvm/Users/foo/.rvm/gems/ruby-1.9.3-p392@rails-3/gems/rack-1.4.5/lib/rack/server.rb:323:in `delete': No such file or directory - /Volumes/Storage/Projects/cucumber-capybara-saucelabs/tmp/pids/server.pid (Errno::ENOENT)
    from /Users/foo/.rvm/gems/ruby-1.9.3-p392@rails-3/gems/rack-1.4.5/lib/rack/server.rb:323:in `block in write_pid'
/Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/utils.rb:85:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
    from /Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/utils.rb:85:in `new'
    from /Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/utils.rb:85:in `block in create_listeners'
    from /Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/utils.rb:82:in `each'
    from /Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/utils.rb:82:in `create_listeners'
    from /Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/server.rb:82:in `listen'
    from /Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/server.rb:70:in `initialize'
    from /Users/foo/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/httpserver.rb:45:in `initialize'
    from /Users/foo[2013-05-22 14:40:12] INFO  WEBrick 1.3.1
sa/.rvm/gems/ruby-1.9.3-p392@rails-3/gems/rack-1.4.5/lib/rack/handler/webrick.rb:10:in `new'
    from /Users/foo/.rvm/gems/ruby-1.9.3-p392@rails-3/gems/rack-1.4.5/lib/rack/handler/webrick.rb:10:in `run'
    from /Users/foo/.rvm/gems/ruby-1.9.3-p392@rails-3/gems/rack-1.4.5/lib/rack/server.rb:268:in `start'
    from /Users/foo/.rvm/gems/ruby-1.9.3-p392@rails-3/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
    from /Users/foo/.rvm/gems/ruby-1.9.3-p392@rails-3/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /Users/foo/.rvm/gems/ruby-1.9.3-p392@rails-3/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
    from /Users/foo/.rvm/gems/ruby-1.9.3-p392@rails-3/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

これを回避する方法はありますか?

4

1 に答える 1

4

wikiで説明されているように、次のことを行う必要があります。

Capybara.server_port = 9887 + ENV['TEST_ENV_NUMBER'].to_i
于 2014-08-18T18:30:33.077 に答える