You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/07/19 15:02:35 UTC
[PATCH core 02/16] Core: Removed all Cucumber and deprecated tests from server/Rakefile
From: Michal Fojtik <mf...@redhat.com>
The server/Rakefile now hold just one Rake task for executing tests
named 'test'. So executing 'rake test' should make all server API
tests run.
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
server/Rakefile | 124 +------------------------------------------------------
1 file changed, 2 insertions(+), 122 deletions(-)
diff --git a/server/Rakefile b/server/Rakefile
index ded7d8b..12b54f5 100644
--- a/server/Rakefile
+++ b/server/Rakefile
@@ -20,89 +20,11 @@
require 'rake'
require 'rake/testtask'
require 'rubygems/package_task'
-require 'rspec/core/rake_task'
-
-begin
- require 'ci/reporter/rake/test_unit'
-rescue LoadError
-end
$top_srcdir = File.dirname(__FILE__)
$:.unshift File.join($top_srcdir, 'lib')
begin
- require 'cucumber'
- require 'cucumber/rake/task'
- namespace :cucumber do
- %w(mock ec2 sbc).each do |driver|
- namespace driver do
- Cucumber::Rake::Task.new(:test) do |t|
- t.cucumber_opts = "../tests/#{driver} --format pretty"
- t.rcov = false
- end
- Cucumber::Rake::Task.new(:features) do |t|
- t.cucumber_opts = "../tests/#{driver} --format html --out ../tests/tmp/cucumber_#{driver}.html"
- t.rcov = false
- end
- Cucumber::Rake::Task.new(:junit) do |t|
- t.cucumber_opts = "../tests/#{driver} --format junit --out #{File.join(File.dirname(__FILE__), "tmp", "junit_#{driver}")}"
- end
- end
- end
- end
- Cucumber::Rake::Task.new(:cimi) do |t|
- t.cucumber_opts = "tests/cimi/features --format pretty"
- t.rcov = false
- end
- namespace :cimi do
- Cucumber::Rake::Task.new(:machines) do |t|
- t.cucumber_opts = "tests/cimi/features/machines.feature --format pretty"
- t.rcov = false
- end
- Cucumber::Rake::Task.new(:machine_images) do |t|
- t.cucumber_opts = "tests/cimi/features/machine_images.feature --format pretty"
- t.rcov = false
- end
- Cucumber::Rake::Task.new(:volumes) do |t|
- t.cucumber_opts = "tests/cimi/features/volumes.feature --format pretty"
- t.rcov = false
- end
- end
-rescue LoadError
-end
-
-
-desc "Call our Test::Unit suite"
-task :test do
- %w(mock rackspace rhevm openstack google fgcp).each do |driver|
- Rake::Task["test:#{driver}"].reenable
- Rake::Task["test:#{driver}"].invoke
- end
-end
-
-desc "Call our Cucumber suite"
-task :cucumber do
- %w(mock ec2 sbc).each do |driver|
- Rake::Task["cucumber:#{driver}:test"].reenable
- Rake::Task["cucumber:#{driver}:test"].invoke
- end
-end
-
-RSpec::Core::RakeTask.new do |t|
- t.pattern = FileList['spec/**/*_spec.rb']
- t.rspec_opts = [ "--format", "nested", "--color", "-r ./spec/spec_helper.rb"]
-end
-
-Dir['spec/**/*_spec.rb'].each do |file|
- RSpec::Core::RakeTask.new("spec:#{File.basename(file).gsub(/_spec\.rb$/, '')}") do |t|
- t.pattern = FileList[file]
- t.rspec_opts = [ "--format", "nested", "--color", "-r ./spec/spec_helper.rb"]
- end
-end
-
-
-
-begin
require 'yard'
YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb', '*.rb'] # optional
@@ -116,25 +38,6 @@ Gem::PackageTask.new(spec) do |pkg|
pkg.need_tar = true
end
-namespace :routes do
- desc "List all REST routes for the Deltacloud API"
- task :api do
- require 'deltacloud/server.rb'
- Sinatra::Rabbit::routes.each do |m, path|
- puts sprintf("\033[1;30m%-8s\033[0m %s", m.to_s.upcase, path)
- end
- end
-
- desc "List all REST routes for the CIMI API"
- task :cimi do
- require 'cimi/server.rb'
- Sinatra::Rabbit::routes.each do |m, path|
- puts sprintf("\033[1;30m%-8s\033[0m %s", m.to_s.upcase, path)
- end
- end
-end
-
-
namespace :mock do
namespace :fixtures do
desc "Setup Mock driver fixtures"
@@ -174,21 +77,6 @@ namespace :mock do
end
end
-namespace :openshift do
-
- desc "Deploy Deltacloud API to OpenShift"
- task :deploy do
- print "RHN or OpenShift login with OpenShift Express access: "
- STDOUT.flush
- login = STDIN.gets.chomp
- print "Password: "
- system "stty -echo"
- password = STDIN.gets.chomp
- system "stty echo"
- puts `rhc-create-app --rhlogin #{login} --app deltacloudtest --password '#{password}' --type ruby-1.8`
- end
-end
-
namespace :rabbit do
load File.join(File.dirname(__FILE__), 'config.ru')
@@ -224,14 +112,6 @@ namespace :rabbit do
end
-namespace :test do
-
- %w(mock rackspace rhevm openstack google fgcp ec2).each do |driver|
- desc "Run #{driver} unit tests"
- Rake::TestTask.new(driver) { |t|
- t.test_files = FileList.new("tests/drivers/#{driver}/*_test.rb")
- t.verbose = true
- t.warning = false
- }
- end
+Rake::TestTask.new do |t|
+ t.test_files = FileList['tests/helpers/**/*test.rb', 'tests/drivers/base/*test.rb', 'tests/drivers/models/*test.rb']
end
--
1.7.10.2
Re: [PATCH core 02/16] Core: Removed all Cucumber and deprecated tests from server/Rakefile
Posted by Michal Fojtik <mf...@redhat.com>.
Hi Dies,
Sorry for the late reply. Currently the major change we did is that
we are not longer using 'rack-test' to exercise driver methods, but
instead we are calling them directly through Deltacloud::Library code.
If you look into current GIT inside 'tests/drivers/ec2' I dropped there
few examples how to call the driver methods directly:
This code will setup the @driver and VCR:
before do
@driver = Deltacloud::new(:ec2, :user => 'AKIAIZ63KHGXIWDMBY6Q', :password => 'zUfBCbML2S6pXKS44eEEXw0Cf/G8z9hMSxP2hcLV')
VCR.insert_cassette __name__
end
after do
VCR.eject_cassette
end
Then in test:
it 'must return list of images' do
@driver.images.wont_be_empty
@driver.images.first.must_be_kind_of Image
end
Hope it helps, if you have any questions just catch me on IRC.
-- Michal
---
Michal Fojtik, Sr. Soft. Engineer
Deltacloud API / CloudForms
mfojtik@redhat.com
On Jul 20, 2012, at 1:40 AM, Koper, Dies wrote:
> Hi Michal,
>
> Looking at just this patch it seems it used to run selected driver unit
> tests and now not anymore.
> I'm close to contributing a set of (new) fgcp driver tests. Do I need to
> make any changes anywhere to ensure they get called when anyone runs
> rake test?
>
> Also, in relation to patch 08/16, my tests use VCR, do I need to declare
> that dependency in some gemfile?
>
> Cheers,
> Dies Koper
>
>
>> -----Original Message-----
>> From: mfojtik@redhat.com [mailto:mfojtik@redhat.com]
>> Sent: Thursday, 19 July 2012 11:03 PM
>> To: dev@deltacloud.apache.org
>> Subject: [PATCH core 02/16] Core: Removed all Cucumber and deprecated
>> tests from server/Rakefile
>>
>> From: Michal Fojtik <mf...@redhat.com>
>>
>> The server/Rakefile now hold just one Rake task for executing tests
>> named 'test'. So executing 'rake test' should make all server API
>> tests run.
>>
>> Signed-off-by: Michal fojtik <mf...@redhat.com>
>> ---
>> server/Rakefile | 124
> +------------------------------------------------------
>> 1 file changed, 2 insertions(+), 122 deletions(-)
>>
>> diff --git a/server/Rakefile b/server/Rakefile
>> index ded7d8b..12b54f5 100644
>> --- a/server/Rakefile
>> +++ b/server/Rakefile
>> @@ -20,89 +20,11 @@
>> require 'rake'
>> require 'rake/testtask'
>> require 'rubygems/package_task'
>> -require 'rspec/core/rake_task'
>> -
>> -begin
>> - require 'ci/reporter/rake/test_unit'
>> -rescue LoadError
>> -end
>>
>> $top_srcdir = File.dirname(__FILE__)
>> $:.unshift File.join($top_srcdir, 'lib')
>>
>> begin
>> - require 'cucumber'
>> - require 'cucumber/rake/task'
>> - namespace :cucumber do
>> - %w(mock ec2 sbc).each do |driver|
>> - namespace driver do
>> - Cucumber::Rake::Task.new(:test) do |t|
>> - t.cucumber_opts = "../tests/#{driver} --format pretty"
>> - t.rcov = false
>> - end
>> - Cucumber::Rake::Task.new(:features) do |t|
>> - t.cucumber_opts = "../tests/#{driver} --format html --
>> out ../tests/tmp/cucumber_#{driver}.html"
>> - t.rcov = false
>> - end
>> - Cucumber::Rake::Task.new(:junit) do |t|
>> - t.cucumber_opts = "../tests/#{driver} --format junit --out
>> #{File.join(File.dirname(__FILE__), "tmp", "junit_#{driver}")}"
>> - end
>> - end
>> - end
>> - end
>> - Cucumber::Rake::Task.new(:cimi) do |t|
>> - t.cucumber_opts = "tests/cimi/features --format pretty"
>> - t.rcov = false
>> - end
>> - namespace :cimi do
>> - Cucumber::Rake::Task.new(:machines) do |t|
>> - t.cucumber_opts = "tests/cimi/features/machines.feature
> --format
>> pretty"
>> - t.rcov = false
>> - end
>> - Cucumber::Rake::Task.new(:machine_images) do |t|
>> - t.cucumber_opts = "tests/cimi/features/machine_images.feature
> --
>> format pretty"
>> - t.rcov = false
>> - end
>> - Cucumber::Rake::Task.new(:volumes) do |t|
>> - t.cucumber_opts = "tests/cimi/features/volumes.feature --format
>> pretty"
>> - t.rcov = false
>> - end
>> - end
>> -rescue LoadError
>> -end
>> -
>> -
>> -desc "Call our Test::Unit suite"
>> -task :test do
>> - %w(mock rackspace rhevm openstack google fgcp).each do |driver|
>> - Rake::Task["test:#{driver}"].reenable
>> - Rake::Task["test:#{driver}"].invoke
>> - end
>> -end
>> -
>> -desc "Call our Cucumber suite"
>> -task :cucumber do
>> - %w(mock ec2 sbc).each do |driver|
>> - Rake::Task["cucumber:#{driver}:test"].reenable
>> - Rake::Task["cucumber:#{driver}:test"].invoke
>> - end
>> -end
>> -
>> -RSpec::Core::RakeTask.new do |t|
>> - t.pattern = FileList['spec/**/*_spec.rb']
>> - t.rspec_opts = [ "--format", "nested", "--color", "-r
> ./spec/spec_helper.rb"]
>> -end
>> -
>> -Dir['spec/**/*_spec.rb'].each do |file|
>> -
> RSpec::Core::RakeTask.new("spec:#{File.basename(file).gsub(/_spec\.rb$/,
>> '')}") do |t|
>> - t.pattern = FileList[file]
>> - t.rspec_opts = [ "--format", "nested", "--color", "-
>> r ./spec/spec_helper.rb"]
>> - end
>> -end
>> -
>> -
>> -
>> -begin
>> require 'yard'
>> YARD::Rake::YardocTask.new do |t|
>> t.files = ['lib/**/*.rb', '*.rb'] # optional
>> @@ -116,25 +38,6 @@ Gem::PackageTask.new(spec) do |pkg|
>> pkg.need_tar = true
>> end
>>
>> -namespace :routes do
>> - desc "List all REST routes for the Deltacloud API"
>> - task :api do
>> - require 'deltacloud/server.rb'
>> - Sinatra::Rabbit::routes.each do |m, path|
>> - puts sprintf("\033[1;30m%-8s\033[0m %s", m.to_s.upcase, path)
>> - end
>> - end
>> -
>> - desc "List all REST routes for the CIMI API"
>> - task :cimi do
>> - require 'cimi/server.rb'
>> - Sinatra::Rabbit::routes.each do |m, path|
>> - puts sprintf("\033[1;30m%-8s\033[0m %s", m.to_s.upcase, path)
>> - end
>> - end
>> -end
>> -
>> -
>> namespace :mock do
>> namespace :fixtures do
>> desc "Setup Mock driver fixtures"
>> @@ -174,21 +77,6 @@ namespace :mock do
>> end
>> end
>>
>> -namespace :openshift do
>> -
>> - desc "Deploy Deltacloud API to OpenShift"
>> - task :deploy do
>> - print "RHN or OpenShift login with OpenShift Express access: "
>> - STDOUT.flush
>> - login = STDIN.gets.chomp
>> - print "Password: "
>> - system "stty -echo"
>> - password = STDIN.gets.chomp
>> - system "stty echo"
>> - puts `rhc-create-app --rhlogin #{login} --app deltacloudtest
> --password
>> '#{password}' --type ruby-1.8`
>> - end
>> -end
>> -
>> namespace :rabbit do
>> load File.join(File.dirname(__FILE__), 'config.ru')
>>
>> @@ -224,14 +112,6 @@ namespace :rabbit do
>>
>> end
>>
>> -namespace :test do
>> -
>> - %w(mock rackspace rhevm openstack google fgcp ec2).each do |driver|
>> - desc "Run #{driver} unit tests"
>> - Rake::TestTask.new(driver) { |t|
>> - t.test_files =
> FileList.new("tests/drivers/#{driver}/*_test.rb")
>> - t.verbose = true
>> - t.warning = false
>> - }
>> - end
>> +Rake::TestTask.new do |t|
>> + t.test_files = FileList['tests/helpers/**/*test.rb',
>> 'tests/drivers/base/*test.rb', 'tests/drivers/models/*test.rb']
>> end
>> --
>> 1.7.10.2
>>
>
>
RE: [PATCH core 02/16] Core: Removed all Cucumber and deprecated tests from server/Rakefile
Posted by "Koper, Dies" <di...@fast.au.fujitsu.com>.
Hi Michal,
Looking at just this patch it seems it used to run selected driver unit
tests and now not anymore.
I'm close to contributing a set of (new) fgcp driver tests. Do I need to
make any changes anywhere to ensure they get called when anyone runs
rake test?
Also, in relation to patch 08/16, my tests use VCR, do I need to declare
that dependency in some gemfile?
Cheers,
Dies Koper
> -----Original Message-----
> From: mfojtik@redhat.com [mailto:mfojtik@redhat.com]
> Sent: Thursday, 19 July 2012 11:03 PM
> To: dev@deltacloud.apache.org
> Subject: [PATCH core 02/16] Core: Removed all Cucumber and deprecated
> tests from server/Rakefile
>
> From: Michal Fojtik <mf...@redhat.com>
>
> The server/Rakefile now hold just one Rake task for executing tests
> named 'test'. So executing 'rake test' should make all server API
> tests run.
>
> Signed-off-by: Michal fojtik <mf...@redhat.com>
> ---
> server/Rakefile | 124
+------------------------------------------------------
> 1 file changed, 2 insertions(+), 122 deletions(-)
>
> diff --git a/server/Rakefile b/server/Rakefile
> index ded7d8b..12b54f5 100644
> --- a/server/Rakefile
> +++ b/server/Rakefile
> @@ -20,89 +20,11 @@
> require 'rake'
> require 'rake/testtask'
> require 'rubygems/package_task'
> -require 'rspec/core/rake_task'
> -
> -begin
> - require 'ci/reporter/rake/test_unit'
> -rescue LoadError
> -end
>
> $top_srcdir = File.dirname(__FILE__)
> $:.unshift File.join($top_srcdir, 'lib')
>
> begin
> - require 'cucumber'
> - require 'cucumber/rake/task'
> - namespace :cucumber do
> - %w(mock ec2 sbc).each do |driver|
> - namespace driver do
> - Cucumber::Rake::Task.new(:test) do |t|
> - t.cucumber_opts = "../tests/#{driver} --format pretty"
> - t.rcov = false
> - end
> - Cucumber::Rake::Task.new(:features) do |t|
> - t.cucumber_opts = "../tests/#{driver} --format html --
> out ../tests/tmp/cucumber_#{driver}.html"
> - t.rcov = false
> - end
> - Cucumber::Rake::Task.new(:junit) do |t|
> - t.cucumber_opts = "../tests/#{driver} --format junit --out
> #{File.join(File.dirname(__FILE__), "tmp", "junit_#{driver}")}"
> - end
> - end
> - end
> - end
> - Cucumber::Rake::Task.new(:cimi) do |t|
> - t.cucumber_opts = "tests/cimi/features --format pretty"
> - t.rcov = false
> - end
> - namespace :cimi do
> - Cucumber::Rake::Task.new(:machines) do |t|
> - t.cucumber_opts = "tests/cimi/features/machines.feature
--format
> pretty"
> - t.rcov = false
> - end
> - Cucumber::Rake::Task.new(:machine_images) do |t|
> - t.cucumber_opts = "tests/cimi/features/machine_images.feature
--
> format pretty"
> - t.rcov = false
> - end
> - Cucumber::Rake::Task.new(:volumes) do |t|
> - t.cucumber_opts = "tests/cimi/features/volumes.feature --format
> pretty"
> - t.rcov = false
> - end
> - end
> -rescue LoadError
> -end
> -
> -
> -desc "Call our Test::Unit suite"
> -task :test do
> - %w(mock rackspace rhevm openstack google fgcp).each do |driver|
> - Rake::Task["test:#{driver}"].reenable
> - Rake::Task["test:#{driver}"].invoke
> - end
> -end
> -
> -desc "Call our Cucumber suite"
> -task :cucumber do
> - %w(mock ec2 sbc).each do |driver|
> - Rake::Task["cucumber:#{driver}:test"].reenable
> - Rake::Task["cucumber:#{driver}:test"].invoke
> - end
> -end
> -
> -RSpec::Core::RakeTask.new do |t|
> - t.pattern = FileList['spec/**/*_spec.rb']
> - t.rspec_opts = [ "--format", "nested", "--color", "-r
./spec/spec_helper.rb"]
> -end
> -
> -Dir['spec/**/*_spec.rb'].each do |file|
> -
RSpec::Core::RakeTask.new("spec:#{File.basename(file).gsub(/_spec\.rb$/,
> '')}") do |t|
> - t.pattern = FileList[file]
> - t.rspec_opts = [ "--format", "nested", "--color", "-
> r ./spec/spec_helper.rb"]
> - end
> -end
> -
> -
> -
> -begin
> require 'yard'
> YARD::Rake::YardocTask.new do |t|
> t.files = ['lib/**/*.rb', '*.rb'] # optional
> @@ -116,25 +38,6 @@ Gem::PackageTask.new(spec) do |pkg|
> pkg.need_tar = true
> end
>
> -namespace :routes do
> - desc "List all REST routes for the Deltacloud API"
> - task :api do
> - require 'deltacloud/server.rb'
> - Sinatra::Rabbit::routes.each do |m, path|
> - puts sprintf("\033[1;30m%-8s\033[0m %s", m.to_s.upcase, path)
> - end
> - end
> -
> - desc "List all REST routes for the CIMI API"
> - task :cimi do
> - require 'cimi/server.rb'
> - Sinatra::Rabbit::routes.each do |m, path|
> - puts sprintf("\033[1;30m%-8s\033[0m %s", m.to_s.upcase, path)
> - end
> - end
> -end
> -
> -
> namespace :mock do
> namespace :fixtures do
> desc "Setup Mock driver fixtures"
> @@ -174,21 +77,6 @@ namespace :mock do
> end
> end
>
> -namespace :openshift do
> -
> - desc "Deploy Deltacloud API to OpenShift"
> - task :deploy do
> - print "RHN or OpenShift login with OpenShift Express access: "
> - STDOUT.flush
> - login = STDIN.gets.chomp
> - print "Password: "
> - system "stty -echo"
> - password = STDIN.gets.chomp
> - system "stty echo"
> - puts `rhc-create-app --rhlogin #{login} --app deltacloudtest
--password
> '#{password}' --type ruby-1.8`
> - end
> -end
> -
> namespace :rabbit do
> load File.join(File.dirname(__FILE__), 'config.ru')
>
> @@ -224,14 +112,6 @@ namespace :rabbit do
>
> end
>
> -namespace :test do
> -
> - %w(mock rackspace rhevm openstack google fgcp ec2).each do |driver|
> - desc "Run #{driver} unit tests"
> - Rake::TestTask.new(driver) { |t|
> - t.test_files =
FileList.new("tests/drivers/#{driver}/*_test.rb")
> - t.verbose = true
> - t.warning = false
> - }
> - end
> +Rake::TestTask.new do |t|
> + t.test_files = FileList['tests/helpers/**/*test.rb',
> 'tests/drivers/base/*test.rb', 'tests/drivers/models/*test.rb']
> end
> --
> 1.7.10.2
>