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 2012/12/13 01:59:50 UTC
[2/3] git commit: CIMI tests: some fixes for part4
CIMI tests: some fixes for part4
* restore getting the volume after creating it, since not all servers
return a body from the create request (see fe30257e)
* add XML namespace to inline XML
* accept 201 and 202 as response from create request
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/c016ab72
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/c016ab72
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/c016ab72
Branch: refs/heads/master
Commit: c016ab72e081e7b696e983c9d0c629f93ec583c0
Parents: 6f530d0
Author: David Lutterkort <lu...@redhat.com>
Authored: Tue Dec 11 15:09:33 2012 -0800
Committer: David Lutterkort <lu...@redhat.com>
Committed: Wed Dec 12 10:14:37 2012 -0800
----------------------------------------------------------------------
tests/cimi/part4_test.rb | 27 +++++++++++----------------
1 files changed, 11 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c016ab72/tests/cimi/part4_test.rb
----------------------------------------------------------------------
diff --git a/tests/cimi/part4_test.rb b/tests/cimi/part4_test.rb
index 02a8e91..07e780e 100644
--- a/tests/cimi/part4_test.rb
+++ b/tests/cimi/part4_test.rb
@@ -78,12 +78,15 @@ class AddVolumeToMachine < CIMI::Test::Spec
"</volumeTemplate>" +
"</VolumeCreate>",
:accept => fmt, :content_type => :xml)
+ resp.code.must_be_one_of [201, 202]
+ resp.location.must_be_uri
+ get resp.location
end
it "should allow creation of Volume with Config by value in XML" do
volume_add_uri = discover_uri_for("add", "volumes")
res = post(volume_add_uri,
- "<VolumeCreate>" +
+ "<VolumeCreate xmlns=\"#{CIMI::Test::CIMI_NAMESPACE}\">" +
"<name>cimi_volume_by_value_xml</name>" +
"<description>volume for testing</description>" +
"<volumeTemplate>" +
@@ -94,7 +97,7 @@ class AddVolumeToMachine < CIMI::Test::Spec
"</volumeTemplate>" +
"</VolumeCreate>",
:accept => :json, :content_type => :xml)
- res.code.must_equal 201
+ res.code.must_be_one_of [201, 202]
#cleanup
delete_uri = discover_uri_for("delete", "volumes", res.json["operations"])
res= delete(delete_uri)
@@ -109,7 +112,7 @@ class AddVolumeToMachine < CIMI::Test::Spec
'{"volumeConfig": '+
'{"type":"http://schemas.dmtf.org/cimi/1/mapped", "capacity": 1024 }}}',
:accept => :json, :content_type => :json)
- res.code.must_equal 201
+ res.code.must_be_one_of [201, 202]
#cleanup
delete_uri = discover_uri_for("delete", "volumes", res.json["operations"])
res= delete(delete_uri)
@@ -132,12 +135,6 @@ class AddVolumeToMachine < CIMI::Test::Spec
log.info("volume name: " + volume.name)
end
- it "should produce a valid create response" do
- volume
- last_response.code.must_be_one_of [201, 202]
- last_response.headers[:location].must_be_uri
- end
-
it "should have the correct resourceURI", :only => :json do
volume.wont_be_nil
last_response.json["resourceURI"].must_equal RESOURCE_URI.gsub("Create", "")
@@ -159,18 +156,16 @@ class AddVolumeToMachine < CIMI::Test::Spec
log.info(volume.location + " is the volume id")
# 4.4: Attach the new Volume to a Machine
model :machineWithVolume, :only => :xml do
- attach_uri = discover_uri_for_subcollection("add", machine.location, "volumes")
- post(attach_uri,
+ attach_uri = discover_uri_for_subcollection("add", machine.location, "volumes")
+ resp = post(attach_uri,
"<MachineVolume xmlns=\"#{CIMI::Test::CIMI_NAMESPACE}\">" +
"<initialLocation>/dev/sdf</initialLocation>" +
"<volume href=\"" + volume.location + "\"/>" +
"</MachineVolume>",
:accept => :xml, :content_type => :xml)
- end
-
- it "should have a response code equal to 201 for attaching a volume", :only => :xml do
- machineWithVolume
- last_response.code.must_equal 201
+ resp.code.must_be_one_of [201, 202]
+ resp.location.must_be_uri
+ get resp.location
end
it "should have a delete operation", :only => :xml do