Permalink
Browse files

fix rails console issue

add caldecott gem

Change-Id: I2ac6db2b90dbc648bc288834207cd3c3a201d676
Signed-off-by: Pin Xie <pxie@vmware.com>
Reviewed-on: http://reviews.cloudfoundry.org/6997
Tested-by: CI Master <cf-ci@rbcon.com>
Reviewed-by: Jing Gong <jgong@rbcon.com>
  • Loading branch information...
1 parent 49422e7 commit 84a83740dc8925879b96468c01574d7772240241 @pxie pxie committed Jul 9, 2012
View
@@ -14,6 +14,7 @@ gem "fuubar"
gem "vmc"
gem "cli"
gem "progressbar", "~> 0.11.0"
+gem "caldecott"
group :ci do
gem "ci_reporter"
View
@@ -2,10 +2,19 @@ GEM
remote: http://rubygems.org/
specs:
addressable (2.2.8)
+ async_sinatra (0.5.0)
+ rack (>= 1.2.1)
+ sinatra (>= 1.0)
bson (1.6.2)
bson_ext (1.6.2)
bson (~> 1.6.2)
builder (3.0.0)
+ caldecott (0.0.5)
+ addressable (~> 2.2.6)
+ async_sinatra (~> 0.5.0)
+ em-http-request (~> 0.3.0)
+ em-websocket (~> 0.3.1)
+ uuidtools (~> 2.1.2)
cfoundry (0.2.2)
json_pure (~> 1.6.5)
rest-client (~> 1.6.1)
@@ -15,6 +24,15 @@ GEM
cli (1.1.1)
curb (0.8.0)
diff-lcs (1.1.3)
+ em-http-request (0.3.0)
+ addressable (>= 2.0.0)
+ escape_utils
+ eventmachine (>= 0.12.9)
+ em-websocket (0.3.6)
+ addressable (>= 2.1.1)
+ eventmachine (>= 0.12.9)
+ escape_utils (0.2.4)
+ eventmachine (0.12.10)
fuubar (1.0.0)
rspec (~> 2.0)
rspec-instafail (~> 0.2.0)
@@ -26,6 +44,9 @@ GEM
bson (~> 1.6.2)
nokogiri (1.5.2)
progressbar (0.11.0)
+ rack (1.4.1)
+ rack-protection (1.2.0)
+ rack
rake (0.9.2.2)
rb-readline (0.4.2)
rest-client (1.6.7)
@@ -41,16 +62,21 @@ GEM
rspec-mocks (2.10.1)
ruby-progressbar (0.0.10)
rubyzip (0.9.8)
+ sinatra (1.3.2)
+ rack (~> 1.3, >= 1.3.6)
+ rack-protection (~> 1.2)
+ tilt (~> 1.3, >= 1.3.3)
terminal-table (1.4.5)
+ tilt (1.3.3)
uuidtools (2.1.2)
vcap_logging (1.0.0)
rake
vmc (0.3.18)
addressable (~> 2.2.6)
interact (~> 0.4.0)
- json_pure (< 1.7.0, >= 1.5.1)
+ json_pure (>= 1.5.1, < 1.7.0)
rb-readline (~> 0.4.2)
- rest-client (< 1.7.0, >= 1.6.1)
+ rest-client (>= 1.6.1, < 1.7.0)
rubyzip (~> 0.9.4)
terminal-table (~> 1.4.2)
uuidtools (~> 2.1.0)
@@ -61,6 +87,7 @@ PLATFORMS
DEPENDENCIES
bson_ext
+ caldecott
cfoundry (~> 0.2.0)
ci_reporter
cli
View
@@ -58,7 +58,7 @@ def delete
end
def update!(what = {})
- @log.info("Update App: #{@app.name}")
+ @log.info("Update App: #{@app.name}, what = #{what}")
begin
@app.update!(what)
restart
@@ -0,0 +1,23 @@
+
+module BVT::Spec
+ module RailsConsoleHelper
+ def run_console(appname)
+ #Console may not be available immediately after app start
+ #if system is under heavy load. Try a few times.
+ 3.times do
+ begin
+ local_console_port = @console_cmd.console appname, false
+ @session.log.debug("console port: #{local_console_port}")
+ creds = @console_cmd.console_credentials appname
+ @session.log.debug("creds: #{creds}")
+ prompt = @console_cmd.console_login(creds, local_console_port)
+ @console_response = [prompt]
+ break
+ rescue VMC::Cli::CliExit, Errno::ECONNREFUSED => e
+ @session.log.debug("Fail to connect rails console, retrying. #{e.to_s}")
+ sleep 1
+ end
+ end
+ end
+ end
+end
@@ -3,13 +3,17 @@
require "vmc"
require "cli"
+$:.unshift(File.join(File.dirname(__FILE__)))
+require "rails_console_helper"
+
describe BVT::Spec::Simple::RailsConsole::Ruby18Rails3 do
- include BVT::Spec, BVT::Harness
+ include BVT::Spec, BVT::Harness, BVT::Spec::RailsConsoleHelper
before(:all) do
@session = BVT::Harness::CFSession.new
@client = VMC::Client.new(@session.TARGET)
@token = @client.login(@session.email, @session.passwd)
+ @session.log.debug("client token: #{@token}")
@console_cmd = VMC::Cli::Command::Apps.new
@console_cmd.client(@client)
end
@@ -18,22 +22,6 @@
@session.cleanup!
end
- def run_console(appname)
- #Console may not be available immediately after app start
- #if system is under heavy load. Try a few times.
- 3.times do
- begin
- local_console_port = @console_cmd.console appname, false
- creds = @console_cmd.console_credentials appname
- prompt = @console_cmd.console_login(creds, local_console_port)
- @console_response = [prompt]
- break
- rescue VMC::Cli::CliExit
- sleep 1
- end
- end
- end
-
it "rails test console", :p1 => true do
app = create_push_app("rails_console_test_app")
manifest = {}
@@ -47,11 +35,18 @@ def run_console(appname)
expected_results = ["irb():001:0> "]
expected_results.should == @console_response
- @console_response = @console_cmd.send_console_command("app.class")
+ 2.times do
+ begin
+ @console_response = @console_cmd.send_console_command("app.class")
+ break
+ rescue EOFError => e
+ @session.log.debug("Fail to connect rails console, retrying. #{e.to_s}")
+ end
+ end
+
expected_results = ("app.class,=> ActionDispatch::Integration::Session,irb" +
"():002:0> ").split(",")
expected_results.should == @console_response
-
@console_cmd.close_console if @console_cmd
end
@@ -3,8 +3,11 @@
require "vmc"
require "cli"
+$:.unshift(File.join(File.dirname(__FILE__)))
+require "rails_console_helper"
+
describe BVT::Spec::Simple::RailsConsole::Ruby19Rails3 do
- include BVT::Spec, BVT::Harness
+ include BVT::Spec, BVT::Harness, BVT::Spec::RailsConsoleHelper
before(:all) do
@session = BVT::Harness::CFSession.new
@@ -18,22 +21,6 @@
@session.cleanup!
end
- def run_console(appname)
- #Console may not be available immediately after app start
- #if system is under heavy load. Try a few times.
- 3.times do
- begin
- local_console_port = @console_cmd.console appname, false
- creds = @console_cmd.console_credentials appname
- prompt = @console_cmd.console_login(creds, local_console_port)
- @console_response = [prompt]
- break
- rescue VMC::Cli::CliExit
- sleep 1
- end
- end
- end
-
it "rails test console rake tasks with ruby 1.9" do
app = create_push_app("rails_console_19_test_app")
manifest = {}

0 comments on commit 84a8374

Please sign in to comment.