You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2010/07/09 01:47:27 UTC
svn commit: r962336 [1/5] - in /incubator/deltacloud/trunk: server/
server/features/ server/features/step_definitions/ server/features/support/
server/lib/ server/lib/deltacloud/ server/lib/deltacloud/base_driver/
server/lib/deltacloud/drivers/ec2/ tes...
Author: lutter
Date: Thu Jul 8 23:47:25 2010
New Revision: 962336
URL: http://svn.apache.org/viewvc?rev=962336&view=rev
Log:
Added new mock base driver
Moved tests to separate directory
Added:
incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/mock_driver.rb
incubator/deltacloud/trunk/server/lib/deltacloud/method_serializer.rb
incubator/deltacloud/trunk/tests/
incubator/deltacloud/trunk/tests/Rakefile
incubator/deltacloud/trunk/tests/ec2/
incubator/deltacloud/trunk/tests/ec2/99_rake.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/99_rake.feature
incubator/deltacloud/trunk/tests/ec2/api.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/api.feature
incubator/deltacloud/trunk/tests/ec2/hardware_profiles.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/hardware_profiles.feature
incubator/deltacloud/trunk/tests/ec2/images.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/images.feature
incubator/deltacloud/trunk/tests/ec2/instance_states.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/instance_states.feature
incubator/deltacloud/trunk/tests/ec2/instances.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/instances.feature
incubator/deltacloud/trunk/tests/ec2/realms.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/realms.feature
incubator/deltacloud/trunk/tests/ec2/step_definitions/
incubator/deltacloud/trunk/tests/ec2/step_definitions/api_steps.rb
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/step_definitions/api_steps.rb
incubator/deltacloud/trunk/tests/ec2/step_definitions/hardware_profiles_steps.rb
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/step_definitions/hardware_profiles_steps.rb
incubator/deltacloud/trunk/tests/ec2/step_definitions/images_steps.rb
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/step_definitions/images_steps.rb
incubator/deltacloud/trunk/tests/ec2/step_definitions/instance_states_steps.rb
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/step_definitions/instance_states_steps.rb
incubator/deltacloud/trunk/tests/ec2/step_definitions/instances_steps.rb
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/step_definitions/instances_steps.rb
incubator/deltacloud/trunk/tests/ec2/step_definitions/rake_steps.rb
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/step_definitions/rake_steps.rb
incubator/deltacloud/trunk/tests/ec2/support/
incubator/deltacloud/trunk/tests/ec2/support/ec2/
incubator/deltacloud/trunk/tests/ec2/support/ec2/create-hwp_describe_images.1d05fa88d294d07beed14334421b46d322385188
incubator/deltacloud/trunk/tests/ec2/support/ec2/create-hwp_describe_images.45eee35ec8f8243c05d85cf5486c54368be8207e
incubator/deltacloud/trunk/tests/ec2/support/ec2/create-hwp_describe_instances.da39a3ee5e6b4b0d3255bfef95601890afd80709
incubator/deltacloud/trunk/tests/ec2/support/ec2/create-hwp_run_instances.698df7f7a613449c42d1bcea2ba275b2bc598db5
incubator/deltacloud/trunk/tests/ec2/support/ec2/create_describe_images.1d05fa88d294d07beed14334421b46d322385188
incubator/deltacloud/trunk/tests/ec2/support/ec2/create_describe_images.45eee35ec8f8243c05d85cf5486c54368be8207e
incubator/deltacloud/trunk/tests/ec2/support/ec2/create_describe_instances.da39a3ee5e6b4b0d3255bfef95601890afd80709
incubator/deltacloud/trunk/tests/ec2/support/ec2/create_run_instances.698df7f7a613449c42d1bcea2ba275b2bc598db5
incubator/deltacloud/trunk/tests/ec2/support/ec2/describe_availability_zones.da39a3ee5e6b4b0d3255bfef95601890afd80709
incubator/deltacloud/trunk/tests/ec2/support/ec2/describe_images.1d05fa88d294d07beed14334421b46d322385188
incubator/deltacloud/trunk/tests/ec2/support/ec2/describe_images.45eee35ec8f8243c05d85cf5486c54368be8207e
incubator/deltacloud/trunk/tests/ec2/support/ec2/describe_images.491d1c515d961d5875891b26586ece2a2994be84
incubator/deltacloud/trunk/tests/ec2/support/ec2/describe_instances.da39a3ee5e6b4b0d3255bfef95601890afd80709
incubator/deltacloud/trunk/tests/ec2/support/ec2/reboot_describe_instances.da39a3ee5e6b4b0d3255bfef95601890afd80709
incubator/deltacloud/trunk/tests/ec2/support/ec2/reboot_instances.8db15ec3f117ce8070a0550fd99ac76ce508ade5
incubator/deltacloud/trunk/tests/ec2/support/ec2/reboot_reboot_instances.af7d3d510feb715a04fd18e586088975e2ab5a9f
incubator/deltacloud/trunk/tests/ec2/support/ec2/run_instances.d42fd93b19e95a9b2eac3a1e16f1d82d5c242524
incubator/deltacloud/trunk/tests/ec2/support/ec2/start_describe_instances.da39a3ee5e6b4b0d3255bfef95601890afd80709
incubator/deltacloud/trunk/tests/ec2/support/ec2/stop_describe_instances.da39a3ee5e6b4b0d3255bfef95601890afd80709
incubator/deltacloud/trunk/tests/ec2/support/ec2/stop_terminate_instances.af7d3d510feb715a04fd18e586088975e2ab5a9f
incubator/deltacloud/trunk/tests/ec2/support/ec2/terminate_instances.8db15ec3f117ce8070a0550fd99ac76ce508ade5
incubator/deltacloud/trunk/tests/ec2/support/env.rb
incubator/deltacloud/trunk/tests/mock/
incubator/deltacloud/trunk/tests/mock/99_rake.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/99_rake.feature
incubator/deltacloud/trunk/tests/mock/api.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/api.feature
incubator/deltacloud/trunk/tests/mock/hardware_profiles.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/hardware_profiles.feature
incubator/deltacloud/trunk/tests/mock/images.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/images.feature
incubator/deltacloud/trunk/tests/mock/instance_states.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/instance_states.feature
incubator/deltacloud/trunk/tests/mock/instances.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/instances.feature
incubator/deltacloud/trunk/tests/mock/realms.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/realms.feature
incubator/deltacloud/trunk/tests/mock/step_definitions/
incubator/deltacloud/trunk/tests/mock/step_definitions/api_steps.rb
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/step_definitions/api_steps.rb
incubator/deltacloud/trunk/tests/mock/step_definitions/hardware_profiles_steps.rb
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/step_definitions/hardware_profiles_steps.rb
incubator/deltacloud/trunk/tests/mock/step_definitions/images_steps.rb
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/step_definitions/images_steps.rb
incubator/deltacloud/trunk/tests/mock/step_definitions/instance_states_steps.rb
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/step_definitions/instance_states_steps.rb
incubator/deltacloud/trunk/tests/mock/step_definitions/instances_steps.rb
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/step_definitions/instances_steps.rb
incubator/deltacloud/trunk/tests/mock/step_definitions/rake_steps.rb
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/step_definitions/rake_steps.rb
incubator/deltacloud/trunk/tests/mock/storage_snapshots.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/storage_snapshots.feature
incubator/deltacloud/trunk/tests/mock/storage_volumes.feature
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/storage_volumes.feature
incubator/deltacloud/trunk/tests/mock/support/
incubator/deltacloud/trunk/tests/mock/support/env.rb
- copied, changed from r962335, incubator/deltacloud/trunk/server/features/support/env.rb
Removed:
incubator/deltacloud/trunk/server/features/99_rake.feature
incubator/deltacloud/trunk/server/features/api.feature
incubator/deltacloud/trunk/server/features/hardware_profiles.feature
incubator/deltacloud/trunk/server/features/images.feature
incubator/deltacloud/trunk/server/features/instance_states.feature
incubator/deltacloud/trunk/server/features/instances.feature
incubator/deltacloud/trunk/server/features/realms.feature
incubator/deltacloud/trunk/server/features/step_definitions/api_steps.rb
incubator/deltacloud/trunk/server/features/step_definitions/hardware_profiles_steps.rb
incubator/deltacloud/trunk/server/features/step_definitions/images_steps.rb
incubator/deltacloud/trunk/server/features/step_definitions/instance_states_steps.rb
incubator/deltacloud/trunk/server/features/step_definitions/instances_steps.rb
incubator/deltacloud/trunk/server/features/step_definitions/rake_steps.rb
incubator/deltacloud/trunk/server/features/storage_snapshots.feature
incubator/deltacloud/trunk/server/features/storage_volumes.feature
incubator/deltacloud/trunk/server/features/support/env.rb
Modified:
incubator/deltacloud/trunk/server/Rakefile
incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
incubator/deltacloud/trunk/server/lib/drivers.rb
Modified: incubator/deltacloud/trunk/server/Rakefile
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/Rakefile?rev=962336&r1=962335&r2=962336&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/Rakefile (original)
+++ incubator/deltacloud/trunk/server/Rakefile Thu Jul 8 23:47:25 2010
@@ -22,8 +22,6 @@ require 'rake'
require 'rake/testtask'
require 'rake/gempackagetask'
-
-
desc "Run basic unit tests"
Rake::TestTask.new("test") { |t|
t.test_files = FileList[
@@ -37,36 +35,8 @@ Rake::TestTask.new("test") { |t|
t.warning = false
}
-begin
- require 'cucumber'
- require 'cucumber/rake/task'
-
- Cucumber::Rake::Task.new(:features) do |t|
- t.cucumber_opts = "features --format html --out tmp/cucumber.html"
- t.rcov = false
- end
-
- Cucumber::Rake::Task.new(:rcov) do |t|
- t.cucumber_opts = "features --format pretty"
- t.rcov = true
- t.rcov_opts << %[-o "tmp/coverage"]
- end
-
- Cucumber::Rake::Task.new(:junit) do |t|
- t.cucumber_opts = "features --format junit --out tmp/junit"
- t.rcov = true
- t.rcov_opts << %[-o "tmp/coverage"]
- end
-
-rescue LoadError
- desc 'Cucumber rake task not available'
- task :features do
- abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem'
- end
-end
-
-
load 'deltacloud-core.gemspec'
+
Rake::GemPackageTask.new(@spec) do |pkg|
pkg.need_tar = true
end
Added: incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/mock_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/mock_driver.rb?rev=962336&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/mock_driver.rb (added)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/mock_driver.rb Thu Jul 8 23:47:25 2010
@@ -0,0 +1,37 @@
+require 'deltacloud/method_serializer'
+
+# Create 'mock' version of original driver client/gem:
+
+module Mock
+ class EC2 < AWS::EC2::Base
+
+ include MethodSerializer::Cache
+
+ def self.cached_methods
+ [
+ :describe_images,
+ :describe_availability_zones,
+ :run_instances,
+ :describe_instances,
+ :reboot_instances,
+ :terminate_instances
+ ]
+ end
+
+ MethodSerializer::Cache::wrap_methods(self, :cache_dir => File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'tests', 'ec2', 'support'))
+ end
+end
+
+
+# Replace original client with mock client
+Deltacloud::Drivers::EC2::EC2Driver.class_eval do
+ alias_method :original_new_client, :new_client
+
+ def new_client(credentials, opts={})
+ Mock::EC2.new(
+ :access_key_id => credentials.user,
+ :secret_access_key => credentials.password
+ )
+ end
+
+end
Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb?rev=962336&r1=962335&r2=962336&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb Thu Jul 8 23:47:25 2010
@@ -120,11 +120,11 @@ class EC2Driver < Deltacloud::BaseDriver
config = { :owner_id => "amazon" }
config.merge!({ :owner_id => opts[:owner_id] }) if opts and opts[:owner_id]
end
- safely do
+ #safely do
ec2.describe_images(config).imagesSet.item.each do |image|
img_arr << convert_image(image)
end
- end
+ #end
img_arr = filter_on( img_arr, :architecture, opts )
img_arr.sort_by{|e| [e.owner_id, e.name]}
end
@@ -150,7 +150,7 @@ class EC2Driver < Deltacloud::BaseDriver
def instances(credentials, opts=nil)
ec2 = new_client(credentials)
instances = []
- safely do
+ #safely do
param = opts.nil? ? nil : opts[:id]
ec2_instances = ec2.describe_instances.reservationSet
return [] unless ec2_instances
@@ -159,7 +159,7 @@ class EC2Driver < Deltacloud::BaseDriver
instances << convert_instance( ec2_instance, item.ownerId )
end
end
- end
+ #end
instances = filter_on( instances, :id, opts )
instances = filter_on( instances, :state, opts )
instances
@@ -330,7 +330,7 @@ class EC2Driver < Deltacloud::BaseDriver
rescue AWS::AuthFailure => e
raise Deltacloud::AuthException.new
rescue Exception => e
- puts "ERROR: #{e.message}"
+ puts "ERROR: #{e.message}\n#{e.backtrace.join("\n")}"
end
end
Added: incubator/deltacloud/trunk/server/lib/deltacloud/method_serializer.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/method_serializer.rb?rev=962336&view=auto
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/method_serializer.rb (added)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/method_serializer.rb Thu Jul 8 23:47:25 2010
@@ -0,0 +1,81 @@
+#
+# Copyright (C) 2009 Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+require 'base64'
+require 'digest'
+
+module MethodSerializer
+
+ module Cache
+
+ def cache_dir
+ storage_dir = $methods_cache_dir || File.join(File.dirname(__FILE__), 'cache')
+ class_dir = self.class.name.split('::').last
+ class_dir ||= self.class.name
+ File.join(storage_dir, class_dir.downcase)
+ end
+
+ def serialize_data(method_name, args, data)
+ File.open(cache_file_name(method_name, args), 'w') do |f|
+ f.puts(Base64.encode64(Marshal.dump(data)))
+ end
+ return data
+ end
+
+ def deserialize_data(method_name, args)
+ begin
+ data = File.readlines(cache_file_name(method_name, args)).join
+ Marshal.load(Base64.decode64(data))
+ rescue Errno::ENOENT
+ return false
+ end
+ end
+
+ def args_hash(args)
+ Digest::SHA1.hexdigest(args.to_s)
+ end
+
+ def cache_file_name(method_name, args)
+ FileUtils.mkdir_p(cache_dir) unless File.directory?(cache_dir)
+ method_name = $scenario_prefix ? "#{$scenario_prefix}_#{method_name}" : method_name
+ File.join(cache_dir, "#{method_name}.#{args_hash(args)}")
+ end
+
+ def self.wrap_methods(c, opts={})
+ $methods_cache_dir = opts[:cache_dir]
+ $scenario_prefix = nil
+ c.class_eval do
+ cached_methods.each do |m|
+ next if c.instance_methods(false).include?("original_#{m}")
+ alias_method "original_#{m}".to_sym, m.to_sym
+ define_method m.to_sym do |*args|
+ args = args.first if args.size.eql?(1) and not args.first.class.eql?(Array)
+ output = deserialize_data(m, args)
+ unless output
+ output = method("original_#{m}".to_sym).to_proc[args]
+ return serialize_data(m, args, output)
+ else
+ return output
+ end
+ end
+ end
+ end
+ end
+
+ end
+
+end
Modified: incubator/deltacloud/trunk/server/lib/drivers.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/drivers.rb?rev=962336&r1=962335&r2=962336&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/drivers.rb (original)
+++ incubator/deltacloud/trunk/server/lib/drivers.rb Thu Jul 8 23:47:25 2010
@@ -24,14 +24,14 @@ end
def driver_mock_source_name
return File.join('deltacloud', 'drivers', DRIVER.to_s, "#{DRIVER}_driver.rb") if driver_name.eql? 'Mock'
- File.join('deltacloud', 'drivers', DRIVER, "#{DRIVER}_mock_driver.rb")
end
def driver
require driver_source_name
+ #require 'deltacloud/base_driver/mock_driver.rb'
if Sinatra::Application.environment.eql? :test
- require driver_mock_source_name
+ require driver_mock_source_name if driver_mock_source_name
end
@driver ||= eval( driver_class_name ).new
Added: incubator/deltacloud/trunk/tests/Rakefile
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/Rakefile?rev=962336&view=auto
==============================================================================
--- incubator/deltacloud/trunk/tests/Rakefile (added)
+++ incubator/deltacloud/trunk/tests/Rakefile Thu Jul 8 23:47:25 2010
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2009 Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require 'rake'
+require 'cucumber'
+require 'cucumber/rake/task'
+
+DRIVER=ENV['API_DRIVER'] || 'mock'
+
+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(:cucumber) do |t|
+ t.cucumber_opts = "../tests/#{DRIVER} --format pretty"
+ t.rcov = false
+end
+
+Cucumber::Rake::Task.new(:rcov) do |t|
+ t.cucumber_opts = "../tests/#{DRIVER} --format pretty"
+ t.rcov = true
+ t.rcov_opts << %[-o "tmp/coverage_#{DRIVER}"]
+end
+
+Cucumber::Rake::Task.new(:junit) do |t|
+ t.cucumber_opts = "../tests/#{DRIVER} --format junit --out ../tests/tmp/junit_#{DRIVER}"
+end
Copied: incubator/deltacloud/trunk/tests/ec2/99_rake.feature (from r962335, incubator/deltacloud/trunk/server/features/99_rake.feature)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/99_rake.feature?p2=incubator/deltacloud/trunk/tests/ec2/99_rake.feature&p1=incubator/deltacloud/trunk/server/features/99_rake.feature&r1=962335&r2=962336&rev=962336&view=diff
==============================================================================
(empty)
Copied: incubator/deltacloud/trunk/tests/ec2/api.feature (from r962335, incubator/deltacloud/trunk/server/features/api.feature)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/api.feature?p2=incubator/deltacloud/trunk/tests/ec2/api.feature&p1=incubator/deltacloud/trunk/server/features/api.feature&r1=962335&r2=962336&rev=962336&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/features/api.feature (original)
+++ incubator/deltacloud/trunk/tests/ec2/api.feature Thu Jul 8 23:47:25 2010
@@ -5,7 +5,7 @@ Feature: Accessing API entry points
And authentification is not required for this URI
When client access this URI
Then client should get root element 'api'
- And this element should have attribute 'driver' with value 'mock'
+ And this element should have attribute 'driver' with value 'ec2'
And this element should have attribute 'version' with value '1.0'
Scenario: List of entry points
@@ -37,5 +37,5 @@ Feature: Accessing API entry points
And authentification is not required for this URI
When client access this URI
Then client should get list of features inside 'instances':
- | hardware_profiles |
- | user_name |
+ | authentication_key |
+ | user_data |
Copied: incubator/deltacloud/trunk/tests/ec2/hardware_profiles.feature (from r962335, incubator/deltacloud/trunk/server/features/hardware_profiles.feature)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/hardware_profiles.feature?p2=incubator/deltacloud/trunk/tests/ec2/hardware_profiles.feature&p1=incubator/deltacloud/trunk/server/features/hardware_profiles.feature&r1=962335&r2=962336&rev=962336&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/features/hardware_profiles.feature (original)
+++ incubator/deltacloud/trunk/tests/ec2/hardware_profiles.feature Thu Jul 8 23:47:25 2010
@@ -12,12 +12,12 @@ Feature: Accessing hardware profiles
And authentification is not required for this URI
When client access this URI
Then client should get root element 'hardware-profiles'
- When client want to show 'm1-large' hardware-profile
+ When client want to show 'm1.small' hardware-profile
And client should get this hardware-profile
And it should have a href attribute
And it should have a fixed property 'cpu'
- And it should have a range property 'memory'
- And it should have a enum property 'storage'
+ And it should have a fixed property 'memory'
+ And it should have a fixed property 'storage'
And this URI should be available in XML, HTML, JSON format
Scenario: Filtering images by architecture
Copied: incubator/deltacloud/trunk/tests/ec2/images.feature (from r962335, incubator/deltacloud/trunk/server/features/images.feature)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/images.feature?p2=incubator/deltacloud/trunk/tests/ec2/images.feature&p1=incubator/deltacloud/trunk/server/features/images.feature&r1=962335&r2=962336&rev=962336&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/features/images.feature (original)
+++ incubator/deltacloud/trunk/tests/ec2/images.feature Thu Jul 8 23:47:25 2010
@@ -36,9 +36,9 @@ Feature: Listing and showing images
Given URI /api/images exists
And authentification is required for this URI
When client access this URI with parameters:
- | owner_id | fedoraproject |
+ | owner_id | 205605819716 |
Then client should get some images
- And each image should have 'owner_id' attribute set to 'fedoraproject'
+ And each image should have 'owner_id' attribute set to '205605819716'
Scenario: Filtering images by architecture
Given URI /api/images exists
@@ -53,7 +53,7 @@ Feature: Listing and showing images
And authentification is required for this URI
When client access this URI with parameters:
| architecture | i386 |
- | owner_id | fedoraproject |
+ | owner_id | 205605819716 |
Then client should get some images
And each image should have 'architecture' attribute set to 'i386'
- And each image should have 'owner_id' attribute set to 'fedoraproject'
+ And each image should have 'owner_id' attribute set to '205605819716'
Copied: incubator/deltacloud/trunk/tests/ec2/instance_states.feature (from r962335, incubator/deltacloud/trunk/server/features/instance_states.feature)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/instance_states.feature?p2=incubator/deltacloud/trunk/tests/ec2/instance_states.feature&p1=incubator/deltacloud/trunk/server/features/instance_states.feature&r1=962335&r2=962336&rev=962336&view=diff
==============================================================================
(empty)
Copied: incubator/deltacloud/trunk/tests/ec2/instances.feature (from r962335, incubator/deltacloud/trunk/server/features/instances.feature)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/instances.feature?p2=incubator/deltacloud/trunk/tests/ec2/instances.feature&p1=incubator/deltacloud/trunk/server/features/instances.feature&r1=962335&r2=962336&rev=962336&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/features/instances.feature (original)
+++ incubator/deltacloud/trunk/tests/ec2/instances.feature Thu Jul 8 23:47:25 2010
@@ -48,6 +48,7 @@ Feature: Managing instances
| actions |
| public-addresses |
| private-addresses |
+ | authentication |
Scenario: Following image href in instance
Given URI /api/instances exists
@@ -88,6 +89,7 @@ Feature: Managing instances
And each link should have valid method attribute
And each link should have valid rel attribute
+ @prefix-reboot
Scenario: Reboot instance
Given URI /api/instances exists
And authentification is required for this URI
@@ -99,6 +101,7 @@ Feature: Managing instances
Then client should get first instance
And this instance should be in 'RUNNING' state
+ @prefix-stop
Scenario: Stop instance
Given URI /api/instances exists
And authentification is required for this URI
@@ -110,6 +113,7 @@ Feature: Managing instances
Then client should get first instance
And this instance should be in 'STOPPED' state
+ @prefix-start
Scenario: Start instance
Given URI /api/instances exists
And authentification is required for this URI
@@ -121,6 +125,7 @@ Feature: Managing instances
Then client should get first instance
And this instance should be in 'RUNNING' state
+ @prefix-create
Scenario: Basic instance creation
Given URI /api/instances exists
And authentification is required for this URI
@@ -133,12 +138,13 @@ Feature: Managing instances
And this instance should have valid id
And this instance should have name
+ @prefix-create-hwp
Scenario: Choosing hardware profile for instance
Given URI /api/instances exists
And authentification is required for this URI
When client want to create a new instance
Then client should choose first image
- And client choose last hardware profile
+ And client choose first hardware profile
When client request for a new instance
Then new instance should be created
And this instance should have chosed image
Copied: incubator/deltacloud/trunk/tests/ec2/realms.feature (from r962335, incubator/deltacloud/trunk/server/features/realms.feature)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/realms.feature?p2=incubator/deltacloud/trunk/tests/ec2/realms.feature&p1=incubator/deltacloud/trunk/server/features/realms.feature&r1=962335&r2=962336&rev=962336&view=diff
==============================================================================
(empty)
Copied: incubator/deltacloud/trunk/tests/ec2/step_definitions/api_steps.rb (from r962335, incubator/deltacloud/trunk/server/features/step_definitions/api_steps.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/step_definitions/api_steps.rb?p2=incubator/deltacloud/trunk/tests/ec2/step_definitions/api_steps.rb&p1=incubator/deltacloud/trunk/server/features/step_definitions/api_steps.rb&r1=962335&r2=962336&rev=962336&view=diff
==============================================================================
(empty)
Copied: incubator/deltacloud/trunk/tests/ec2/step_definitions/hardware_profiles_steps.rb (from r962335, incubator/deltacloud/trunk/server/features/step_definitions/hardware_profiles_steps.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/step_definitions/hardware_profiles_steps.rb?p2=incubator/deltacloud/trunk/tests/ec2/step_definitions/hardware_profiles_steps.rb&p1=incubator/deltacloud/trunk/server/features/step_definitions/hardware_profiles_steps.rb&r1=962335&r2=962336&rev=962336&view=diff
==============================================================================
(empty)
Copied: incubator/deltacloud/trunk/tests/ec2/step_definitions/images_steps.rb (from r962335, incubator/deltacloud/trunk/server/features/step_definitions/images_steps.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/step_definitions/images_steps.rb?p2=incubator/deltacloud/trunk/tests/ec2/step_definitions/images_steps.rb&p1=incubator/deltacloud/trunk/server/features/step_definitions/images_steps.rb&r1=962335&r2=962336&rev=962336&view=diff
==============================================================================
(empty)
Copied: incubator/deltacloud/trunk/tests/ec2/step_definitions/instance_states_steps.rb (from r962335, incubator/deltacloud/trunk/server/features/step_definitions/instance_states_steps.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/step_definitions/instance_states_steps.rb?p2=incubator/deltacloud/trunk/tests/ec2/step_definitions/instance_states_steps.rb&p1=incubator/deltacloud/trunk/server/features/step_definitions/instance_states_steps.rb&r1=962335&r2=962336&rev=962336&view=diff
==============================================================================
(empty)
Copied: incubator/deltacloud/trunk/tests/ec2/step_definitions/instances_steps.rb (from r962335, incubator/deltacloud/trunk/server/features/step_definitions/instances_steps.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/step_definitions/instances_steps.rb?p2=incubator/deltacloud/trunk/tests/ec2/step_definitions/instances_steps.rb&p1=incubator/deltacloud/trunk/server/features/step_definitions/instances_steps.rb&r1=962335&r2=962336&rev=962336&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/features/step_definitions/instances_steps.rb (original)
+++ incubator/deltacloud/trunk/tests/ec2/step_definitions/instances_steps.rb Thu Jul 8 23:47:25 2010
@@ -56,9 +56,13 @@ end
When /^client want to create a new instance$/ do
end
-Then /^client should choose first image$/ do
+Then /^client should choose (\w+) image$/ do |position|
get '/api/images', {}
- @image = output_xml.xpath('/images/image').first
+ if position=='first'
+ @image = output_xml.xpath('/images/image').first
+ else
+ @image = output_xml.xpath('/images/image').last
+ end
@image.should_not be_nil
end
@@ -111,11 +115,23 @@ Then /^client should get HTML form$/ do
(last_response.body.strip =~ /^<!DOCTYPE html/).should be_true
end
-When /^client choose last hardware profile$/ do
+When /^client choose (\w+) hardware profile$/ do |position|
get '/api/hardware_profiles', {}
- @hwp_id = output_xml.xpath('/hardware-profiles/hardware-profile/id').last.text
+ if position=='last'
+ @hwp_id = output_xml.xpath('/hardware-profiles/hardware-profile/id').last.text
+ else
+ @hwp_id = output_xml.xpath('/hardware-profiles/hardware-profile/id').first.text
+ end
end
Then /^this instance should have last hardware profile$/ do
output_xml.xpath('instance/hardware-profile/id').first.text.should == @hwp_id
end
+
+Given /^I set mock scenario to (\w+)$/ do |scenario|
+ @scenario = scenario
+end
+
+Then /^I set mock scenario to default$/ do
+ @scenario = ''
+end
Copied: incubator/deltacloud/trunk/tests/ec2/step_definitions/rake_steps.rb (from r962335, incubator/deltacloud/trunk/server/features/step_definitions/rake_steps.rb)
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/tests/ec2/step_definitions/rake_steps.rb?p2=incubator/deltacloud/trunk/tests/ec2/step_definitions/rake_steps.rb&p1=incubator/deltacloud/trunk/server/features/step_definitions/rake_steps.rb&r1=962335&r2=962336&rev=962336&view=diff
==============================================================================
(empty)