---
server/features/api.feature | 17 +++
server/features/flavors.feature | 23 ++++
server/features/images.feature | 38 +++++++
server/features/instance_states.feature | 7 ++
server/features/instances.feature | 98 +++++++++++++++++
server/features/realms.feature | 25 +++++
server/features/step_definitions/api_steps.rb | 11 ++
server/features/step_definitions/common_steps.rb | 110 ++++++++++++++++++++
server/features/step_definitions/flavors_steps.rb | 5 +
server/features/step_definitions/images_steps.rb | 6 +
.../step_definitions/instance_states_steps.rb | 3 +
.../features/step_definitions/instances_steps.rb | 87 +++++++++++++++
server/features/step_definitions/realms_steps.rb | 4 +
.../step_definitions/storage_snapshots_steps.rb | 23 ++++
.../features/step_definitions/storage_volumes.rb | 4 +
server/features/storage_snapshots.feature | 29 +++++
server/features/storage_volumes.feature | 28 +++++
server/features/support/ec2/config.yaml | 23 ++++
server/features/support/ec2/fixtures/flavors.yaml | 10 ++
server/features/support/ec2/fixtures/images.yaml | 29 +++++
.../features/support/ec2/fixtures/instances.yaml | 35 ++++++
server/features/support/ec2/fixtures/realms.yaml | 10 ++
.../support/ec2/fixtures/storage_snapshot.yaml | 11 ++
.../support/ec2/fixtures/storage_volume.yaml | 17 +++
server/features/support/env.rb | 27 +++++
server/features/support/mock/config.yaml | 23 ++++
26 files changed, 703 insertions(+), 0 deletions(-)
create mode 100644 server/features/api.feature
create mode 100644 server/features/flavors.feature
create mode 100644 server/features/images.feature
create mode 100644 server/features/instance_states.feature
create mode 100644 server/features/instances.feature
create mode 100644 server/features/realms.feature
create mode 100644 server/features/step_definitions/api_steps.rb
create mode 100644 server/features/step_definitions/common_steps.rb
create mode 100644 server/features/step_definitions/flavors_steps.rb
create mode 100644 server/features/step_definitions/images_steps.rb
create mode 100644 server/features/step_definitions/instance_states_steps.rb
create mode 100644 server/features/step_definitions/instances_steps.rb
create mode 100644 server/features/step_definitions/realms_steps.rb
create mode 100644 server/features/step_definitions/storage_snapshots_steps.rb
create mode 100644 server/features/step_definitions/storage_volumes.rb
create mode 100644 server/features/storage_snapshots.feature
create mode 100644 server/features/storage_volumes.feature
create mode 100644 server/features/support/ec2/config.yaml
create mode 100644 server/features/support/ec2/fixtures/flavors.yaml
create mode 100644 server/features/support/ec2/fixtures/images.yaml
create mode 100644 server/features/support/ec2/fixtures/instances.yaml
create mode 100644 server/features/support/ec2/fixtures/realms.yaml
create mode 100644 server/features/support/ec2/fixtures/storage_snapshot.yaml
create mode 100644 server/features/support/ec2/fixtures/storage_volume.yaml
create mode 100644 server/features/support/env.rb
create mode 100644 server/features/support/mock/config.yaml
diff --git a/server/features/api.feature b/server/features/api.feature
new file mode 100644
index 0000000..d20af64
--- /dev/null
+++ b/server/features/api.feature
@@ -0,0 +1,17 @@
+Feature: Working with API
+ In order to work with API
+
+ Background:
+ Given I want to get XML
+
+ Scenario: I want to get list of entry points
+ When I request for entry points
+ Then I should see this entry points:
+ | flavors |
+ | realms |
+ | instances |
+ | images |
+ | instance_states |
+ | hardware_profiles |
+ | storage_snapshots |
+ | storage_volumes |
diff --git a/server/features/flavors.feature b/server/features/flavors.feature
new file mode 100644
index 0000000..6ee238e
--- /dev/null
+++ b/server/features/flavors.feature
@@ -0,0 +1,23 @@
+Feature: Working with flavors
+ In order to work with flavors
+
+ Background:
+ Given I want to get XML
+
+ Scenario: I want to get list of all flavors
+ When I follow flavors link in entry points
+ Then I should see <FLAVOR_COUNT> flavor inside flavors
+ And each link in flavors should point me to valid flavor
+
+ Scenario: I want to show flavor details
+ When I request for '<FLAVOR_ID>' flavor
+ Then I should get this flavor
+ And flavor should have valid href parameter
+ And flavor should contain id parameter
+ And flavor should contain architecture parameter
+ And flavor should contain memory parameter
+ And flavor should contain storage parameter
+
+ Scenario: I want filter flavors by architecture
+ When I want flavors with '<FLAVOR_ARCH>' architecture
+ Then I should get only flavors with architecture '<FLAVOR_ARCH>'
diff --git a/server/features/images.feature b/server/features/images.feature
new file mode 100644
index 0000000..6bc0677
--- /dev/null
+++ b/server/features/images.feature
@@ -0,0 +1,38 @@
+Feature: Working with images
+ In order to work with images
+
+ Background:
+ Given I want to get XML
+
+ Scenario: I want to get list of all images
+ When I follow images link in entry points
+ Then I in order to see list of images I need to be authorized
+ When I enter correct username and password
+ And I follow images link in entry points
+ Then I should see <IMAGE_COUNT> image inside images
+ And each link in images should point me to valid image
+
+ Scenario: I want to show image details
+ Given I am authorized to show image '<IMAGE_ID>'
+ When I request for '<IMAGE_ID>' image
+ Then I should get this image
+ And image should have valid href parameter
+ And image should contain id parameter
+ And image should contain name parameter
+ And image should contain owner_id parameter
+ And image should contain description parameter
+ And image should contain architecture parameter
+
+ Scenario: I want filter images by owner_id
+ When I want images with '<IMAGE_OWNER>' owner_id
+ Then I should get only images with owner_id '<IMAGE_OWNER>'
+
+ Scenario: I want filter images by architecture
+ When I want images with '<IMAGE_ARCH>' architecture
+ Then I should get only images with architecture '<IMAGE_ARCH>'
+
+ Scenario: I want filter images by architecture
+ When I want images with '<IMAGE_ARCH>' architecture
+ And images with '<IMAGE_OWNER>' owner_id
+ Then I should get only images with architecture '<IMAGE_ARCH>'
+ And this images should also have owner_id '<IMAGE_OWNER>'
diff --git a/server/features/instance_states.feature
b/server/features/instance_states.feature
new file mode 100644
index 0000000..80158a3
--- /dev/null
+++ b/server/features/instance_states.feature
@@ -0,0 +1,7 @@
+Feature: Get possible instance states
+ In order to get possible instance states
+
+ Scenario:
+ Given I want to get XML
+ When I follow instance states link in entry points
+ Then I should see list of instance states
diff --git a/server/features/instances.feature
b/server/features/instances.feature
new file mode 100644
index 0000000..507f9df
--- /dev/null
+++ b/server/features/instances.feature
@@ -0,0 +1,98 @@
+Feature: Managing instances
+ In order to manage instances
+
+ Background:
+ Given I want to get XML
+
+ Scenario: I want to get list of all instances
+ Given I am authorized to list instances
+ When I follow instances link in entry points
+ Then I should see some instance inside instances
+ And each link in instances should point me to valid instance
+
+ Scenario: I want to create a new instance
+ Given I am authorized to create instance
+ When I request create new instance with:
+ | name | <INSTANCE_1_NAME> |
+ | image_id | <INSTANCE_IMAGE_ID> |
+ Then I should request this instance
+ And this instance should be 'RUNNING'
+ And this instance should have name '<INSTANCE_1_NAME>'
+ And this instance should be image '<INSTANCE_IMAGE_ID>'
+
+ Scenario: I want to create a new instance using realm
+ Given I am authorized to create instance
+ When I request create new instance with:
+ | name | <INSTANCE_2_NAME> |
+ | image_id | <INSTANCE_IMAGE_ID> |
+ | realm | <INSTANCE_REALM> |
+ Then I should request this instance
+ And this instance should be 'RUNNING'
+ And this instance should have name '<INSTANCE_2_NAME>'
+ And this instance should be image '<INSTANCE_IMAGE_ID>'
+ And this instance should have realm '<INSTANCE_REALM>'
+
+ Scenario: I want to show instance details
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ When I request for '<INSTANCE_1_ID>' instance
+ Then I should get this instance
+ And instance should contain id parameter
+ And instance should contain name parameter
+ And instance should contain owner_id parameter
+ And instance should contain state parameter
+ And instance state should be RUNNING
+ When instance state is RUNNING
+ Then instance should have one public address
+ And instance should have one private address
+ When instance state is RUNNING
+ Then instance should include link to 'reboot' action
+ And instance should include link to 'stop' action
+
+ Scenario: I want to get instance image
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ Given I request for '<INSTANCE_1_ID>' instance
+ When I want to get details about instance image
+ Then I could follow image href attribute
+ And this attribute should point me to valid image
+
+ Scenario: I want to get instance flavor
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ Given I request for '<INSTANCE_1_ID>' instance
+ When I want to get details about instance flavor
+ Then I could follow flavor href attribute
+ And this attribute should point me to valid flavor
+
+ Scenario: I want to get instance realm
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ Given I request for '<INSTANCE_1_ID>' instance
+ When I want to get details about instance realm
+ Then I could follow realm href attribute
+ And this attribute should point me to valid realm
+
+ Scenario: I want to stop instance
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ Given I request for '<INSTANCE_1_ID>' instance
+ When I want to stop this instance
+ Then I could follow stop action in actions
+ And this instance state should be 'STOPPED'
+
+ Scenario: I want to start instance
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ Given I request for '<INSTANCE_1_ID>' instance
+ When I want to stop this instance
+ Then I could follow start action in actions
+ And this instance state should be 'RUNNING'
+
+ Scenario: I want to reboot instance
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ Given I request for '<INSTANCE_1_ID>' instance
+ When I want to reboot this instance
+ Then I could follow reboot action in actions
+ And this instance state should be 'RUNNING'
+
+ Scenario: I want to destroy instance
+ Given I am authorized to show instance '<INSTANCE_1_ID>'
+ Given I request for '<INSTANCE_1_ID>' instance
+ When I want to stop this instance
+ Then I could follow stop action in actions
+ And this instance state should be 'STOPPED'
diff --git a/server/features/realms.feature b/server/features/realms.feature
new file mode 100644
index 0000000..c0f1648
--- /dev/null
+++ b/server/features/realms.feature
@@ -0,0 +1,25 @@
+Feature: Working with realms
+ In order to work with realms
+
+ Background:
+ Given I want to get XML
+
+ Scenario: I want to get list of all realms
+ When I follow realms link in entry points
+ Then I in order to see list of realms I need to be authorized
+ When I enter correct username and password
+ And I follow realms link in entry points
+ Then I should see <REALM_COUNT> realm inside realms
+ And each link in realms should point me to valid realm
+
+ Scenario: I want to show realm details
+ When I request for '<REALM_ID>' realm
+ Then I should get this realm
+ And realm should have valid href parameter
+ And realm should contain id parameter
+ And realm should contain name parameter
+ And realm should contain state parameter
+
+ Scenario: I want filter realms by state
+ When I want realms with '<REALM_STATE>' state
+ Then I should get only realms with state '<REALM_STATE>'
diff --git a/server/features/step_definitions/api_steps.rb
b/server/features/step_definitions/api_steps.rb
new file mode 100644
index 0000000..ce9b5dd
--- /dev/null
+++ b/server/features/step_definitions/api_steps.rb
@@ -0,0 +1,11 @@
+When /^I request for entry points$/ do
+ get "/api", { }
+end
+
+Then /^I should see this entry points:$/ do |table|
+ tp = table.raw.flatten
+ Nokogiri::XML(last_response.body).xpath('/api/link').each do |entry_point|
+ tp.include?(entry_point[:rel]).should == true
+ end
+end
+
diff --git a/server/features/step_definitions/common_steps.rb
b/server/features/step_definitions/common_steps.rb
new file mode 100644
index 0000000..62d2e2d
--- /dev/null
+++ b/server/features/step_definitions/common_steps.rb
@@ -0,0 +1,110 @@
+require 'nokogiri'
+
+When /^I want to get (HTML|XML)$/ do |format|
+ case format.downcase
+ when 'xml':
+ header 'Accept', 'application/xml'
+ end
+end
+
+Then /^I should see ([\w\<\>_\-]+) (.+) inside (.+)$/ do |count, model,
collection|
+ collection.tr!(' ', '-')
+ model.tr!(' ', '-')
+ if count.eql?('some')
+
Nokogiri::XML(last_response.body).xpath("/#{collection}/#{model}").size.should_not
== 0
+ else
+ count = replace_variables(count)
+
Nokogiri::XML(last_response.body).xpath("/#{collection}/#{model}").size.should
== count.to_i
+ end
+end
+
+When /^I request for '(.+)' (.+)$/ do |id, model|
+ model.tr!(' ', '_')
+ get '/api/'+model+'s'+'/'+replace_variables(id), {}
+end
+
+Then /^I should get this (.+)$/ do |model|
+ model.tr!(' ', '-')
+ Nokogiri::XML(last_response.body).xpath("/#{model}").size.should == 1
+end
+
+When /^I want (.+) with '(.+)' (.+)$/ do |collection, value, parameter|
+ @params = []
+ @params << [parameter, replace_variables(value)]
+end
+
+When /^images with '(.+)' (.+)$/ do |value, parameter|
+ @params << [parameter, replace_variables(value)]
+end
+
+Then /^I should get only (.+) with (.+) '(.+)'$/ do |collection, parameter,
value|
+ params = {}
+ value = replace_variables(value)
+ @params.collect { |param| params[:"#{param[0]}"] = param[1] }
+ get '/api/'+collection, params, {}
+ p = []
+
Nokogiri::XML(last_response.body).xpath("/#{collection}/#{collection.gsub(/s$/,
'')}").each do |m|
+ p << m.xpath("#{parameter}").text
+ end
+ p.uniq!
+ p.size.should == 1
+ p.first.should == value
+end
+
+Then /^this (.+) should also have (.+) '(.+)'$/ do |collection, parameter,
value|
+ params = {}
+ value = replace_variables(value)
+ @params.collect { |param| params[:"#{param[0]}"] = param[1] }
+ get '/api/'+collection, params, {}
+ p = []
+
Nokogiri::XML(last_response.body).xpath("/#{collection}/#{collection.gsub(/s$/,
'')}").each do |m|
+ p << m.xpath("#{parameter}").text
+ end
+ p.uniq!
+ p.size.should == 1
+ p.first.should == value
+end
+
+Then /^I in order to see (list of|this) (.+) I need to be authorized$/ do |t,
collection|
+ last_response.body.strip.should == 'Not authorized'
+end
+
+When /^I enter correct username and password$/ do
+ authorize 'mockuser', 'mockpassword'
+end
+
+Given /^I am authorized to show (.+) '(.+)'$/ do |model, id|
+ model.tr!(' ', '_')
+ authorize 'mockuser', 'mockpassword'
+ get '/api/'+model+'s/'+model+'/'+replace_variables(id), {}
+ last_response.body.strip.should_not == 'Not authorized'
+end
+
+Then /^(.+) should contain (.+) parameter$/ do |model, parameter|
+ model.tr!(' ', '-')
+
Nokogiri::XML(last_response.body).xpath("/#{model}/#{parameter}").first.should_not
== nil
+
Nokogiri::XML(last_response.body).xpath("/#{model}/#{parameter}").first.text.should_not
== ''
+end
+
+Given /^I am authorized to (list) (.+)$/ do |operation, collection|
+ authorize 'mockuser', 'mockpassword'
+ collection.tr!(' ', '_')
+ get '/api/'+collection, {}
+ last_response.body.strip.should_not == 'Not authorized'
+end
+
+When /^I follow (.+) link in entry points$/ do |entry_point|
+ get '/api', {}
+ entry_point.tr!(' ', '_')
+ get
URI.parse(Nokogiri::XML(last_response.body).xpath("/api/li...@rel='#{entry_point}']").first[:href]).path,
{}
+end
+
+Then /^each link in (.+) should point me to valid (.+)$/ do |collection, model|
+ collection.tr!(' ', '_')
+ model.tr!(' ', '_')
+ Nokogiri::XML(last_response.body).xpath("/#{collection}/#{model}").each do
|m|
+ get URI.parse(m[:href]).path, {}
+ Nokogiri::XML(last_response.body).root.name.should == model
+ Nokogiri::XML(last_response.body).xpath("/#{model}").size.should == 1
+ end
+end
diff --git a/server/features/step_definitions/flavors_steps.rb
b/server/features/step_definitions/flavors_steps.rb
new file mode 100644
index 0000000..d806aaf
--- /dev/null
+++ b/server/features/step_definitions/flavors_steps.rb
@@ -0,0 +1,5 @@
+Then /^flavor should have valid href parameter$/ do
+ href=Nokogiri::XML(last_response.body).xpath('/flavor').first[:href]
+ href.should == "http://example.org/api/flavors/#{CONFIG[:flavor_id]}"
+end
+
diff --git a/server/features/step_definitions/images_steps.rb
b/server/features/step_definitions/images_steps.rb
new file mode 100644
index 0000000..c6cf56b
--- /dev/null
+++ b/server/features/step_definitions/images_steps.rb
@@ -0,0 +1,6 @@
+
+Then /^image should have valid href parameter$/ do
+ href=Nokogiri::XML(last_response.body).xpath('/image').first[:href]
+ href.should == "http://example.org/api/images/#{CONFIG[:image_id]}"
+end
+
diff --git a/server/features/step_definitions/instance_states_steps.rb
b/server/features/step_definitions/instance_states_steps.rb
new file mode 100644
index 0000000..50d55f4
--- /dev/null
+++ b/server/features/step_definitions/instance_states_steps.rb
@@ -0,0 +1,3 @@
+Then /^I should see list of instance states$/ do
+ Nokogiri::XML(last_response.body).root.name.should == 'states'
+end
diff --git a/server/features/step_definitions/instances_steps.rb
b/server/features/step_definitions/instances_steps.rb
new file mode 100644
index 0000000..4994a89
--- /dev/null
+++ b/server/features/step_definitions/instances_steps.rb
@@ -0,0 +1,87 @@
+Then /^instance state should be (.+)$/ do |state|
+ Nokogiri::XML(last_response.body).xpath("/instance/state").first.text.should
== state
+end
+
+When /^instance state is (.+)$/ do |state|
+ Nokogiri::XML(last_response.body).xpath("/instance/state").first.text.should
== state
+end
+
+Then /^instance should have one (public|private) address$/ do |type|
+ adr =
Nokogiri::XML(last_response.body).xpath("/instance/#{type}-addresses/address").first
+ adr.text.to_s.should_not == nil
+ adr.text.to_s.should_not == ''
+end
+
+Then /^instance should include link to '(.+)' action$/ do |action|
+ links = Nokogiri::XML(last_response.body).xpath("/instance/actions/link")
+ actions = []
+ links.each do |link|
+ actions << link[:rel]
+ end
+ actions.include?(action).should == true
+end
+
+When /^I want to get details about instance (.+)$/ do |model|
+end
+
+Then /^I could follow (image|realm|flavor) href attribute$/ do |model|
+ m = Nokogiri::XML(last_response.body).xpath("/instance/#{model}").first
+ model_url = URI.parse(m[:href]).path
+ get model_url, {}
+end
+
+Then /^this attribute should point me to valid (image|realm|flavor)$/ do
|model|
+ Nokogiri::XML(last_response.body).xpath("/#{model}").first.name.should ==
model
+end
+
+When /^I want to (.+) this instance$/ do |action|
+end
+
+Given /^I am authorized to create instance$/ do
+ last_response.body.strip.should_not == 'Not authorized'
+end
+
+Then /^I could follow (.+) action in actions$/ do |action|
+ link =
Nokogiri::XML(last_response.body).xpath("/instance/actions/li...@rel='#{action}']").first
+ post URI.parse(link[:href]).path, {}
+end
+
+Then /^this instance state should be '(.+)'$/ do |state|
+ Nokogiri::XML(last_response.body).xpath("/instance/state").first.text.should
== state
+end
+
+When /^I request create new instance with:$/ do |table|
+ params = {}
+ table.raw.map { |a,b| params[:"#{a}"] = replace_variables(b) }
+ post '/api/instances', params
+ @instance_id =
Nokogiri::XML(last_response.body).xpath("/instance/id").first.text
+ @instance_id.should_not == nil
+ CONFIG[:instance_1_id] = @instance_id unless CONFIG[:instance_1_id]
+end
+
+Then /^I should request this instance$/ do
+ get URI.encode('/api/instances/'+...@instance_id), {}
+ Nokogiri::XML(last_response.body).xpath("/instance").first.should_not == nil
+end
+
+Then /^this instance should be '(.+)'$/ do |state|
+ get URI.encode('/api/instances/'+...@instance_id), {}
+ Nokogiri::XML(last_response.body).xpath("/instance/state").first.text.should
== state
+end
+
+Then /^this instance should have name '(.+)'$/ do |name|
+ get URI.encode('/api/instances/'+...@instance_id), {}
+ Nokogiri::XML(last_response.body).xpath("/instance/name").first.text.should
== replace_variables(name)
+end
+
+Then /^this instance should be image '(.+)'$/ do |image|
+ get URI.encode('/api/instances/'+...@instance_id), {}
+ get
URI.parse(Nokogiri::XML(last_response.body).xpath("/instance/image").first[:href]).path,
{}
+ Nokogiri::XML(last_response.body).xpath("/image/id").first.text.should ==
replace_variables(image)
+end
+
+Then /^this instance should have realm '(.+)'$/ do |realm|
+ get URI.encode('/api/instances/'+...@instance_id), {}
+ get
URI.parse(Nokogiri::XML(last_response.body).xpath("/instance/realm").first[:href]).path,
{}
+ Nokogiri::XML(last_response.body).xpath("/realm/id").first.text.should ==
replace_variables(realm)
+end
diff --git a/server/features/step_definitions/realms_steps.rb
b/server/features/step_definitions/realms_steps.rb
new file mode 100644
index 0000000..39938cc
--- /dev/null
+++ b/server/features/step_definitions/realms_steps.rb
@@ -0,0 +1,4 @@
+Then /^realm should have valid href parameter$/ do
+ href=Nokogiri::XML(last_response.body).xpath('/realm').first[:href]
+ href.should == "http://example.org/api/realms/#{CONFIG[:realm_id]}"
+end
diff --git a/server/features/step_definitions/storage_snapshots_steps.rb
b/server/features/step_definitions/storage_snapshots_steps.rb
new file mode 100644
index 0000000..5da4c13
--- /dev/null
+++ b/server/features/step_definitions/storage_snapshots_steps.rb
@@ -0,0 +1,23 @@
+Then /^storage snapshot should have valid href parameter$/ do
+
href=Nokogiri::XML(last_response.body).xpath('/storage-snapshot').first[:href]
+ href.should ==
"http://example.org/api/storage_snapshots/#{CONFIG[:storage_snapshot_id]}"
+end
+
+Then /^storage snapshot should have storage\-volume with valid href
attribute$/ do
+
href=Nokogiri::XML(last_response.body).xpath('/storage-snapshot/storage-volume').first[:href]
+ href.should ==
"http://example.org/api/storage_volumes/#{CONFIG[:storage_volume_id]}"
+end
+
+When /^I want to get details about storage volume$/ do
+
@storage_volume_url=Nokogiri::XML(last_response.body).xpath('/storage-snapshot/storage-volume').first[:href]
+end
+
+Then /^I could follow storage volume href attribute$/ do
+ url=URI.parse(@storage_volume_url)
+ get url.path, {}
+ last_response.should_not == nil
+end
+
+Then /^this attribute should point me to valid storage volume$/ do
+ Nokogiri::XML(last_response.body).xpath("/storage-volume").size.should == 1
+end
diff --git a/server/features/step_definitions/storage_volumes.rb
b/server/features/step_definitions/storage_volumes.rb
new file mode 100644
index 0000000..23546b0
--- /dev/null
+++ b/server/features/step_definitions/storage_volumes.rb
@@ -0,0 +1,4 @@
+Then /^storage volume should have valid href parameter$/ do
+ href=Nokogiri::XML(last_response.body).xpath('/storage-volume').first[:href]
+ href.should ==
"http://example.org/api/storage_volumes/#{CONFIG[:storage_volume_id]}"
+end
diff --git a/server/features/storage_snapshots.feature
b/server/features/storage_snapshots.feature
new file mode 100644
index 0000000..bc9d79a
--- /dev/null
+++ b/server/features/storage_snapshots.feature
@@ -0,0 +1,29 @@
+Feature: Working with storage snapshots
+ In order to work with storage snapshots
+
+ Background:
+ Given I want to get XML
+
+ Scenario: I want to get list of all storage snapshots
+ Given I am authorized to list storage snapshots
+ When I follow storage snapshots link in entry points
+ Then I should see <STORAGE_SNAPSHOT_COUNT> storage snapshot inside storage
snapshots
+ And each link in storage snapshots should point me to valid storage
snapshot
+
+ Scenario: I want to show storage snapshot details
+ Given I am authorized to show storage snapshot '<STORAGE_SNAPSHOT_ID>'
+ When I request for '<STORAGE_SNAPSHOT_ID>' storage snapshot
+ Then I should get this storage snapshot
+ And storage snapshot should have valid href parameter
+ And storage snapshot should contain id parameter
+ And storage snapshot should contain created parameter
+ And storage snapshot should contain state parameter
+ And storage snapshot should have storage-volume with valid href attribute
+ When I want to get details about storage volume
+ Then I could follow storage volume href attribute
+ And this attribute should point me to valid storage volume
+
+ Scenario: I want filter storage snapshots by state
+ Given I am authorized to list storage snapshots
+ When I want storage snapshots with '<STORAGE_SNAPSHOT_STATE>' state
+ Then I should get only realms with state '<STORAGE_SNAPSHOT_STATE>'
diff --git a/server/features/storage_volumes.feature
b/server/features/storage_volumes.feature
new file mode 100644
index 0000000..d1249f7
--- /dev/null
+++ b/server/features/storage_volumes.feature
@@ -0,0 +1,28 @@
+Feature: Working with storage volumes
+ In order to work with storage volumes
+
+ Background:
+ Given I want to get XML
+
+ Scenario: I want to get list of all storage volumes
+ Given I am authorized to list storage volumes
+ When I follow storage volumes link in entry points
+ Then I should see <STORAGE_VOLUME_COUNT> storage volume inside storage
volumes
+ And each link in storage volumes should point me to valid storage volume
+
+ Scenario: I want to show storage volume details
+ Given I am authorized to show storage volume '<STORAGE_VOLUME_ID>'
+ When I request for '<STORAGE_VOLUME_ID>' storage volume
+ Then I should get this storage volume
+ And storage volume should have valid href parameter
+ And storage volume should contain id parameter
+ And storage volume should contain created parameter
+ And storage volume should contain state parameter
+ And storage volume should contain capacity parameter
+ And storage volume should contain device parameter
+ And storage volume should contain instance parameter
+
+ Scenario: I want filter storage volumes by state
+ Given I am authorized to list storage volumes
+ When I want storage volumes with '<STORAGE_VOLUME_STATE>' state
+ Then I should get only realms with state '<STORAGE_VOLUME_STATE>'
diff --git a/server/features/support/ec2/config.yaml
b/server/features/support/ec2/config.yaml
new file mode 100644
index 0000000..e5c48e5
--- /dev/null
+++ b/server/features/support/ec2/config.yaml
@@ -0,0 +1,23 @@
+---
+:storage_snapshot_id: snap-72a5401b
+:driver_name: ec2
+:instances_count: 2
+:flavor_arch: x86_64
+:storage_snapshot_state: AVAILABLE
+:realm_id: us-east-1a
+:instance_1_name: 1268827159 testing instance
+:image_owner: "522821470517"
+:storage_snapshot_count: "2"
+:realm_state: AVAILABLE
+:instance_2_name: 1268827160 testing instance
+:image_arch: i386
+:storage_volume_id: vol-60957009
+:realm_count: 3
+:instance_image_id: ami-e4b6538d
+:image_id: ami-e4b6538d
+:storage_volume_state: AVAILABLE
+:flavor_id: m1-small
+:instance_realm: us-east-1a
+:image_count: 2
+:storage_volume_count: 2
+:flavor_count: 5
diff --git a/server/features/support/ec2/fixtures/flavors.yaml
b/server/features/support/ec2/fixtures/flavors.yaml
new file mode 100644
index 0000000..7aed95f
--- /dev/null
+++ b/server/features/support/ec2/fixtures/flavors.yaml
@@ -0,0 +1,10 @@
+---
+- :region_name: us-east-1
+ :zone_name: us-east-1a
+ :zone_state: available
+- :region_name: us-east-1
+ :zone_name: us-east-1b
+ :zone_state: available
+- :region_name: us-west-1
+ :zone_name: us-west-1a
+ :zone_state: available
diff --git a/server/features/support/ec2/fixtures/images.yaml
b/server/features/support/ec2/fixtures/images.yaml
new file mode 100644
index 0000000..8d43e17
--- /dev/null
+++ b/server/features/support/ec2/fixtures/images.yaml
@@ -0,0 +1,29 @@
+---
+- :aws_owner: "522821470517"
+ :aws_image_type: machine
+ :aws_id: ami-e4b6538d
+ :aws_state: available
+ :aws_location: deltacloud-mock/testimage1
+ :aws_is_public: true
+ :aws_architecture: i386
+- :aws_owner: "522821470517"
+ :aws_image_type: machine
+ :aws_id: ami-e4b6538e
+ :aws_state: available
+ :aws_location: deltacloud-mock/testimage2
+ :aws_is_public: true
+ :aws_architecture: x86_64
+- :aws_owner: "522821470517"
+ :aws_image_type: kernel
+ :aws_id: aki-be3adfd7
+ :aws_state: available
+ :aws_location: deltacloud-mock/testimage3
+ :aws_is_public: true
+ :aws_architecture: x86_64
+- :aws_owner: "522821470517"
+ :aws_image_type: ramdisk
+ :aws_id: ari-ce34gad7
+ :aws_state: available
+ :aws_location: deltacloud-mock/testimage4
+ :aws_is_public: false
+ :aws_architecture: i386
diff --git a/server/features/support/ec2/fixtures/instances.yaml
b/server/features/support/ec2/fixtures/instances.yaml
new file mode 100644
index 0000000..1e052db
--- /dev/null
+++ b/server/features/support/ec2/fixtures/instances.yaml
@@ -0,0 +1,35 @@
+---
+- :aws_instance_id: i-123f1234
+ :aws_groups:
+ - default
+ :aws_ramdisk_id: ari-ce34gad7
+ :aws_image_id: ami-e4b6538e
+ :dns_name: domU-12-34-67-89-01-C9.usma2.compute.amazonaws.com
+ :ssh_key_name: staging
+ :aws_state_code: "16"
+ :private_dns_name: domU-12-34-67-89-01-C9.usma2.compute.amazonaws.com
+ :aws_reason: ""
+ :aws_state: running
+ :aws_launch_time: 2010-1-1T00:00:00.000Z
+ :aws_instance_type: m1.small
+ :aws_reservation_id: r-aabbccdd
+ :aws_availability_zone: us-east-1b
+ :aws_kernel_id: aki-be3adfd7
+ :aws_owner: "522821470517"
+- :aws_instance_id: i-123f1234
+ :aws_groups:
+ - default
+ :aws_ramdisk_id: ari-ce34gad7
+ :aws_image_id: ami-e4b6538d
+ :dns_name: domU-11-34-67-89-01-C9.usma2.compute.amazonaws.com
+ :ssh_key_name: staging
+ :aws_state_code: "16"
+ :private_dns_name: domU-11-34-67-89-01-C9.usma2.compute.amazonaws.com
+ :aws_reason: ""
+ :aws_state: running
+ :aws_launch_time: 2010-1-1T00:00:00.000Z
+ :aws_instance_type: m1.xlarge
+ :aws_reservation_id: r-aabbccdd
+ :aws_availability_zone: us-west-1a
+ :aws_kernel_id: aki-be3adfd7
+ :aws_owner: "522821470517"
diff --git a/server/features/support/ec2/fixtures/realms.yaml
b/server/features/support/ec2/fixtures/realms.yaml
new file mode 100644
index 0000000..7aed95f
--- /dev/null
+++ b/server/features/support/ec2/fixtures/realms.yaml
@@ -0,0 +1,10 @@
+---
+- :region_name: us-east-1
+ :zone_name: us-east-1a
+ :zone_state: available
+- :region_name: us-east-1
+ :zone_name: us-east-1b
+ :zone_state: available
+- :region_name: us-west-1
+ :zone_name: us-west-1a
+ :zone_state: available
diff --git a/server/features/support/ec2/fixtures/storage_snapshot.yaml
b/server/features/support/ec2/fixtures/storage_snapshot.yaml
new file mode 100644
index 0000000..a1e9156
--- /dev/null
+++ b/server/features/support/ec2/fixtures/storage_snapshot.yaml
@@ -0,0 +1,11 @@
+---
+- :aws_progress: 100%
+ :aws_status: completed
+ :aws_id: snap-72a5401b
+ :aws_volume_id: vol-60957009
+ :aws_started_at: "2008-02-23T02:50:48.000Z"
+- :aws_progress: 100%
+ :aws_status: completed
+ :aws_id: snap-75a5401c
+ :aws_volume_id: vol-5582673c
+ :aws_started_at: "2008-02-23T16:23:19.000Z"
diff --git a/server/features/support/ec2/fixtures/storage_volume.yaml
b/server/features/support/ec2/fixtures/storage_volume.yaml
new file mode 100644
index 0000000..6d7a0dc
--- /dev/null
+++ b/server/features/support/ec2/fixtures/storage_volume.yaml
@@ -0,0 +1,17 @@
+---
+- :aws_size: 94
+ :aws_id: vol-60957009
+ :zone: us-east-1a
+ :aws_device: /dev/sda
+ :aws_created_at: Wed Jun 18 08:19:20s UTC 2008
+ :aws_attachment_status: attached
+ :aws_instance_id: i-c014c0a9
+ :snapshot_id: i-123f1234
+ :aws_attached_at: Wed Jun 18 08:19:28 UTC 2008
+ :aws_status: in-use
+- :aws_size: 500
+ :aws_id: vol-58957031
+ :zone: us-east-1a
+ :aws_created_at: Wed Jun 18 08:19:21 UTC 2008
+ :snapshot_id: i-123f1234
+ :aws_status: available
diff --git a/server/features/support/env.rb b/server/features/support/env.rb
new file mode 100644
index 0000000..f92fcc2
--- /dev/null
+++ b/server/features/support/env.rb
@@ -0,0 +1,27 @@
+require 'sinatra'
+require 'server'
+require 'rack/test'
+
+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 = YAML::load_file(File::join('features', 'support', ENV['API_DRIVER'],
'config.yaml'))
+
+World do
+ def app
+ @app = Rack::Builder.new do
+ run Sinatra::Application
+ end
+ end
+
+ def replace_variables(str)
+ CONFIG.keys.collect { |k| str.gsub!(/\<#{k.to_s.upcase}\>/,
"#{CONFIG[k]}") }
+ return str
+ end
+
+ include Rack::Test::Methods
+end
+
diff --git a/server/features/support/mock/config.yaml
b/server/features/support/mock/config.yaml
new file mode 100644
index 0000000..c8263e6
--- /dev/null
+++ b/server/features/support/mock/config.yaml
@@ -0,0 +1,23 @@
+---
+:storage_snapshot_id: snap2
+:driver_name: mock
+:instances_count: 180
+:flavor_arch: x86_64
+:storage_snapshot_state: AVAILABLE
+:realm_id: us
+:instance_1_name: 1268827277 testing instance
+:image_owner: fedoraproject
+:storage_snapshot_count: "2"
+:realm_state: AVAILABLE
+:instance_2_name: 1268827278 testing instance
+:image_arch: i386
+:storage_volume_id: vol2
+:realm_count: 2
+:instance_image_id: img2
+:image_id: img2
+:storage_volume_state: AVAILABLE
+:flavor_id: m1-small
+:instance_realm: us
+:image_count: 3
+:storage_volume_count: 2
+:flavor_count: 5
--
1.6.6.2
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel