Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Restructure YETIs, remove all tags [#46161019]

  • Loading branch information...
commit f8abe5b1890d9ed4c3061327553d5b8d1e1b4df0 1 parent 8bafb08
Bleicke and Tim Labeeuw authored
Showing with 207 additions and 319 deletions.
  1. +0 −4 Gemfile
  2. +5 −25 Gemfile.lock
  3. +0 −3  README.md
  4. +12 −89 Rakefile
  5. +1 −1  config/assets.yml
  6. +2 −2 lib/harness/app.rb
  7. +2 −2 lib/harness/cfsession.rb
  8. +6 −2 lib/harness/logger_helper.rb
  9. +0 −2  lib/harness/rake_helper.rb
  10. +17 −24 lib/harness/user.rb
  11. 0  spec/{simple → apps}/async_staging_spec.rb
  12. 0  spec/{simple → apps}/domain_spec.rb
  13. +1 −1  spec/{simple → apps}/file_range_spec.rb
  14. 0  spec/{simple → apps}/info_spec.rb
  15. +3 −3 spec/{simple → apps}/java_java_web_spec.rb
  16. +2 −2 spec/{simple → apps}/java_spec.rb
  17. 0  spec/{simple → apps}/lifecycle_spec.rb
  18. 0  spec/{simple → apps}/name_collision_spec.rb
  19. +4 −5 spec/{simple → apps}/node_spec.rb
  20. +3 −3 spec/{simple → apps}/ruby_gems_spec.rb
  21. 0  spec/{simple → apps}/ruby_rails3_spec.rb
  22. +1 −1  spec/{simple → apps}/ruby_spec.rb
  23. +1 −1  spec/{simple → apps}/space_spec.rb
  24. +3 −3 spec/{simple → apps}/update_spec.rb
  25. +0 −3  spec/cfcore/cfcore_helper.rb
  26. +1 −1  spec/{performance → core}/app_performance_spec.rb
  27. +1 −1  spec/{mcf → core}/app_response_timeout_spec.rb
  28. +2 −4 spec/{cfcore → core}/debug_spec.rb
  29. +2 −2 spec/{cfcore → core}/service_versions_spec.rb
  30. +11 −3 spec/spec_helper.rb
  31. +1 −3 spec/{cfcore/service_matcher.rb → support/service_helper.rb}
  32. +113 −0 spec/support/uaa_helper.rb
  33. +6 −6 spec/tools/rails_console_spec.rb
  34. +2 −3 spec/user/admin_user_spec.rb
  35. +2 −2 spec/user/normal_user_spec.rb
  36. +3 −118 spec/user/uaa_spec.rb
  37. BIN  vendor/cache/cf-uaac-1.3.3.gem
View
4 Gemfile
@@ -11,15 +11,11 @@ gem "bson_ext"
gem "yajl-ruby"
gem "nokogiri"
-gem "fuubar"
-gem "progressbar", "~> 0.11.0"
-
group :vcap do
gem "interact"
gem "caldecott"
gem "vcap_logging", ">= 1.0"
- gem "cf-uaac", "= 1.3.3"
gem "cfoundry", :github => "cloudfoundry/vmc-lib", :submodules => true
gem "tunnel-vmc-plugin", :github => "cloudfoundry/tunnel-vmc-plugin"
gem "console-vmc-plugin", :github => "cloudfoundry/console-vmc-plugin"
View
30 Gemfile.lock
@@ -18,11 +18,11 @@ GIT
GIT
remote: git://github.com/cloudfoundry/vmc-lib.git
- revision: e11ddf5d7e9fce165a1f917bd4a9dbd4ecb0739f
+ revision: d315077a450b97738e88b8155ab46d9446355bbc
submodules: true
specs:
- cfoundry (0.5.1.rc2)
- cf-uaa-lib (~> 1.3.3)
+ cfoundry (0.5.3.rc6)
+ cf-uaa-lib (~> 1.3.10)
multi_json (~> 1.3)
multipart-post (~> 1.1)
rubyzip (~> 0.9)
@@ -50,15 +50,8 @@ GEM
uuidtools (~> 2.1.2)
caldecott-client (0.0.2)
multi_json (~> 1.3)
- cf-uaa-lib (1.3.3)
+ cf-uaa-lib (1.3.10)
multi_json
- cf-uaac (1.3.3)
- cf-uaa-lib (>= 1.3.3, <= 1.3.3)
- em-http-request (= 0.3.0)
- eventmachine
- highline
- json_pure
- launchy
diff-lcs (1.1.3)
em-http-request (0.3.0)
addressable (>= 2.0.0)
@@ -69,21 +62,13 @@ GEM
eventmachine (>= 0.12.9)
escape_utils (0.2.4)
eventmachine (1.0.0)
- fuubar (1.1.0)
- rspec (~> 2.0)
- rspec-instafail (~> 0.2.0)
- ruby-progressbar (~> 1.0.0)
- highline (1.6.15)
i18n (0.6.1)
interact (0.5.0)
json (1.6.7)
- json_pure (1.7.5)
- launchy (2.1.0)
- addressable (~> 2.2.6)
mime-types (1.20.1)
mongo (1.8.0)
bson (~> 1.8.0)
- multi_json (1.5.0)
+ multi_json (1.7.1)
multipart-post (1.2.0)
nokogiri (1.5.5)
progressbar (0.11.0)
@@ -100,11 +85,9 @@ GEM
rspec-core (2.12.1)
rspec-expectations (2.12.0)
diff-lcs (~> 1.1.3)
- rspec-instafail (0.2.4)
rspec-mocks (2.12.0)
rspec_parallel (0.1.6)
progressbar (>= 0.11.0)
- ruby-progressbar (1.0.2)
rubyzip (0.9.9)
sinatra (1.3.4)
rack (~> 1.4)
@@ -122,14 +105,11 @@ PLATFORMS
DEPENDENCIES
bson_ext
caldecott
- cf-uaac (= 1.3.3)
cfoundry!
console-vmc-plugin!
- fuubar
interact
mongo
nokogiri
- progressbar (~> 0.11.0)
rake
rest-client
rspec
View
3  README.md
@@ -176,9 +176,6 @@ Rake Tasks:
<br>run core tests for verifying that an installation meets minimal Cloud Foundry
compatibility requirements
<br>e.g. rake core\[5\] (default to 10, max = 16)
-- mcf
-<br>run Micro Cloud Foundry tests
-<br>e.g. rake mcf\[5\] (default to 10, max = 16)
- rerun
<br>rerun failed cases of the last run
<br>e.g. rake rerun\[5\] (default to 10, max = 16)
View
101 Rakefile
@@ -4,39 +4,9 @@ require "harness"
include BVT::Harness
include BVT::Harness::ColorHelpers
-task :default => [:help]
+task :default => [:full]
-desc "List help commands"
-task :help do
- puts "Usage: rake [command]"
- puts " admin\t\trun admin test cases"
- puts " tests\t\trun core tests in parallel, e.g. rake test[5] (default to 10, max = 16)\n"
- puts " \t\tOptions: VCAP_BVT_LONGEVITY=N can loop this task.\n"
- puts " \t\te.g. rake tests[8] VCAP_BVT_LONGEVITY=10"
- puts " \t\tVCAP_BVT_CONFIG_FILE=[path_to_config_file] to specify config file.\n"
- puts " \t\te.g. rake tests VCAP_BVT_CONFIG_FILE=/home/czhang/my_test.yml\n"
- puts " \t\tAbove options are also usable in other tasks."
- puts " full\t\trun full tests in parallel, e.g. rake full[5] (default to 10, max = 16)"
- puts " random\trun all bvts randomly, e.g. rake random[1023] to re-run seed 1023"
- puts " java\t\trun java tests (spring, java_web) in parallel\n" +
- "\t\te.g. rake java[5] (default to 10, max = 16)"
- puts " jvm\t\trun jvm tests (spring, java_web, grails, lift) in parallel\n" +
- "\t\te.g. rake jvm[5] (default to 10, max = 16)"
- puts " ruby\t\trun ruby tests (rails3, sinatra, rack) in parallel\n" +
- "\t\te.g. rake ruby[5] (default to 10, max = 16)"
- puts " services\trun service tests (mongodb/redis/mysql/postgres/rabbitmq/neo4j/vblob) in parallel\n" +
- "\t\te.g. rake services[5] (default to 10, max = 16)"
- puts " core\t\trun core tests for verifying that an installation meets\n" +
- "\t\tminimal Cloud Foundry compatibility requirements"
- puts " mcf\t\trun Micro Cloud Foundry tests\n"
- puts " clean\t\tclean up test environment(only run this task after interruption).\n" +
- "\t\t 1, Remove all apps and services under test user\n" +
- "\t\t 2, Remove all apps and services under parallel users"
- puts " rerun\t\trerun failed cases of the previous run\n"
- puts " help\t\tlist help commands"
-end
-
-desc "run full tests (not include admin cases)"
+desc "run full tests in parallel, e.g. rake full[5] (default to 10, max = 16)"
task :full, :thread_number do |t, args|
RakeHelper.sync_assets
threads = 10
@@ -46,46 +16,7 @@ task :full, :thread_number do |t, args|
longevity(threads, {'tags' => '~admin'})
end
-desc "run tests (don't include admin and slow cases)"
-task :fast, :thread_number do |t, args|
- RakeHelper.sync_assets
- threads = 10
- threads = args[:thread_number].to_i if args[:thread_number]
- RakeHelper.prepare_all(threads)
- create_reports_folder
- longevity(threads, {'tags' => '~admin,~slow'})
-end
-
-desc "run tests subset"
-task :tests, :thread_number do |t, args|
- RakeHelper.sync_assets
- threads = 10
- threads = args[:thread_number].to_i if args[:thread_number]
- RakeHelper.prepare_all(threads)
- create_reports_folder
- longevity(threads, {'tags' => 'p1,~admin,~slow'})
-end
-
-desc "Run all bvts randomly, add [N] to specify a seed"
-task :random, :seed do |t, args|
- RakeHelper.sync_assets
- if args[:seed] != nil
- sh "bundle exec rspec spec/ --tag ~admin --tag ~slow" +
- " --seed #{args[:seed]} --format d -c"
- else
- sh "bundle exec rspec spec/ --tag ~admin --tag ~slow" +
- " --order rand --format d -c"
- end
-end
-
-desc "Run admin test cases"
-task :admin do
- RakeHelper.prepare_all
- create_reports_folder
- longevity(1, {'tags' => 'admin'})
-end
-
-desc "Run java tests (spring, java_web)"
+desc "run java tests (spring, java_web) in parallel, e.g. rake java[5] (default to 10, max = 16)"
task :java, :thread_number, :longevity, :fail_fast do |t, args|
RakeHelper.sync_assets
threads = 10
@@ -95,7 +26,7 @@ task :java, :thread_number, :longevity, :fail_fast do |t, args|
longevity(threads, {'pattern' => /_(spring|java_web)_spec\.rb/})
end
-desc "Run jvm tests (spring, java_web, grails, lift)"
+desc "tests (spring, java_web, grails, lift) in parallel e.g. rake jvm[5] (default to 10, max = 16)"
task :jvm, :thread_number do |t, args|
RakeHelper.sync_assets
threads = 10
@@ -105,7 +36,7 @@ task :jvm, :thread_number do |t, args|
longevity(threads, {'pattern' => /_(spring|java_web|grails|lift)_spec\.rb/})
end
-desc "Run ruby tests (rails3, sinatra, rack)"
+desc "run ruby tests (rails3, sinatra, rack) in parallel e.g. rake ruby[5] (default to 10, max = 16)"
task :ruby, :thread_number do |t, args|
threads = 10
threads = args[:thread_number].to_i if args[:thread_number]
@@ -114,7 +45,7 @@ task :ruby, :thread_number do |t, args|
longevity(threads, {'pattern' => /ruby_.+_spec\.rb/})
end
-desc "Run service tests (mongodb, redis, mysql, postgres, rabbitmq, neo4j, vblob)"
+desc "run service tests (mongodb/redis/mysql/postgres/rabbitmq/neo4j/vblob) in parallel e.g. rake services[5] (default to 10, max = 16)"
task :services, :thread_number do |t, args|
RakeHelper.sync_assets
threads = 10
@@ -128,7 +59,11 @@ task :services, :thread_number do |t, args|
end
end
-desc "Clean up test environment"
+desc <<-CLEAN
+clean up test environment(only run this task after interruption).
+ 1, Remove all apps and services under test user
+ 2, Remove all apps and services under parallel users
+CLEAN
task :clean do
RakeHelper.cleanup!
end
@@ -166,16 +101,6 @@ task :delete_orgs do
sh "./tools/scripts/yeti-hunter.rb"
end
-desc 'run core tests for verifying that an installation meets minimal Cloud Foundry compatibility requirements'
-RSpec::Core::RakeTask.new(:core) do |t|
- t.rspec_opts = '--tag cfcore'
-end
-
-desc 'run Micro Cloud Foundry tests'
-RSpec::Core::RakeTask.new(:mcf) do |t|
- t.rspec_opts = '--tag mcf'
-end
-
def create_reports_folder
output = `ls .`
if output.include? 'reports'
@@ -186,8 +111,7 @@ def create_reports_folder
end
def get_longevity_number
- return ENV['VCAP_BVT_LONGEVITY'].to_i if ENV['VCAP_BVT_LONGEVITY']
- return 1
+ ENV['VCAP_BVT_LONGEVITY'] ? ENV['VCAP_BVT_LONGEVITY'].to_i : 1
end
def longevity(threads, filter, rerun=false)
@@ -241,4 +165,3 @@ def longevity(threads, filter, rerun=false)
exit(0)
end
end
-
View
2  config/assets.yml
@@ -5,7 +5,7 @@
# Since we have switched to buildpacks staging time has increased
# so until we start caching gems, bins, etc. timeout is 5min
-timeout_secs: 900
+timeout_secs: 120
job_timeout_secs: 30
sleep_secs: 1
View
4 lib/harness/app.rb
@@ -10,7 +10,7 @@ def initialize(app, session, domain=nil)
@session = session
@client = @session.client
@log = @session.log
- @domain = domain
+ @domain = domain
end
def inspect
@@ -379,7 +379,7 @@ def logs
raise RuntimeError, "Fail to get logs for Application: #{@app.name}!" +
"\n#{e.to_s}\n#{@session.print_client_logs}"
end
- @log.debug("Get Application #{@app.name}, logs contents: #{body}")
+ @log.debug("=============== Get Application #{@app.name}, logs contents: #{body}")
body
end
View
4 lib/harness/cfsession.rb
@@ -43,7 +43,7 @@ def inspect
end
def login
- @log.debug("Login in, target: #{@TARGET}, email = #{@email}")
+ @log.info("Login in, target: #{@TARGET}, email = #{@email}")
@client = CFoundry::Client.new(@TARGET)
@client.trace = true if ENV['VCAP_BVT_TRACE']
@client.log = []
@@ -362,4 +362,4 @@ def is_user_admin?(email, passwd)
end
end
end
-end
+end
View
8 lib/harness/logger_helper.rb
@@ -1,4 +1,3 @@
-
module BVT::Harness
module LoggerHelper
attr_reader :logfile
@@ -9,10 +8,15 @@ def set_logger(target)
filename = target ? "bvt.#{target_without_http(target)}.log" : "bvt.log"
logfile = File.join(VCAP_BVT_HOME, filename)
loglevel = :debug
- config = {:level => loglevel, :file => logfile}
+ config = {
+ :level => loglevel,
+ :file => logfile
+ }
+
Dir.mkdir(VCAP_BVT_HOME) unless Dir.exist?(VCAP_BVT_HOME)
VCAP::Logging.reset
VCAP::Logging.setup_from_config(config)
+ VCAP::Logging.add_sink(:warn, nil, VCAP::Logging::Sink::StdioSink.new(STDOUT, VCAP::Logging::FORMATTER))
end
def target_without_http(target)
View
2  lib/harness/rake_helper.rb
@@ -23,8 +23,6 @@ def prepare_all(threads=nil)
if threads == nil
get_admin_user
get_admin_user_passwd
- admin_user = {'email' => @config['admin']['email'],
- 'passwd' => @config['admin']['passwd']}
elsif threads < 1 || threads > VCAP_BVT_PARALLEL_MAX_USERS
puts red("threads number must be within 1~#{VCAP_BVT_PARALLEL_MAX_USERS}")
exit(1)
View
41 lib/harness/user.rb
@@ -17,38 +17,31 @@ def inspect
def create(passwd)
@log.info("Create User: #{@email} via Admin User: #{@session.email}")
- begin
- @session.register(@email, passwd)
- @passwd = passwd
- rescue
- @log.error("Failed to create user: #{@email}")
- raise RuntimeError, "Failed to create user: #{@email}"
- end
+ @session.register(@email, passwd)
+ @passwd = passwd
+ rescue
+ @log.error("Failed to create user: #{@email}")
+ raise
end
def delete
- @log.info("Delete User: #{@email} via Admin User:#{@session.email}")
- begin
- @user.delete!
- rescue Exception => e
- # if @user has been deleted, ignore the exception
- unless @user
- @log.error("Failed to delete user")
- raise RuntimeError, "Failed to delete user.\n#{e.to_s}"
- end
+ @log.info("Delete User: #{@email} via Admin User:#{@session.email}")
+ @user.delete!
+ rescue
+ # if @user has been deleted, ignore the exception
+ unless @user
+ @log.error("Failed to delete user")
+ raise
end
end
def change_passwd(new_passwd)
@log.info "Change User: #{@email} password, new passwd = #{new_passwd}"
- begin
- @user.password = new_passwd
- @user.update!
- rescue
- @log.error("Fail to change password for user: #{@email}")
- raise RuntimeError,
- "Fail to change passsword for user = #{@email}"
- end
+ @user.password = new_passwd
+ @user.update!
+ rescue
+ @log.error("Fail to change password for user: #{@email}")
+ raise
end
end
end
View
0  spec/simple/async_staging_spec.rb → spec/apps/async_staging_spec.rb
File renamed without changes
View
0  spec/simple/domain_spec.rb → spec/apps/domain_spec.rb
File renamed without changes
View
2  spec/simple/file_range_spec.rb → spec/apps/file_range_spec.rb
@@ -18,7 +18,7 @@
FILE_NAME = "foo.rb"
- it "should get back the final 10 bytes of the file", :p1 => true do
+ it "should get back the final 10 bytes of the file" do
@app = create_push_app("simple_app")
@app.stats.should_not == nil
View
0  spec/simple/info_spec.rb → spec/apps/info_spec.rb
File renamed without changes
View
6 spec/simple/java_java_web_spec.rb → spec/apps/java_java_web_spec.rb
@@ -14,7 +14,7 @@
@session.cleanup!
end
- it "get application list", :slow => true, :p1 => true do
+ it "get application list" do
app1 = create_push_app("simple_app2")
app2 = create_push_app("tiny_java_app")
@@ -24,7 +24,7 @@
}
end
- it "start java app with startup delay", :slow => true do
+ it "start java app with startup delay" do
app = create_push_app("java_app_with_startup_delay")
contents = app.get_response(:get)
@@ -33,7 +33,7 @@
contents.to_str.should =~ /I am up and running/
end
- it "tomcat validation", :p1 => true do
+ it "tomcat validation" do
app = create_push_app("tomcat-version-check-app")
response = app.get_response(:get)
View
4 spec/simple/java_spec.rb → spec/apps/java_spec.rb
@@ -8,12 +8,12 @@
@session = BVT::Harness::CFSession.new
end
- after(:each) do
+ after do
show_crashlogs
@session.cleanup!
end
- it "simple java app", :p1 => true do
+ it "simple java app" do
app = create_push_app("standalone_java_app")
contents = app.get_response(:get)
View
0  spec/simple/lifecycle_spec.rb → spec/apps/lifecycle_spec.rb
File renamed without changes
View
0  spec/simple/name_collision_spec.rb → spec/apps/name_collision_spec.rb
File renamed without changes
View
9 spec/simple/node_spec.rb → spec/apps/node_spec.rb
@@ -13,8 +13,7 @@
@session.cleanup!
end
- it "access my application root and see it's running version",
- :p1 => true do
+ it "access my application root and see it's running version" do
app = create_push_app("app_node_version04")
app.stats.should_not == nil
app.get_response(:get).should_not == nil
@@ -30,7 +29,7 @@
app.get_response(:get).to_str.should == "hello from git"
end
- it "access my application root and see hello from express", :p1 => true do
+ it "access my application root and see hello from express" do
app = create_push_app("app_node_dependencies06")
app.stats.should_not == nil
app.get_response(:get).should_not == nil
@@ -38,13 +37,13 @@
app.get_response(:get).to_str.should == "hello from express"
end
- it "access my application root and see hello from node-gyp", :p1 => true do
+ it "access my application root and see hello from node-gyp" do
app = create_push_app("app_node_dependencies08")
app.stats.should_not == nil
app.get_response(:get).to_str.should == "hello from node-gyp"
end
- it "Simple node app and no URL", :p1 => true do
+ it "Simple node app and no URL" do
app = create_push_app("standalone_node_app")
app.logs =~ /it's running version/
end
View
6 spec/simple/ruby_gems_spec.rb → spec/apps/ruby_gems_spec.rb
@@ -24,7 +24,7 @@ def add_env(app,key,value)
app.start
end
- it "access my application root and see hello from sinatra", :p1 => true do
+ it "access my application root and see hello from sinatra" do
app = create_push_app("broken_gem_app")
app.stats.should_not == nil
app.get_response(:get).should_not == nil
@@ -40,7 +40,7 @@ def add_env(app,key,value)
response.to_str.should == "hello from git"
end
- it "sinatra test deploy app with git gems using ruby18", :slow => true do
+ it "sinatra test deploy app with git gems using ruby18" do
app = create_push_app("git_gems_app_ruby18")
app.stats.should_not == nil
response = app.get_response(:get,"/")
@@ -48,7 +48,7 @@ def add_env(app,key,value)
response.to_str.should == "hello from git"
end
- it "sinatra test deploy app with Gemfile.lock containing Windows versions", :mysql=>true, :postgresql=>true do
+ it "sinatra test deploy app with Gemfile.lock containing Windows versions" do
app = create_push_app("sinatra_windows_gemfile", nil, nil, [MYSQL_MANIFEST, POSTGRESQL_MANIFEST])
staging_log = app.file("logs/staging_task.log")
staging_log.should_not match "Installing yajl-ruby"
View
0  spec/simple/ruby_rails3_spec.rb → spec/apps/ruby_rails3_spec.rb
File renamed without changes
View
2  spec/simple/ruby_spec.rb → spec/apps/ruby_spec.rb
@@ -18,7 +18,7 @@
app.get_response(:get).to_str.should == "running version 1.9.2"
end
- it "Simple ruby app and no URL", :p1 => true do
+ it "Simple ruby app and no URL" do
app = create_push_app("standalone_simple_ruby_app")
app.logs =~ /running version 1.9.2/
end
View
2  spec/simple/space_spec.rb → spec/apps/space_spec.rb
@@ -17,7 +17,7 @@
let(:space_name) { "space#{rand(2**32).to_s(36)}" }
- it "test create space", :slow => true do
+ it "test create space" do
spaces = @session.spaces
spaces.each { |s| s.delete(true) if s.name == space_name }
View
6 spec/simple/update_spec.rb → spec/apps/update_spec.rb
@@ -21,7 +21,7 @@
@session.cleanup!
end
- it "increase/decrease instance count", :p1 => true do
+ it "increase/decrease instance count" do
added_instance_count = @app.instances.length + VAR_INC_INSTANCE
@app.scale(added_instance_count, VAR_USE_MEMORY)
@app.instances.length.should == added_instance_count
@@ -31,7 +31,7 @@
@app.instances.length.should == reduced_instance_count
end
- it "map and unmap a url for the application to respond to", :p1 => true do
+ it "map and unmap a url for the application to respond to" do
response = @app.get_response(:get, "/")
response.to_str.should =~ /Hello from VCAP!/
@@ -53,7 +53,7 @@
" mapped to application: #{@app.name}"
end
- it "redeploy application", :p1 => true do
+ it "redeploy application" do
@app.push(nil, "modified_simple_app2")
@app.get_response(:get).to_str.should =~ /Hello from modified VCAP/
end
View
3  spec/cfcore/cfcore_helper.rb
@@ -1,3 +0,0 @@
-require 'spec_helper'
-
-require 'cfcore/service_matcher'
View
2  spec/performance/app_performance_spec.rb → spec/core/app_performance_spec.rb
@@ -56,7 +56,7 @@ def reset_counter(app)
response.code.should == 200
end
- it "deploy redis lb app", :slow => true, :redis => true, :p1 => true do
+ it "deploy redis lb app" do
app = create_push_app("redis_lb_app", nil, nil, [REDIS_MANIFEST])
health_check(app)
View
2  spec/mcf/app_response_timeout_spec.rb → spec/core/app_response_timeout_spec.rb
@@ -1,6 +1,6 @@
require "spec_helper"
-describe "app response timeout", :mcf => true, :slow => true do
+describe "app response timeout" do
before(:all) do
@session = BVT::Harness::CFSession.new
end
View
6 spec/cfcore/debug_spec.rb → spec/core/debug_spec.rb
@@ -1,7 +1,6 @@
-require 'cfcore/cfcore_helper'
-
-describe 'debug mode', :cfcore => true, :mcf => true do
+require 'spec_helper'
+describe 'debug mode' do
before(:all) do
@session = BVT::Harness::CFSession.new
end
@@ -13,5 +12,4 @@
info[:allow_debug].should be_false
end
end
-
end
View
4 spec/cfcore/service_versions_spec.rb → spec/core/service_versions_spec.rb
@@ -1,6 +1,6 @@
-require 'cfcore/cfcore_helper'
+require 'spec_helper'
-describe 'core services', :cfcore => true, :mcf => true do
+describe 'core services' do
before(:all) do
@session = BVT::Harness::CFSession.new
View
14 spec/spec_helper.rb
@@ -4,14 +4,16 @@
require 'syck'
YAML::ENGINE.yamler = 'syck'
+Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].map { |f| require f }
+
class Bignum
- def to_json(options = nil)
+ def to_json(_ = nil)
to_s
end
end
class Fixnum
- def to_json(options = nil)
+ def to_json(_ = nil)
to_s
end
end
@@ -50,8 +52,14 @@ def log_case_begin_end(flag)
end
def show_crashlogs
- if example.exception && @current_app
+ return unless example.exception
+ logger = VCAP::Logging.logger(File.basename($0))
+
+ if @current_app
+ @current_app.logs
@current_app.crashlogs
+ else
+ logger.warn("==== Spec failed, but no app detected ====")
end
end
View
4 spec/cfcore/service_matcher.rb → spec/support/service_helper.rb
@@ -1,5 +1,3 @@
-# Matches if the service with name and version is found in the result of
-# system_service.
RSpec::Matchers.define :have_service do |name, version|
default_provider = 'core'
match do |system_services|
@@ -11,4 +9,4 @@
"should support service #{name} version #{version}"
end
-end
+end
View
113 spec/support/uaa_helper.rb
@@ -0,0 +1,113 @@
+class UaaHelper
+ include Singleton
+
+ attr_writer :uaabase, :loginbase, :username, :password
+
+ def initialize
+ @admin_client = ENV['VCAP_BVT_ADMIN_CLIENT'] || "admin"
+ @admin_secret = ENV['VCAP_BVT_ADMIN_SECRET'] || "adminsecret"
+ puts "** Using admin client: '#{@admin_client}' (set environment variables" +
+ " VCAP_BVT_ADMIN_CLIENT / VCAP_BVT_ADMIN_SECRET to override) **"
+ @username = "dev@cloudfoundry.org"
+ @password = "dev"
+ end
+
+ def webclient
+
+ return @webclient if @webclient
+
+ begin
+ token = client_token(@admin_client, @admin_secret)
+ rescue RestClient::Unauthorized
+ #raise RuntimeError, "Unauthorized admin client (check your config or env vars)"
+ end
+ return nil unless token
+
+ client_id = "testapp"
+ begin
+ client = get_client(client_id, token).clone
+ client["client_id"].should_not == nil
+ if client["scope"].nil? || client["scope"].empty? || client["scope"]==["uaa.none"] then
+ client["scope"] = ["openid", "cloud_controller.read"]
+ update_client(client, token)
+ end
+ @webclient = {:client_id=>client["client_id"]}
+ rescue RestClient::ResourceNotFound
+ @webclient = register_client({:client_id=>client_id,
+ :client_secret=>"appsecret", :authorized_grant_types=>
+ ["authorization_code"], :scope=>["openid", "cloud_controller.read"]}, token)
+ rescue RestClient::Unauthorized
+ raise RuntimeError, "Unauthorized admin client not able to create new client"
+ end
+
+ @webclient
+
+ end
+
+ def client_token(client_id, client_secret)
+ url = @loginbase + "/oauth/token"
+ response = RestClient.post url, {:client_id=>client_id,
+ :grant_type=>"client_credentials"}, {"Accept"=>"application/json",
+ "Authorization"=>basic_auth(client_id, client_secret)}
+ response.should_not == nil
+ response.code.should == 200
+ JSON.parse(response.body)["access_token"]
+ end
+
+ def login
+ url = @loginbase + "/login.do"
+ response = RestClient.post url, {:username=>@username, :password=>@password},
+ {"Accept"=>"application/json"} { |response, request, result| response }
+ response.should_not == nil
+ response.code.should == 302
+ response.headers
+ end
+
+ def get_client(client_id, token)
+ url = @uaabase + "/oauth/clients/#{client_id}"
+ response = RestClient.get url, {"Authorization"=>
+ "Bearer #{token}", "Accept"=>"application/json"}
+ JSON.parse(response.body)
+ end
+
+ def register_client(client, token)
+ url = @uaabase + "/oauth/clients"
+ response = RestClient.post url, client.to_json, {"Authorization"=>
+ "Bearer #{token}", "Content-Type"=>"application/json"}
+ response.should_not == nil
+ (response.code/100).should == 2
+ client
+ end
+
+ def update_client(client, token)
+ url = @uaabase + "/oauth/clients/" + client["client_id"]
+ response = RestClient.put url, client.to_json, {"Authorization"=>"Bearer #{token}", "Content-Type"=>"application/json"}
+ (response.code/100).should == 2
+ client
+ end
+
+ def basic_auth(id, secret)
+ "Basic " + Base64::strict_encode64("#{id}:#{secret}")
+ end
+
+ def get_url(path,headers={})
+ url = @loginbase + path
+ headers[:accept] = "application/json"
+ response = RestClient.get url, headers
+ response.should_not == nil
+ response.code.should == 200
+ response.body.should_not == nil
+ response.body
+ end
+
+ def get_status(path)
+ url = @uaabase + path
+ begin
+ response = RestClient.get url, {"Accept"=>"application/json"}
+ response.code
+ rescue RestClient::Exception => e
+ e.http_code
+ end
+ end
+
+end
View
12 spec/tools/rails_console_spec.rb
@@ -22,7 +22,7 @@ def cfoundry_app(app)
apps.find{ |a| a.name == app.name}
end
- xit "rails test console", :slow => true, :p1 => true do
+ xit "rails test console" do
app = cfoundry_app(create_push_app("rails_console_test_app", nil, nil, [POSTGRESQL_MANIFEST]))
@console = init_console(@client, app)
@@ -34,7 +34,7 @@ def cfoundry_app(app)
match.should == true
end
- xit "rails test console stdout redirect", :slow => true do
+ xit "rails test console stdout redirect" do
app = cfoundry_app(create_push_app("rails_console_test_app", nil, nil, [POSTGRESQL_MANIFEST]))
@console = init_console(@client, app)
@@ -43,7 +43,7 @@ def cfoundry_app(app)
response.should == expect
end
- xit "rails test console rake task", :slow => true do
+ xit "rails test console rake task" do
app = cfoundry_app(create_push_app("rails_console_test_app", nil, nil, [POSTGRESQL_MANIFEST]))
@console = init_console(@client, app)
@@ -55,7 +55,7 @@ def cfoundry_app(app)
match.should == true
end
- xit "Rails Console runs tasks with correct ruby version in path", :slow => true do
+ xit "Rails Console runs tasks with correct ruby version in path" do
app = cfoundry_app(create_push_app("rails_console_test_app", nil, nil, [POSTGRESQL_MANIFEST]))
@console = init_console(@client, app)
@@ -68,7 +68,7 @@ def cfoundry_app(app)
end
- xit "rails test console MySQL connection", :slow => true, :mysql=>true do
+ xit "rails test console MySQL connection" do
app = cfoundry_app(create_push_app("rails_console_19_test_app", nil, nil, [MYSQL_MANIFEST]))
@console = init_console(@client, app)
@@ -98,7 +98,7 @@ def cfoundry_app(app)
end
- xit "rails test console Postgres connection", :slow => true, :postgresql=>true do
+ xit "rails test console Postgres connection" do
app = cfoundry_app(create_push_app("rails_console_19_test_app", nil, nil, [POSTGRESQL_MANIFEST]))
@console = init_console(@client, app)
View
5 spec/user/admin_user_spec.rb
@@ -13,8 +13,8 @@
test_user.delete
end
- it "test add-user/users/delete-user/passwd command", :admin => true,
- :p1 => true do
+ it "test add-user/users/delete-user/passwd command" do
+ pending "This test was disabled before. It is still using the old non-UAA workflow."
# create user
test_user = @admin_session.user(@test_email)
test_pwd = "test-pwd"
@@ -37,5 +37,4 @@
:passwd => new_passwd,
:target => @admin_session.TARGET)
end
-
end
View
4 spec/user/normal_user_spec.rb
@@ -8,13 +8,13 @@
@session.token.should_not be(nil), "cannot login target environment, #{@session.TARGET}"
end
- it "check JWT token", :p1 => true do
+ it "check JWT token" do
if @session.email.end_with?("@vmware.com") || @session.email.end_with?("@rbcon.com")
@session.token.auth_header.should match /(^bearer\s\S+[.]\S+[.]\S+$)/
end
end
- it "Reset user authentication token", :p1 => true do
+ it "Reset user authentication token" do
token = @session.token
#login again
test_session = BVT::Harness::CFSession.new
View
121 spec/user/uaa_spec.rb
@@ -4,120 +4,6 @@
require "restclient"
include BVT::Spec
-class UaaHelper
- include Singleton
-
- attr_writer :uaabase, :loginbase, :username, :password
-
- def initialize
- @admin_client = ENV['VCAP_BVT_ADMIN_CLIENT'] || "admin"
- @admin_secret = ENV['VCAP_BVT_ADMIN_SECRET'] || "adminsecret"
- puts "** Using admin client: '#{@admin_client}' (set environment variables" +
- " VCAP_BVT_ADMIN_CLIENT / VCAP_BVT_ADMIN_SECRET to override) **"
- @username = "dev@cloudfoundry.org"
- @password = "dev"
- end
-
- def webclient
-
- return @webclient if @webclient
-
- begin
- token = client_token(@admin_client, @admin_secret)
- rescue RestClient::Unauthorized
- #raise RuntimeError, "Unauthorized admin client (check your config or env vars)"
- end
- return nil unless token
-
- client_id = "testapp"
- begin
- client = get_client(client_id, token).clone
- client["client_id"].should_not == nil
- if client["scope"].nil? || client["scope"].empty? || client["scope"]==["uaa.none"] then
- client["scope"] = ["openid", "cloud_controller.read"]
- update_client(client, token)
- end
- @webclient = {:client_id=>client["client_id"]}
- rescue RestClient::ResourceNotFound
- @webclient = register_client({:client_id=>client_id,
- :client_secret=>"appsecret", :authorized_grant_types=>
- ["authorization_code"], :scope=>["openid", "cloud_controller.read"]}, token)
- rescue RestClient::Unauthorized
- raise RuntimeError, "Unauthorized admin client not able to create new client"
- end
-
- @webclient
-
- end
-
- def client_token(client_id, client_secret)
- url = @loginbase + "/oauth/token"
- response = RestClient.post url, {:client_id=>client_id,
- :grant_type=>"client_credentials"}, {"Accept"=>"application/json",
- "Authorization"=>basic_auth(client_id, client_secret)}
- response.should_not == nil
- response.code.should == 200
- JSON.parse(response.body)["access_token"]
- end
-
- def login
- url = @loginbase + "/login.do"
- response = RestClient.post url, {:username=>@username, :password=>@password},
- {"Accept"=>"application/json"} { |response, request, result| response }
- response.should_not == nil
- response.code.should == 302
- response.headers
- end
-
- def get_client(client_id, token)
- url = @uaabase + "/oauth/clients/#{client_id}"
- response = RestClient.get url, {"Authorization"=>
- "Bearer #{token}", "Accept"=>"application/json"}
- JSON.parse(response.body)
- end
-
- def register_client(client, token)
- url = @uaabase + "/oauth/clients"
- response = RestClient.post url, client.to_json, {"Authorization"=>
- "Bearer #{token}", "Content-Type"=>"application/json"}
- response.should_not == nil
- (response.code/100).should == 2
- client
- end
-
- def update_client(client, token)
- url = @uaabase + "/oauth/clients/" + client["client_id"]
- response = RestClient.put url, client.to_json, {"Authorization"=>"Bearer #{token}", "Content-Type"=>"application/json"}
- (response.code/100).should == 2
- client
- end
-
- def basic_auth(id, secret)
- "Basic " + Base64::strict_encode64("#{id}:#{secret}")
- end
-
- def get_url(path,headers={})
- url = @loginbase + path
- headers[:accept] = "application/json"
- response = RestClient.get url, headers
- response.should_not == nil
- response.code.should == 200
- response.body.should_not == nil
- response.body
- end
-
- def get_status(path)
- url = @uaabase + path
- begin
- response = RestClient.get url, {"Accept"=>"application/json"}
- response.code
- rescue RestClient::Exception => e
- e.http_code
- end
- end
-
-end
-
describe "User::UAA" do
before(:all) do
@@ -134,8 +20,7 @@ def get_status(path)
@uaahelper.password = @session.passwd
end
- it "get approval prompts and the content should contain correct paths",
- :p1 => true do
+ it "get approval prompts and the content should contain correct paths" do
headers = @uaahelper.login
@webclient = @uaahelper.webclient
pending("Unauthorized admin client, please set VCAP_BVT_ADMIN_CLIENT/VCAP_BVT_ADMIN_SECRET" +
@@ -148,13 +33,13 @@ def get_status(path)
@approval["options"].should_not == nil
end
- it "get login prompts and the content should contain prompts", :p1 => true do
+ it "get login prompts and the content should contain prompts" do
headers = @uaahelper.login
@prompts = @uaahelper.get_url "/login"
@prompts.should =~ /prompts/
end
- it "get Users data and the response should be UNAUTHORIZED", :p1 => true do
+ it "get Users data and the response should be UNAUTHORIZED" do
@code = @uaahelper.get_status "/Users"
@code.should == 401
end
View
BIN  vendor/cache/cf-uaac-1.3.3.gem
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.