Permalink
Browse files

upgrade cfoundry lib from 0.2.2 to 0.3.8

Change-Id: I99d996b5353e13cabd06304619f958a342c8bfd6
Signed-off-by: Pin Xie <pxie@vmware.com>
Reviewed-on: http://reviews.cloudfoundry.org/7349
Tested-by: CI Master <cf-ci@rbcon.com>
Reviewed-by: Michael Zhang <zhangcheng@rbcon.com>
  • Loading branch information...
1 parent 438dfa7 commit 42c7292dde841101820a01eb50822c002cdbefff @pxie pxie committed Jul 18, 2012
View
@@ -1,8 +1,9 @@
source "http://rubygems.org"
+#source "http://ruby.taobao.org"
gem "rake"
gem "rspec"
-gem "cfoundry", "~> 0.2.0"
+gem "cfoundry", "~> 0.3.8"
gem "vcap_logging", ">= 1.0"
gem "interact"
gem "curb"
@@ -19,3 +20,4 @@ gem "caldecott"
group :ci do
gem "ci_reporter"
end
+gem "ruby-debug19"
View
@@ -2,6 +2,7 @@ GEM
remote: http://rubygems.org/
specs:
addressable (2.2.8)
+ archive-tar-minitar (0.5.2)
async_sinatra (0.5.0)
rack (>= 1.2.1)
sinatra (>= 1.0)
@@ -15,13 +16,14 @@ GEM
em-http-request (~> 0.3.0)
em-websocket (~> 0.3.1)
uuidtools (~> 2.1.2)
- cfoundry (0.2.2)
+ cfoundry (0.3.8)
json_pure (~> 1.6.5)
rest-client (~> 1.6.1)
rubyzip (~> 0.9.5)
ci_reporter (1.6.4)
builder (>= 2.1.2)
cli (1.1.1)
+ columnize (0.3.6)
curb (0.8.0)
diff-lcs (1.1.3)
em-http-request (0.3.0)
@@ -39,6 +41,8 @@ GEM
ruby-progressbar (~> 0.0.10)
interact (0.4.2)
json_pure (1.6.7)
+ linecache19 (0.5.12)
+ ruby_core_source (>= 0.1.4)
mime-types (1.18)
mongo (1.6.2)
bson (~> 1.6.2)
@@ -60,7 +64,17 @@ GEM
diff-lcs (~> 1.1.3)
rspec-instafail (0.2.4)
rspec-mocks (2.10.1)
+ ruby-debug-base19 (0.11.25)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby_core_source (>= 0.1.4)
+ ruby-debug19 (0.11.6)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby-debug-base19 (>= 0.11.19)
ruby-progressbar (0.0.10)
+ ruby_core_source (0.1.5)
+ archive-tar-minitar (>= 0.5.2)
rubyzip (0.9.8)
sinatra (1.3.2)
rack (~> 1.3, >= 1.3.6)
@@ -88,7 +102,7 @@ PLATFORMS
DEPENDENCIES
bson_ext
caldecott
- cfoundry (~> 0.2.0)
+ cfoundry (~> 0.3.8)
ci_reporter
cli
curb
@@ -99,6 +113,7 @@ DEPENDENCIES
progressbar (~> 0.11.0)
rake
rspec
+ ruby-debug19
vcap_logging (>= 1.0)
vmc
yajl-ruby
View
@@ -348,7 +348,7 @@ def get_url(second_domain = nil)
private
def check_framework(framework)
- unless VCAP_BVT_SYSTEM_FRAMEWORKS.has_key?(framework)
+ unless VCAP_BVT_SYSTEM_FRAMEWORKS.has_key?(framework.to_sym)
@log.error("Framework: #{framework} is not available " +
"on target: #{@session.TARGET}")
raise RuntimeError, "Framework: #{framework} is not available " +
@@ -30,8 +30,9 @@ def login
@log.debug("Login in, target: #{@TARGET}, email = #{@email}, pssswd = #{@passwd}")
@client = CFoundry::Client.new(@TARGET)
begin
- @token = @client.login(@email, @passwd)
- rescue
+ @token = @client.login({:username => @email, :password => @passwd})
+ rescue Exception => e
+ puts e.to_s
@log.error "Fail to login in, target: #{@TARGET}, user: #{@email}, passwd = #{@passwd}"
raise "Cannot login target environment:\n" +
"target = '#{@TARGET}', user: '#{@email}', passwd: '#{@passwd}'.\n" +
@@ -59,24 +60,34 @@ def register(email, password)
def system_frameworks
@log.debug "get system frameworks, target: #{@TARGET}"
@info ||= @client.info
- @info["frameworks"] || {}
+ @info[:frameworks] || {}
end
def system_runtimes
@log.debug "get system runtimes, target: #{@TARGET}"
@info ||= @client.info
runtimes = {}
- @info["frameworks"].each do |_, f|
- f["runtimes"].each do |r|
- runtimes[r["name"]] = r
+ @info[:frameworks].each do |_, f|
+ f[:runtimes].each do |r|
+ runtimes[r[:name]] = r
end
end
runtimes
end
def system_services
@log.debug "get system services, target: #{@TARGET}"
- @client.system_services
+ services = {}
+ @client.services.each do |service|
+ if services[service.label]
+ versions = services[service.label][:versions] || []
+ else
+ versions = []
+ end
+ versions << service.version.to_s unless versions.index(service.version.to_s)
+ services[service.label] = {:versions => versions}
+ end
+ services
end
def app(name)
@@ -88,14 +99,14 @@ def apps
end
def services
- @client.services.collect {|service| BVT::Harness::Service.new(service, self)}
+ @client.service_instances.collect {|service| BVT::Harness::Service.new(service, self)}
end
def service(name, require_namespace=true)
if require_namespace
- BVT::Harness::Service.new(@client.service("#{@namespace}#{name}"), self)
+ BVT::Harness::Service.new(@client.service_instance("#{@namespace}#{name}"), self)
else
- BVT::Harness::Service.new(@client.service(name), self)
+ BVT::Harness::Service.new(@client.service_instance(name), self)
end
end
@@ -27,7 +27,7 @@ def bind_service(service_manifest, app, name=nil)
def create_app(app_name)
app = @session.app(app_name)
app.load_manifest
- if VCAP_BVT_SYSTEM_FRAMEWORKS.has_key?(app.manifest['framework']) &&
+ if VCAP_BVT_SYSTEM_FRAMEWORKS.has_key?(app.manifest['framework'].to_sym) &&
VCAP_BVT_SYSTEM_RUNTIMES.has_key?(app.manifest['runtime'])
else
pending("Runtime/Framework: #{app.manifest['runtime']}/#{app.manifest['framework']} " +
@@ -51,10 +51,10 @@ def get_app_info(apps, appname)
#should get app_name & status
it "get resource usage information for an application" do
app = create_push_app("simple_app2")
- hash_all = app.stats["0"]
- hash_all["state"].should == "RUNNING"
- hash_stats = hash_all["stats"]
- arr_name = hash_stats["name"].split("-")
+ hash_all = app.stats[:"0"]
+ hash_all[:state].should == "RUNNING"
+ hash_stats = hash_all[:stats]
+ arr_name = hash_stats[:name].split("-")
arr_name[1].should == "simple_app2"
end
@@ -19,8 +19,8 @@
# start app
app.start
- hash_all = app.stats["0"]
- hash_all["state"].should == "RUNNING"
+ hash_all = app.stats[:"0"]
+ hash_all[:state].should == "RUNNING"
# stop app
app.stop
@@ -26,6 +26,7 @@
@app.instances.length.should == added_instance_count
reduced_instance_count = @app.instances.length - VAR_REDUCE_INSTANCE
+ pending("there is one bug about app.update! method.")
@app.scale(reduced_instance_count, VAR_USE_MEMORY)
@app.instances.length.should == reduced_instance_count
end

0 comments on commit 42c7292

Please sign in to comment.