deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject [1/15] git commit: CIMI (machine): make sure memory is reported as an integer
Date Thu, 08 Nov 2012 17:13:51 GMT
Updated Branches:
  refs/heads/master 5423bb553 -> cc95f2598


CIMI (machine): make sure memory is reported as an integer


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/d3ebeb82
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/d3ebeb82
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/d3ebeb82

Branch: refs/heads/master
Commit: d3ebeb8242b421e3e8cb3e0e953468c66fa2eab0
Parents: 69f2107
Author: David Lutterkort <lutter@redhat.com>
Authored: Wed Nov 7 14:49:26 2012 -0800
Committer: David Lutterkort <lutter@redhat.com>
Committed: Thu Nov 8 09:11:18 2012 -0800

----------------------------------------------------------------------
 server/lib/cimi/models/machine.rb     |    2 +-
 tests/cimi/machine_collection_test.rb |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/d3ebeb82/server/lib/cimi/models/machine.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/machine.rb b/server/lib/cimi/models/machine.rb
index fbf25dd..9358c18 100644
--- a/server/lib/cimi/models/machine.rb
+++ b/server/lib/cimi/models/machine.rb
@@ -157,7 +157,7 @@ class CIMI::Model::Machine < CIMI::Model::Base
   def self.convert_instance_memory(profile, context)
     machine_conf = CIMI::Model::MachineConfiguration.find(profile.name, context)
     memory_override = profile.overrides.find { |p, v| p == :memory }
-    memory_override.nil? ? machine_conf.memory : context.to_kibibyte(memory_override[1].to_i,"MB")
+    memory_override.nil? ? machine_conf.memory.to_i : context.to_kibibyte(memory_override[1].to_i,"MB")
   end
 
   def self.convert_instance_addresses(instance)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/d3ebeb82/tests/cimi/machine_collection_test.rb
----------------------------------------------------------------------
diff --git a/tests/cimi/machine_collection_test.rb b/tests/cimi/machine_collection_test.rb
index a5ad3f4..c6b5b7b 100644
--- a/tests/cimi/machine_collection_test.rb
+++ b/tests/cimi/machine_collection_test.rb
@@ -33,4 +33,10 @@ class MachineCollectionBehavior < CIMI::Test::Spec
     machines.wont_be_nil      # Make sure we talk to the server
     last_response.json["resourceURI"].must_equal RESOURCE_URI
   end
+
+  it "should report integer values for memory" do
+    machines.entries.each do |machine|
+      machine.memory.to_s.must_match /^[0-9]+$/
+    end
+  end
 end


Mime
View raw message