--- server/Rakefile | 32 +---- server/features/99_rake.feature | 7 - server/features/api.feature | 41 ----- server/features/hardware_profiles.feature | 29 ---- server/features/images.feature | 59 ------- server/features/instance_states.feature | 36 ----- server/features/instances.feature | 165 -------------------- server/features/realms.feature | 31 ---- server/features/step_definitions/api_steps.rb | 103 ------------ .../step_definitions/hardware_profiles_steps.rb | 25 --- server/features/step_definitions/images_steps.rb | 83 ---------- .../step_definitions/instance_states_steps.rb | 34 ---- .../features/step_definitions/instances_steps.rb | 121 -------------- server/features/step_definitions/rake_steps.rb | 19 --- server/features/storage_snapshots.feature | 29 ---- server/features/storage_volumes.feature | 33 ---- server/features/support/env.rb | 39 ----- tests/Rakefile | 7 - 18 files changed, 1 insertions(+), 892 deletions(-) delete mode 100644 server/features/99_rake.feature delete mode 100644 server/features/api.feature delete mode 100644 server/features/hardware_profiles.feature delete mode 100644 server/features/images.feature delete mode 100644 server/features/instance_states.feature delete mode 100644 server/features/instances.feature delete mode 100644 server/features/realms.feature delete mode 100644 server/features/step_definitions/api_steps.rb delete mode 100644 server/features/step_definitions/hardware_profiles_steps.rb delete mode 100644 server/features/step_definitions/images_steps.rb delete mode 100644 server/features/step_definitions/instance_states_steps.rb delete mode 100644 server/features/step_definitions/instances_steps.rb delete mode 100644 server/features/step_definitions/rake_steps.rb delete mode 100644 server/features/storage_snapshots.feature delete mode 100644 server/features/storage_volumes.feature delete mode 100644 server/features/support/env.rb
diff --git a/server/Rakefile b/server/Rakefile index be4554c..7cd2bc0 100644 --- a/server/Rakefile +++ b/server/Rakefile @@ -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 diff --git a/server/features/99_rake.feature b/server/features/99_rake.feature deleted file mode 100644 index c4362c5..0000000 --- a/server/features/99_rake.feature +++ /dev/null @@ -1,7 +0,0 @@ -Feature: Running rake tasks - - Scenario: I want to build Deltacloud API gem - Given I have a clean /pkg directory - When I run a 'package' task - Then I should see a gem file inside pkg directory - And I should see a tgz file inside pkg directory diff --git a/server/features/api.feature b/server/features/api.feature deleted file mode 100644 index 8c4ddd2..0000000 --- a/server/features/api.feature +++ /dev/null @@ -1,41 +0,0 @@ -Feature: Accessing API entry points - - Scenario: API driver and version - Given URI /api exists - 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 'version' with value '1.0' - - Scenario: List of entry points - Given URI /api exists - And authentification is not required for this URI - When client access this URI - Then client should get list of valid entry points: - | realms | - | instances | - | images | - | instance_states | - | hardware_profiles | - | storage_snapshots | - | storage_volumes | - And this URI should be available in XML, JSON, HTML format - - Scenario: Following entry points - Given URI /api exists - And authentification is not required for this URI - When client access this URI - Then client should get list of valid entry points - And each link should have 'rel' attribute with valid name - And each link should have 'href' attribute with valid URL - When client follow this attribute - Then client should get a valid response - - Scenario: Instance features - Given URI /api exists - 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 | diff --git a/server/features/hardware_profiles.feature b/server/features/hardware_profiles.feature deleted file mode 100644 index f10bb13..0000000 --- a/server/features/hardware_profiles.feature +++ /dev/null @@ -1,29 +0,0 @@ -Feature: Accessing hardware profiles - - Scenario: I want to get list of all hardware profiles - Given URI /api/hardware_profiles exists - And authentification is not required for this URI - When client access this URI - Then client should get root element 'hardware-profiles' - And this URI should be available in XML, HTML, JSON format - - Scenario: I want to show hardware profile details - Given URI /api/hardware_profiles exists - 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 - 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 this URI should be available in XML, HTML, JSON format - - Scenario: Filtering images by architecture - Given URI /api/hardware_profiles exists - And authentification is required for this URI - When client access this URI with parameters: - | architecture | i386 | - Then client should get some hardware-profiles - And each hardware-profile should have 'architecture' attribute set to 'i386' diff --git a/server/features/images.feature b/server/features/images.feature deleted file mode 100644 index 50c3570..0000000 --- a/server/features/images.feature +++ /dev/null @@ -1,59 +0,0 @@ -Feature: Listing and showing images - - Scenario: Listing available images - Given URI /api/images exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'images' - And this element contains some images - And each image should have: - | id | - | name | - | description | - | architecture | - | owner_id | - And each image should have 'href' attribute with valid URL - And this URI should be available in XML, JSON, HTML format - - Scenario: Following image href attribute - Given URI /api/images exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'images' - And this element contains some images - When client want to show first image - Then client should follow href attribute in image - And client should get valid response with requested image - And this image should have: - | id | - | name | - | description | - | architecture | - | owner_id | - And this URI should be available in XML, JSON, HTML format - - Scenario: Filtering images by owner_id - Given URI /api/images exists - And authentification is required for this URI - When client access this URI with parameters: - | owner_id | fedoraproject | - Then client should get some images - And each image should have 'owner_id' attribute set to 'fedoraproject' - - Scenario: Filtering images by architecture - Given URI /api/images exists - And authentification is required for this URI - When client access this URI with parameters: - | architecture | i386 | - Then client should get some images - And each image should have 'architecture' attribute set to 'i386' - - Scenario: Filtering images by architecture and owner_id - Given URI /api/images exists - And authentification is required for this URI - When client access this URI with parameters: - | architecture | i386 | - | owner_id | fedoraproject | - 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' diff --git a/server/features/instance_states.feature b/server/features/instance_states.feature deleted file mode 100644 index 3008ef0..0000000 --- a/server/features/instance_states.feature +++ /dev/null @@ -1,36 +0,0 @@ -Feature: Instance states and transitions - - Scenario: Getting list of states - Given URI /api/instance_states exists - And authentification is not required for this URI - When client access this URI - Then client should get root element 'states' - And this element contains some states - And this URI should be available in XML, JSON, HTML format - - - Scenario: State names - Given URI /api/instance_states exists - And authentification is not required for this URI - When client access this URI - Then client should get root element 'states' - And states element contains some states - And each state should have 'name' attribute - And first state should have 'name' attribute set to 'start' - And last state should have 'name' attribute set to 'finish' - - Scenario: Transitions - Given URI /api/instance_states exists - And authentification is not required for this URI - When client access this URI - Then client should get root element 'states' - And states element contains some states - And some states should have transitions - And each transitions should have 'to' attribute - - Scenario: State diagram - Given URI /api/instance_states exists - And authentification is not required for this URI - When client access this URI - And client wants PNG format - Then client should get PNG image diff --git a/server/features/instances.feature b/server/features/instances.feature deleted file mode 100644 index 64828ea..0000000 --- a/server/features/instances.feature +++ /dev/null @@ -1,165 +0,0 @@ -Feature: Managing instances - - Scenario: Listing current instances - Given URI /api/instances exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'instances' - And this element contains some instances - And each instance should have: - | id | - | name | - | owner_id | - | image | - | realm | - | state | - | hardware-profile | - | actions | - | public-addresses | - | private-addresses | - And each instance should have 'href' attribute with valid URL - And this URI should be available in XML, JSON, HTML format - - Scenario: Filtering instances by state - Given URI /api/instances exists - And authentification is required for this URI - When client access this URI with parameters: - | state | RUNNING | - Then client should get some instances - And each instance should have 'state' attribute set to 'RUNNING' - - Scenario: Get details about first instance - Given URI /api/instances exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'instances' - And this element contains some instances - When client want to show first instance - Then client follow href attribute in first instance - Then client should get this instance - And this instance should have: - | id | - | name | - | owner_id | - | image | - | realm | - | state | - | hardware-profile | - | actions | - | public-addresses | - | private-addresses | - - Scenario: Following image href in instance - Given URI /api/instances exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'instances' - And this element contains some instances - When client follow image href attribute in first instance - Then client should get valid image - - Scenario: Following realm href in instance - Given URI /api/instances exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'instances' - And this element contains some instances - When client follow realm href attribute in first instance - Then client should get valid realm - - Scenario: Following hardware profile href in instance - Given URI /api/instances exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'instances' - And this element contains some instances - When client follow hardware-profile href attribute in first instance - Then client should get valid hardware-profile - - Scenario: Instance actions - Given URI /api/instances exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'instances' - And this element contains some instances - And each instance should have actions - And each actions should have some links - And each link should have valid href attribute - And each link should have valid method attribute - And each link should have valid rel attribute - - Scenario: Reboot instance - Given URI /api/instances exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'instances' - And this element contains some instances - When client want to 'reboot' first instance - And client follow link in actions - Then client should get first instance - And this instance should be in 'RUNNING' state - - Scenario: Stop instance - Given URI /api/instances exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'instances' - And this element contains some instances - When client want to 'stop' first instance - And client follow link in actions - Then client should get first instance - And this instance should be in 'STOPPED' state - - Scenario: Start instance - Given URI /api/instances exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'instances' - And this element contains some instances - When client want to 'start' first instance - And client follow link in actions - Then client should get first instance - And this instance should be in 'RUNNING' state - - Scenario: Basic instance creation - 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 - When client request for a new instance - Then new instance should be created - And this instance should have chosed image - And this instance should be in 'RUNNING' state - And this instance should have valid id - And this instance should have name - - 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 - When client request for a new instance - Then new instance should be created - And this instance should have chosed image - And this instance should be in 'RUNNING' state - And this instance should have valid id - And this instance should have last hardware profile - And this instance should have name - - Scenario: Create instance using HTML form - Given URI /api/instances/new exists in HTML format - And authentification is required for this URI - When client access this URI - Then client should get HTML form - - Scenario: Destroying created instance - Given URI /api/instances exists - And authentification is required for this URI - When client want to 'stop' created instance - And client follow link in actions - Then client should get created instance - And this instance should be in 'STOPPED' state - When client want to 'destroy' created instance - And client follow link in actions - And this instance should be destroyed diff --git a/server/features/realms.feature b/server/features/realms.feature deleted file mode 100644 index a89173b..0000000 --- a/server/features/realms.feature +++ /dev/null @@ -1,31 +0,0 @@ -Feature: Accessing realms - - Scenario: Getting list of available realms - Given URI /api/realms exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'realms' - And this element contains some realms - And each realm should have: - | id | - | name | - | state | - | limit | - And each realm should have 'href' attribute with valid URL - And this URI should be available in XML, JSON, HTML format - - Scenario: Following realm href attribute - Given URI /api/realms exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'realms' - And this element contains some realms - When client want to show first realm - Then client should follow href attribute in realm - And client should get valid response with requested realm - And this realm should have: - | id | - | name | - | state | - | limit | - And this URI should be available in XML, JSON, HTML format diff --git a/server/features/step_definitions/api_steps.rb b/server/features/step_definitions/api_steps.rb deleted file mode 100644 index 9a30c3d..0000000 --- a/server/features/step_definitions/api_steps.rb +++ /dev/null @@ -1,103 +0,0 @@ -Given /^URI ([\w/-_]+) exists$/ do |uri| - get uri, {} - last_response.status.should_not == 404 - last_response.status.should_not == 500 - @uri = uri -end - -Given /^URI ([\w/-_]+) exists in (.+) format$/ do |uri, format| - @uri = "#{uri}.#{format.downcase}" - get @uri, {} - last_response.status.should_not == 404 - last_response.status.should_not == 500 -end - -Given /^authentification is not required for this URI$/ do - last_response.status.should_not == 401 -end - -When /^client access this URI$/ do - get @uri, {} - last_response.status.should_not == 404 -end - -Then /^client should get root element '(.+)'$/ do |element| - @last_element = output_xml.xpath('/'+element).first - @last_element.should_not be_nil - @last_element.name.should == element -end - -Then /^this element should have attribute '(.+)' with value '(.+)'$/ do |atr, val| - @last_element[atr.to_sym].should == val -end - -Then /^client should get list of valid entry points:$/ do |table| - @entry_points = table.raw.flatten.sort - links = [] - output_xml.xpath('/api/link').each do |entry_point| - links << entry_point['rel'] - end - @entry_points.should == links.sort -end - -Then /^this URI should be available in (.+) format$/ do |formats| - @no_header = true - formats.split(',').each do |format| - get "#{@uri}.#{format.strip.downcase}", {} - last_response.status.should == 200 - end - @no_header = false -end - -Then /^client should get list of valid entry points$/ do - links = [] - output_xml.xpath('/api/link').each do |entry_point| - links << entry_point['rel'] - end - @entry_points.should == links.sort -end - -Then /^each (\w+) should have '(.+)' attribute with valid (.+)$/ do |el, attr, t| - case el - when 'link': - path = '/api/link' - when 'image': - path = '/images/image' - end - output_xml.xpath(path).each do |entry_point| - @entry_points.include?(entry_point[attr]).should == true if t=='name' - if t=='URL' - entry_point[:href].should_not be_nil - end - end - @last_attribute = attr -end - -Then /^each ([\w-]+) should have '(.+)' attribute set to '(.+)'$/ do |el, attr, v| - case el - when 'image': - path = "/image/images" - end - output_xml.xpath(path).each do |element| - element[attr].should == v - end -end - -When /^client follow this attribute$/ do - output_xml.xpath('/api/link').each do |entry_point| - get entry_point[@last_attribute], {} - end -end - -Then /^client should get a valid response$/ do - last_response.status.should_not == 500 -end - -Then /^client should get list of features inside '(.+)':$/ do |element,table| - features = table.raw.flatten.sort - instance_features = [] - output_xml.xpath('/api/link[@rel="'+element+'"]/feature').each do |feature| - instance_features << feature[:name] - end - features.should == instance_features.sort -end diff --git a/server/features/step_definitions/hardware_profiles_steps.rb b/server/features/step_definitions/hardware_profiles_steps.rb deleted file mode 100644 index db1828b..0000000 --- a/server/features/step_definitions/hardware_profiles_steps.rb +++ /dev/null @@ -1,25 +0,0 @@ -Then /^it should have a (\w+) attribute$/ do |name| - attr = output_xml.xpath('/hardware-profile').first[name] - attr.should_not be_nil -end - -Then /^it should have a (\w+) property '(.+)'$/ do |kind, name| - props = output_xml.xpath("/hardware-profile/property[@name = '#{name}']") - props.size.should == 1 - prop = props.first - prop['kind'].should == kind - prop['unit'].should_not be_nil - if kind == 'range' - ranges = prop.xpath('range') - ranges.size.should == 1 - range = ranges.first - range['first'].should_not be_nil - range['last'].should_not be_nil - end - if kind == 'enum' - enums = prop.xpath('enum') - enums.size.should == 1 - enums.first.xpath('entry').size.should_not == 0 - end -end - diff --git a/server/features/step_definitions/images_steps.rb b/server/features/step_definitions/images_steps.rb deleted file mode 100644 index fc01364..0000000 --- a/server/features/step_definitions/images_steps.rb +++ /dev/null @@ -1,83 +0,0 @@ -Given /^authentification is required for this URI$/ do - authorize CONFIG[:username], CONFIG[:password] - get @uri, {} - last_response.status.should == 200 -end - -Then /^this element contains some (.+)$/ do |items| - item = items.singularize - output_xml.xpath("/#{@last_element.name}/#{item}").size.should > 0 -end - -Then /^each ([\w-]+) should have:$/ do |item, table| - properties = table.raw.flatten.sort - output_xml.xpath("/#{@last_element.name}/#{item}").each do |element| - childrens = (element > '*').collect { |c| c.name } - childrens.sort.should == properties - end -end - -Then /^this ([\w-]+) should have:$/ do |item, table| - properties = table.raw.flatten.sort - output_xml.xpath("/#{item}").each do |element| - childrens = (element > '*').collect { |c| c.name } - childrens.sort.should == properties - end -end - -When /^client want to show first (.+)$/ do |element| - case element - when 'image': - path = '/images/image' - when 'instance': - path = '/instances/instance' - when 'realm': - path = '/realms/realm' - when 'hardware-profile' - path = '/hardware-profiles/hardware-profile' - when 'storage-volume': - path = '/storage-volumes/storage-volume' - when 'storage-snapshot': - path = '/storage-snapshots/storage-snapshot' - end - @element = output_xml.xpath(path).first - @element.should_not be_nil -end - -When /^client want to show '(.+)' (.+)$/ do |id, el| - @uri = "/api/#{el.pluralize.tr('-', '_')}/#{id}" - get @uri, {} - @element = output_xml.xpath("/#{el}").first - @element.should_not be_nil -end - -Then /^client follow (\w+) attribute in first (.+)$/ do |attr, el| - url = output_xml.xpath("/#{el.pluralize}/#{el}").first[:href] - url.should_not be_nil - get url, {} -end - -Then /^client should get this (.+)$/ do |el| - last_response.status.should == 200 -end - - -Then /^client should follow href attribute in (\w+)$/ do |element| - get @element[:href], {} -end - -Then /^client should get valid response with requested (\w+)$/ do |element| - last_response.status.should == 200 - output_xml.xpath('/'+element+'/id').first.text.should == @element.xpath('id').text -end - -When /^client access this URI with parameters:$/ do |table| - params = {} - table.raw.each { |i| params[i[0]]=i[1] } - get @uri, params -end - -Then /^client should get some ([\w-]+)$/ do |elements| - last_response.status.should == 200 - output_xml.xpath('/'+elements+'/'+elements.singularize).size.should > 0 -end diff --git a/server/features/step_definitions/instance_states_steps.rb b/server/features/step_definitions/instance_states_steps.rb deleted file mode 100644 index a587e5d..0000000 --- a/server/features/step_definitions/instance_states_steps.rb +++ /dev/null @@ -1,34 +0,0 @@ -Then /^states element contains some states$/ do - output_xml.xpath('/states/state').size.should > 0 -end - -Then /^each state should have '(.+)' attribute$/ do |attr| - output_xml.xpath('/states/state').each do |state| - state[attr].should_not be_nil - end -end - -Then /^(\w+) state should have '(.+)' attribute set to '(\w+)'$/ do |pos, attr, value| - output_xml.xpath('/states/state').first[attr].should==value if pos=='first' - output_xml.xpath('/states/state').last[attr].should==value if pos=='last' -end - -Then /^some states should have transitions$/ do - @transitions = output_xml.xpath('/states/state/transition') - @transitions.size.should > 0 -end - -Then /^each transitions should have 'to' attribute$/ do - @transitions.each do |t| - t[:to].should_not be_nil - end -end - -When /^client wants (\w+) format$/ do |format| - get "#{@uri}.#{format.downcase}", {} -end - -Then /^client should get PNG image$/ do - last_response.status.should == 200 - last_response.headers['Content-Type'].should == 'image/png' -end diff --git a/server/features/step_definitions/instances_steps.rb b/server/features/step_definitions/instances_steps.rb deleted file mode 100644 index 8ec6526..0000000 --- a/server/features/step_definitions/instances_steps.rb +++ /dev/null @@ -1,121 +0,0 @@ -When /^client follow ([\w-]+) href attribute in first instance$/ do |element| - get output_xml.xpath('/instances/instance[1]/'+element).first[:href], {} -end - -Then /^client should get valid ([\w-]+)$/ do |element| - last_response.status.should == 200 - output_xml.xpath("/#{element}").first.should_not be_nil -end - -Then /^each instance should have actions$/ do - output_xml.xpath('/instances/instance').each do |instance| - instance.xpath('actions').first.should_not be_nil - end -end - -Then /^each actions should have some links$/ do - output_xml.xpath('/instances/instance').each do |instance| - instance.xpath('actions/link').first.should_not be_nil - end -end - -Then /^each link should have valid (\w+) attribute$/ do |attr| - output_xml.xpath('/instances/instance').each do |instance| - instance.xpath('actions/link').first[attr].should_not be_nil - end -end - -When /^client want to '(\w+)' first instance$/ do |action| - @action = action - @instance = output_xml.xpath('/instances/instance[1]').first -end - -When /^client follow link in actions$/ do - unless @instance_url - l = output_xml.xpath("/instances/instance[1]/actions/link[@rel = '#{@action}']").first - else - l = @instance.xpath('actions/link[@rel="'+@action+'"]').first - end - unless @action=='destroy' - post l[:href], { :id => @instance.xpath('id').first.text } - else - delete l[:href], { :id => @instance.xpath('id').first.text } - end - last_response.status.should_not == 500 -end - -Then /^client should get first instance$/ do - output_xml.xpath('/instance/id').first.should_not be_nil - #output_xml.xpath('/instance/id').first.text.should == @instance.xpath('id').first.text -end - -Then /^this instance should be in '(.+)' state$/ do |state| - output_xml.xpath('/instance/state').first.text.should == state -end - -When /^client want to create a new instance$/ do -end - -Then /^client should choose first image$/ do - get '/api/images', {} - @image = output_xml.xpath('/images/image').first - @image.should_not be_nil -end - -When /^client request for a new instance$/ do - params = { - :image_id => @image.xpath('id').first.text - } - params[:hwp_id] = @hwp_id if @hwp_id - post "#{@uri}", params - last_response.status.should == 201 - @instance_url = last_response.headers['Location'] -end - -Then /^new instance should be created$/ do - get @instance_url, {} - last_response.status.should == 200 -end - -Then /^this instance should have chosed image$/ do - output_xml.xpath('/instance/image').first[:href].should == @image[:href] -end - -Then /^this instance should have valid id$/ do - output_xml.xpath('instance/id').first.should_not be_nil -end - -Then /^this instance should have name$/ do - output_xml.xpath('instance/name').first.should_not be_nil -end - -When /^client want to '(\w+)' created instance$/ do |action| - get @instance_url, {} - last_response.status.should == 200 - @action = action - @instance = output_xml.xpath('/instance') -end - -Then /^client should get created instance$/ do - get @instance_url -end - -When /^this instance should be destroyed$/ do - # TODO: Fix this bug in mock driver ? - #get @instance_url, {} - #last_response.status.should == 404 -end - -Then /^client should get HTML form$/ do - last_response.status.should == 200 - (last_response.body.strip =~ /^<!DOCTYPE html/).should be_true -end - -When /^client choose last hardware profile$/ do - get '/api/hardware_profiles', {} - @hwp_id = output_xml.xpath('/hardware-profiles/hardware-profile/id').last.text -end - -Then /^this instance should have last hardware profile$/ do - output_xml.xpath('instance/hardware-profile/id').first.text.should == @hwp_id -end diff --git a/server/features/step_definitions/rake_steps.rb b/server/features/step_definitions/rake_steps.rb deleted file mode 100644 index c8ea3d9..0000000 --- a/server/features/step_definitions/rake_steps.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'fileutils' -require 'rake' -require 'find' - -Given /^I have a clean (.+) directory$/ do |dir| - FileUtils.rm_rf dir -end - -When /^I run a '(\w+)' task$/ do |task| - @rake = Rake::Application.new - Rake.application = @rake - load "Rakefile" - @task = Rake::Task[task] - @task.invoke -end - -Then /^I should see a (\w+) file inside (\w+) directory$/ do |ext, dir| - Dir["#{dir}/deltacloud-*.#{ext}"].size.should == 1 -end diff --git a/server/features/storage_snapshots.feature b/server/features/storage_snapshots.feature deleted file mode 100644 index f6f38e5..0000000 --- a/server/features/storage_snapshots.feature +++ /dev/null @@ -1,29 +0,0 @@ -Feature: Accessing storage snapshots - - Scenario: Listing available storage snapshots - Given URI /api/storage_snapshots exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'storage-snapshots' - And this element contains some storage-snapshots - And each storage-volume should have: - | id | - | created | - | storage-volume | - And each image should have 'href' attribute with valid URL - And this URI should be available in XML, JSON, HTML format - - Scenario: Get details about first volume - Given URI /api/storage_snapshots exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'storage-snapshots' - And this element contains some storage-snapshots - When client want to show first storage-snapshot - Then client follow href attribute in first storage-snapshot - Then client should get this storage-snapshot - And this storage-snapshot should have: - | id | - | created | - | state | - | storage-volume | diff --git a/server/features/storage_volumes.feature b/server/features/storage_volumes.feature deleted file mode 100644 index dfca4b0..0000000 --- a/server/features/storage_volumes.feature +++ /dev/null @@ -1,33 +0,0 @@ -Feature: Accessing storage volumes - - Scenario: Listing available storage volumes - Given URI /api/storage_volumes exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'storage-volumes' - And this element contains some storage-volumes - And each storage-volume should have: - | id | - | created | - | capacity | - | device | - | instance | - And each image should have 'href' attribute with valid URL - And this URI should be available in XML, JSON, HTML format - - Scenario: Get details about first volume - Given URI /api/storage_volumes exists - And authentification is required for this URI - When client access this URI - Then client should get root element 'storage-volumes' - And this element contains some storage-volumes - When client want to show first storage-volume - Then client follow href attribute in first storage-volume - Then client should get this storage-volume - And this storage-volume should have: - | id | - | created | - | capacity | - | device | - | instance | - | state | diff --git a/server/features/support/env.rb b/server/features/support/env.rb deleted file mode 100644 index 45430c3..0000000 --- a/server/features/support/env.rb +++ /dev/null @@ -1,39 +0,0 @@ -require 'sinatra' -require 'server' -require 'rack/test' -require 'nokogiri' - -SERVER_DIR = File::expand_path(File::join(File::dirname(__FILE__), "../..")) -Sinatra::Application.set :environment, :test -Sinatra::Application.set :root, SERVER_DIR - -ENV['API_DRIVER'] = "mock" unless ENV['API_DRIVER'] - -CONFIG = { - :username => 'mockuser', - :password => 'mockpassword' -} - -World do - - def app - @app = Rack::Builder.new do - set :logging, true - set :raise_errors, true - run Sinatra::Application - end - end - - def output_xml - Nokogiri::XML(last_response.body) - end - - Before do - unless @no_header - header 'Accept', 'application/xml' - end - end - - include Rack::Test::Methods -end - diff --git a/tests/Rakefile b/tests/Rakefile index 7cddad3..0aa528f 100644 --- a/tests/Rakefile +++ b/tests/Rakefile @@ -19,8 +19,6 @@ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require 'rake' -require 'rake/testtask' -require 'rake/gempackagetask' require 'cucumber' require 'cucumber/rake/task'
@@ -45,8 +43,3 @@ end Cucumber::Rake::Task.new(:junit) do |t| t.cucumber_opts = "../tests/#{DRIVER} --format junit --out ../tests/tmp/junit_#{DRIVER}" end - -load '../server/deltacloud-core.gemspec' -Rake::GemPackageTask.new(@spec) do |pkg| - pkg.need_tar = true -end