Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Restructure YETIs, remove all tags [#46161019]
Browse files Browse the repository at this point in the history
  • Loading branch information
Bleicke and Tim Labeeuw committed Mar 22, 2013
1 parent 8bafb08 commit f8abe5b
Show file tree
Hide file tree
Showing 37 changed files with 207 additions and 319 deletions.
4 changes: 0 additions & 4 deletions Gemfile
Expand Up @@ -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"
Expand Down
30 changes: 5 additions & 25 deletions Gemfile.lock
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions README.md
Expand Up @@ -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)
Expand Down
101 changes: 12 additions & 89 deletions Rakefile
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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]
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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'
Expand All @@ -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)
Expand Down Expand Up @@ -241,4 +165,3 @@ def longevity(threads, filter, rerun=false)
exit(0)
end
end

2 changes: 1 addition & 1 deletion config/assets.yml
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/harness/app.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/harness/cfsession.rb
Expand Up @@ -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 = []
Expand Down Expand Up @@ -362,4 +362,4 @@ def is_user_admin?(email, passwd)
end
end
end
end
end
8 changes: 6 additions & 2 deletions lib/harness/logger_helper.rb
@@ -1,4 +1,3 @@

module BVT::Harness
module LoggerHelper
attr_reader :logfile
Expand All @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions lib/harness/rake_helper.rb
Expand Up @@ -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)
Expand Down
41 changes: 17 additions & 24 deletions lib/harness/user.rb
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit f8abe5b

Please sign in to comment.