You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2012/01/03 10:40:03 UTC

svn commit: r1226719 - in /deltacloud/trunk/server/tests/cimi/features: step_definitions/volumes_steps.rb volumes.feature

Author: marios
Date: Tue Jan  3 09:40:03 2012
New Revision: 1226719

URL: http://svn.apache.org/viewvc?rev=1226719&view=rev
Log:
CIMI Adds attach/detach to Volumes cucumber tests

Modified:
    deltacloud/trunk/server/tests/cimi/features/step_definitions/volumes_steps.rb
    deltacloud/trunk/server/tests/cimi/features/volumes.feature

Modified: deltacloud/trunk/server/tests/cimi/features/step_definitions/volumes_steps.rb
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/tests/cimi/features/step_definitions/volumes_steps.rb?rev=1226719&r1=1226718&r2=1226719&view=diff
==============================================================================
--- deltacloud/trunk/server/tests/cimi/features/step_definitions/volumes_steps.rb (original)
+++ deltacloud/trunk/server/tests/cimi/features/step_definitions/volumes_steps.rb Tue Jan  3 09:40:03 2012
@@ -63,6 +63,44 @@ Then /^client should verify that this Vo
   @@retrieved_volume.capacity[:quantity].should == capacity.raw[0][1]
 end
 
+When /^client specifies a running Machine using$/ do |machine|
+  @machine_id = machine.raw[0][1]
+  authorize 'mockuser', 'mockpassword'
+  header 'Content-Type', 'application/xml'
+  get "/cimi/machines/#{@machine_id}?format=xml"
+  last_response.status.should==200
+  @@machine = Machine.from_xml(last_response.body)
+  @@machine.name.should == @machine_id
+  @@machine.state.should == "STARTED"
+end
+
+When /^client specifies the new Volume with attachment point using$/ do |attach|
+  @builder = Nokogiri::XML::Builder.new do |xml|
+    xml.VolumeAttach {
+      xml.volume( :href => @@created_volume.uri, :attachmentPoint=>attach.raw[0][1])
+    }
+  end
+end
+
+Then /^client should be able to attach the new volume to the Machine$/ do
+  authorize 'mockuser', 'mockpassword'
+  header 'Content-Type', 'application/CIMI-Machine+xml'
+  put "/cimi/machines/#{@@machine.name}/attach_volume?format=xml", @builder.to_xml
+  last_response.status.should == 200
+end
+
+When /^client should be able to detach the volume$/ do
+  authorize 'mockuser', 'mockpassword'
+  header 'Content-Type', 'application/CIMI-Machine+xml'
+  @builder = Nokogiri::XML::Builder.new do |xml|
+    xml.VolumeDetach {
+      xml.volume(:href => @@created_volume.uri)
+    }
+  end
+  put "/cimi/machines/#{@@machine.name}/detach_volume", @builder.to_xml
+  last_response.status.should == 200
+end
+
 When /^client deletes the newly created Volume$/ do
   authorize 'mockuser', 'mockpassword'
   delete "/cimi/volumes/#{@@created_volume.name}"

Modified: deltacloud/trunk/server/tests/cimi/features/volumes.feature
URL: http://svn.apache.org/viewvc/deltacloud/trunk/server/tests/cimi/features/volumes.feature?rev=1226719&r1=1226718&r2=1226719&view=diff
==============================================================================
--- deltacloud/trunk/server/tests/cimi/features/volumes.feature (original)
+++ deltacloud/trunk/server/tests/cimi/features/volumes.feature Tue Jan  3 09:40:03 2012
@@ -25,6 +25,20 @@ Scenario: Query the newly created Volume
   Then client should verify that this Volume was created correctly
     | capacity | 2 |
 
+Scenario: Attach the newly created Volume to a Machine
+  Given Cloud Entry Point URL is provided
+  And client retrieve the Cloud Entry Point
+  When client specifies a running Machine using
+    | name | inst0 |
+  And client specifies the new Volume with attachment point using
+    | attachment_point | /dev/sdc |
+  Then client should be able to attach the new volume to the Machine
+
+Scenario: Detach the newly created Volume from the Machine
+  Given Cloud Entry Point URL is provided
+  And client retrieve the Cloud Entry Point
+  Then client should be able to detach the volume
+
 Scenario: Delete the newly created Volume
   Given Cloud Entry Point URL is provided
   And client retrieve the Cloud Entry Point