diff --git a/install.sh b/install.sh index 5e04b90324..1e5f47b9d4 100755 --- a/install.sh +++ b/install.sh @@ -73,7 +73,7 @@ while true ; do -r) UNINSTALL="yes" ; shift ;; -l) LINK="yes" ; shift ;; -c) CLIENT="yes"; INSTALL_ETC="no" ; shift ;; - -s) SUNSTONE="yes"; INSTALL_ETC="no" ; shift ;; + -s) SUNSTONE="yes"; shift ;; -u) ONEADMIN_USER="$2" ; shift 2;; -g) ONEADMIN_GROUP="$2"; shift 2;; -d) ROOT="$2" ; shift 2 ;; @@ -320,7 +320,6 @@ INSTALL_SUNSTONE_RUBY_FILES=( INSTALL_SUNSTONE_FILES=( SUNSTONE_FILES:$SUNSTONE_LOCATION SUNSTONE_BIN_FILES:$BIN_LOCATION - SUNSTONE_ETC_FILES:$ETC_LOCATION SUNSTONE_MODELS_FILES:$SUNSTONE_LOCATION/models SUNSTONE_MODELS_JSON_FILES:$SUNSTONE_LOCATION/models/OpenNebulaJSON SUNSTONE_TEMPLATE_FILES:$SUNSTONE_LOCATION/templates @@ -337,6 +336,10 @@ INSTALL_SUNSTONE_FILES=( SUNSTONE_PUBLIC_IMAGES_FILES:$SUNSTONE_LOCATION/public/images ) +INSTALL_SUNSTONE_ETC_FILES=( + SUNSTONE_ETC_FILES:$ETC_LOCATION +) + INSTALL_ETC_FILES=( ETC_FILES:$ETC_LOCATION VMM_EC2_ETC_FILES:$ETC_LOCATION/vmm_ec2 @@ -352,7 +355,6 @@ INSTALL_ETC_FILES=( ECO_ETC_TEMPLATE_FILES:$ETC_LOCATION/ec2query_templates OCCI_ETC_FILES:$ETC_LOCATION OCCI_ETC_TEMPLATE_FILES:$ETC_LOCATION/occi_templates - SUNSTONE_ETC_FILES:$ETC_LOCATION CLI_CONF_FILES:$ETC_LOCATION/cli ) @@ -951,7 +953,14 @@ for i in ${INSTALL_SET[@]}; do done if [ "$INSTALL_ETC" = "yes" ] ; then - for i in ${INSTALL_ETC_FILES[@]}; do + if [ "$SUNSTONE" = "yes" ]; then + INSTALL_ETC_SET="${INSTALL_SUNSTONE_ETC_FILES[@]}" + else + INSTALL_ETC_SET="${INSTALL_ETC_FILES[@]} \ + ${INSTALL_SUNSTONE_ETC_FILES[@]}" + fi + + for i in ${INSTALL_ETC_SET[@]}; do SRC=$`echo $i | cut -d: -f1` DST=`echo $i | cut -d: -f2` diff --git a/src/authm_mad/test/one_usage_spec.rb b/src/authm_mad/test/one_usage_spec.rb index 3b56a344ff..1a68229128 100644 --- a/src/authm_mad/test/one_usage_spec.rb +++ b/src/authm_mad/test/one_usage_spec.rb @@ -14,6 +14,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +$: << '../' + require 'spec_common' require 'client_mock' @@ -21,7 +23,7 @@ require 'one_usage' describe "OneUsage" do before(:all) do - mock_data=YAML::load(File.read('spec/oca_vms.yaml')) + mock_data=YAML::load(File.read('oca_vms.yaml')) client=ClientMock.new(mock_data) @one_usage=OneUsage.new(client) end diff --git a/src/authm_mad/test/quota_spec.rb b/src/authm_mad/test/quota_spec.rb index 6bb1b7fc3d..7743e45622 100644 --- a/src/authm_mad/test/quota_spec.rb +++ b/src/authm_mad/test/quota_spec.rb @@ -14,6 +14,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +$: << '../' + require 'spec_common' require 'client_mock' @@ -30,7 +32,7 @@ end describe 'Quota' do before(:all) do @db=Sequel.sqlite - mock_data=YAML::load(File.read('spec/oca_vms.yaml')) + mock_data=YAML::load(File.read('oca_vms.yaml')) client=ClientMock.new(mock_data) @quota=Quota.new(@db, client) end diff --git a/src/authm_mad/test/simple_permissions_spec.rb b/src/authm_mad/test/simple_permissions_spec.rb index b2164713b5..75a63bf2b6 100644 --- a/src/authm_mad/test/simple_permissions_spec.rb +++ b/src/authm_mad/test/simple_permissions_spec.rb @@ -14,6 +14,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +$: << '../' + require 'spec_common' require 'client_mock' @@ -64,7 +66,7 @@ end describe SimplePermissions do before(:all) do @db=Sequel.sqlite - mock_data=YAML::load(File.read('spec/oca_vms.yaml')) + mock_data=YAML::load(File.read('oca_vms.yaml')) client=ClientMock.new(mock_data) @perm=SimplePermissions.new(@db, client, YAML::load(CONF)) end diff --git a/src/authm_mad/test/spec_common.rb b/src/authm_mad/test/spec_common.rb index 016ff885d1..80850db4fd 100644 --- a/src/authm_mad/test/spec_common.rb +++ b/src/authm_mad/test/spec_common.rb @@ -16,10 +16,11 @@ require 'pp' +$: << '../../oca/ruby' +$: << '..' + require 'db_helpers' -$: << '../oca/ruby' -$: << './spec' diff --git a/src/cli/one_helper.rb b/src/cli/one_helper.rb index f2972240b9..5b734fb1fa 100644 --- a/src/cli/one_helper.rb +++ b/src/cli/one_helper.rb @@ -91,7 +91,20 @@ EOT if options[:xml] return 0, pool.to_xml(true) else - format_pool(pool, options, top) + phash = pool.to_hash + rname = self.class.rname + + if phash["#{rname}_POOL"] && phash["#{rname}_POOL"]["#{rname}"] + if phash["#{rname}_POOL"]["#{rname}"].instance_of?(Array) + phash = phash["#{rname}_POOL"]["#{rname}"] + else + phash = [phash["#{rname}_POOL"]["#{rname}"]] + end + else + phash = Array.new + end + + format_pool(phash, options, top) return 0 end end @@ -138,11 +151,11 @@ EOT ######################################################################## # Id translation ######################################################################## - def uid_to_str(uid, options) + def uid_to_str(uid, options={}) rid_to_str(:users, uid, options) end - def gid_to_str(gid, options) + def gid_to_str(gid, options={}) rid_to_str(:groups, gid, options) end diff --git a/src/cli/one_helper/onegroup_helper.rb b/src/cli/one_helper/onegroup_helper.rb index 46c6ffbf60..3d3f8962ee 100644 --- a/src/cli/one_helper/onegroup_helper.rb +++ b/src/cli/one_helper/onegroup_helper.rb @@ -50,9 +50,10 @@ class OneGroupHelper < OpenNebulaHelper::OneHelper puts str % ["NAME", group.name] puts - CLIHelper.print_header(str_h1 % "USERS",false) + CLIHelper.print_header(str_h1 % "USERS", false) + CLIHelper.print_header("%-15s %-20s" % ["ID","NAME"]) group.user_ids.each do |uid| - puts str % ["ID", uid] + puts "%-15s %-20s" % [uid, self.uid_to_str(uid.to_s)] end end diff --git a/src/cli/one_helper/onehost_helper.rb b/src/cli/one_helper/onehost_helper.rb index d61bb2f21c..57f87eb873 100644 --- a/src/cli/one_helper/onehost_helper.rb +++ b/src/cli/one_helper/onehost_helper.rb @@ -25,6 +25,12 @@ class OneHostHelper < OpenNebulaHelper::OneHelper "onehost.yaml" end + def self.state_to_str(id) + id = id.to_i + state_str = Host::HOST_STATES[id] + return Host::SHORT_HOST_STATES[state_str] + end + private def factory(id=nil) @@ -83,38 +89,38 @@ class OneHostHelper < OpenNebulaHelper::OneHelper end column :RVM, "Number of Virtual Machines running", :size=>6 do |d| - d["HOST_SHARE/RUNNING_VMS"] + d["HOST_SHARE"]["RUNNING_VMS"] end column :TCPU, "Total CPU percentage", :size=>6 do |d| - d["HOST_SHARE/MAX_CPU"] + d["HOST_SHARE"]["MAX_CPU"] end column :FCPU, "Free CPU percentage", :size=>6 do |d| - d["HOST_SHARE/MAX_CPU"].to_i-d["HOST_SHARE/USED_CPU"].to_i + d["HOST_SHARE"]["MAX_CPU"].to_i-d["HOST_SHARE"]["USED_CPU"].to_i end column :ACPU, "Available cpu percentage (not reserved by VMs)", :size=>6 do |d| - max_cpu=d["HOST_SHARE/MAX_CPU"].to_i + max_cpu=d["HOST_SHARE"]["MAX_CPU"].to_i max_cpu=100 if max_cpu==0 - max_cpu-d["HOST_SHARE/CPU_USAGE"].to_i + max_cpu-d["HOST_SHARE"]["CPU_USAGE"].to_i end column :TMEM, "Total Memory", :size=>6 do |d| - OpenNebulaHelper.unit_to_str(d["HOST_SHARE/MAX_MEM"].to_i,options) + OpenNebulaHelper.unit_to_str(d["HOST_SHARE"]["MAX_MEM"].to_i,options) end column :FMEM, "Free Memory", :size=>6 do |d| - OpenNebulaHelper.unit_to_str(d["HOST_SHARE/FREE_MEM"].to_i,options) + OpenNebulaHelper.unit_to_str(d["HOST_SHARE"]["FREE_MEM"].to_i,options) end column :AMEM, "Available Memory (not reserved by VMs)", :size=>6 do |d| - acpu=d["HOST_SHARE/MAX_MEM"].to_i-d["HOST_SHARE/MEM_USAGE"].to_i + acpu=d["HOST_SHARE"]["MAX_MEM"].to_i-d["HOST_SHARE"]["MEM_USAGE"].to_i OpenNebulaHelper.unit_to_str(acpu,options) end column :STAT, "Host status", :size=>6 do |d| - d.short_state_str + OneHostHelper.state_to_str(d["STATE"]) end default :ID, :NAME, :RVM, :TCPU, :FCPU, :ACPU, :TMEM, :FMEM, :AMEM, :STAT diff --git a/src/cli/one_helper/oneimage_helper.rb b/src/cli/one_helper/oneimage_helper.rb index 4eecb8df0c..228b3d6061 100644 --- a/src/cli/one_helper/oneimage_helper.rb +++ b/src/cli/one_helper/oneimage_helper.rb @@ -25,6 +25,22 @@ class OneImageHelper < OpenNebulaHelper::OneHelper "oneimage.yaml" end + def self.persistent_to_str(str) + str.to_i==1 ? "Yes" : "No" + end + + def self.state_to_str(id) + id = id.to_i + state_str = Image::IMAGE_STATES[id] + return Image::SHORT_IMAGE_STATES[state_str] + end + + def self.type_to_str(id) + id = id.to_i + type_str = Image::IMAGE_TYPES[id] + return Image::SHORT_IMAGE_TYPES[type_str] + end + private def factory(id=nil) @@ -80,7 +96,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper end column :TYPE, "Type of the Image", :size=>4 do |d,e| - d.short_type_str + OneImageHelper.type_to_str(d["TYPE"]) end column :REGTIME, "Registration time of the Image", :size=>20 do |d| @@ -96,7 +112,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper end column :STAT, "State of the Image", :size=>4 do |d| - d.short_state_str + OneImageHelper.state_to_str(d["STATE"]) end column :RVMS, "Number of VMs currently running from this Image", :size=>5 do |d| @@ -112,10 +128,4 @@ class OneImageHelper < OpenNebulaHelper::OneHelper table.show(pool, options) end end - - private - - def self.persistent_to_str(str) - str.to_i==1 ? "Yes" : "No" - end end \ No newline at end of file diff --git a/src/cli/one_helper/oneuser_helper.rb b/src/cli/one_helper/oneuser_helper.rb index 5768aab7f5..da05bcc672 100644 --- a/src/cli/one_helper/oneuser_helper.rb +++ b/src/cli/one_helper/oneuser_helper.rb @@ -70,14 +70,15 @@ class OneUserHelper < OpenNebulaHelper::OneHelper CLIHelper.print_header(str_h1 % "USER #{user['ID']} INFORMATION") puts str % ["ID", user.id.to_s] puts str % ["NAME", user.name] - puts str % ["GROUP", user.gid] + puts str % ["MAIN_GROUP", user.gid] puts str % ["PASSWORD", user['PASSWORD']] puts str % ["ENABLED", user['ENABLED']] puts - CLIHelper.print_header(str_h1 % "SECONDARY GROUPS",false) + CLIHelper.print_header(str_h1 % "GROUPS", false) + CLIHelper.print_header("%-15s %-20s" % ["ID","NAME"]) user.group_ids.each do |gid| - puts str % ["ID", uid] + puts "%-15s %-20s" % [gid, self.gid_to_str(gid.to_s)] end end diff --git a/src/cli/one_helper/onevm_helper.rb b/src/cli/one_helper/onevm_helper.rb index 88145d5d77..83140a01ca 100644 --- a/src/cli/one_helper/onevm_helper.rb +++ b/src/cli/one_helper/onevm_helper.rb @@ -25,6 +25,20 @@ class OneVMHelper < OpenNebulaHelper::OneHelper "onevm.yaml" end + def self.state_to_str(id, lcm_id) + id = id.to_i + state_str = VirtualMachine::VM_STATE[id] + short_state_str = VirtualMachine::SHORT_VM_STATES[state_str] + + if short_state_str=="actv" + lcm_id = lcm_id.to_i + lcm_state_str = VirtualMachine::LCM_STATE[lcm_id] + return VirtualMachine::SHORT_LCM_STATES[lcm_state_str] + end + + return short_state_str + end + private def factory(id=nil) @@ -89,7 +103,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper end column :STAT, "Actual status", :size=>4 do |d,e| - d.status + OneVMHelper.state_to_str(d["STATE"], d["LCM_STATE"]) end column :CPU, "CPU percentage used by the VM", :size=>3 do |d| @@ -101,7 +115,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper end column :HOSTNAME, "Host where the VM is running", :size=>15 do |d| - d["HISTORY/HOSTNAME"] + d["HISTORY"]["HOSTNAME"] if d["HISTORY"] end column :TIME, "Time since the VM was submitted", :size=>11 do |d| diff --git a/src/cli/one_helper/onevnet_helper.rb b/src/cli/one_helper/onevnet_helper.rb index 7f1a26b4a0..85eab99b8c 100644 --- a/src/cli/one_helper/onevnet_helper.rb +++ b/src/cli/one_helper/onevnet_helper.rb @@ -25,6 +25,12 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper "onevnet.yaml" end + def self.type_to_str(id) + id = id.to_i + type_str = VirtualNetwork::VN_TYPES[id] + return VirtualNetwork::SHORT_VN_TYPES[type_str] + end + private def factory(id=nil) @@ -82,7 +88,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper end column :TYPE, "Type of Virtual Network", :size=>6 do |d| - d.type_str + OneVNetHelper.type_to_str(d["TYPE"]) end column :SIZE, "Size of the Virtual Network", :size=>6 do |d| diff --git a/src/im_mad/im_exec/one_im_exec.rb b/src/im_mad/im_exec/one_im_exec.rb index 2d14ba2767..686a346a16 100755 --- a/src/im_mad/im_exec/one_im_exec.rb +++ b/src/im_mad/im_exec/one_im_exec.rb @@ -53,7 +53,7 @@ class InformationManagerDriver < OpenNebulaDriver # Execute the run_probes in the remote host def action_monitor(number, host, do_update) - if !action_is_local?(:monitor) + if !action_is_local?(:MONITOR) if do_update == "1" # Use SCP to sync: sync_cmd = "scp -r #{@local_scripts_base_path}/. " \ @@ -65,7 +65,7 @@ class InformationManagerDriver < OpenNebulaDriver LocalCommand.run(sync_cmd, log_method(number)) end end - do_action("#{@hypervisor}", number, host, :monitor, + do_action("#{@hypervisor}", number, host, :MONITOR, :script_name => 'run_probes') end end diff --git a/src/mad/ruby/test/OpenNebulaDriver_spec.rb b/src/mad/ruby/test/OpenNebulaDriver_spec.rb index 408b907337..6b1efffce6 100644 --- a/src/mad/ruby/test/OpenNebulaDriver_spec.rb +++ b/src/mad/ruby/test/OpenNebulaDriver_spec.rb @@ -1,4 +1,5 @@ +$: << '..' require 'OpenNebulaDriver' require 'test/MonkeyPatcher' @@ -26,7 +27,7 @@ class OpenNebulaDriver def read_configuration old_one_location=ENV['ONE_LOCATION'] - ENV['ONE_LOCATION']=File.join(ENV['PWD'], 'test', 'fixtures') + ENV['ONE_LOCATION']=File.join(ENV['PWD'], 'fixtures') result=read_configuration_old ENV['ONE_LOCATION']=old_one_location result diff --git a/src/oca/ruby/OpenNebula/VirtualNetwork.rb b/src/oca/ruby/OpenNebula/VirtualNetwork.rb index 5500e3f30a..98a999ef1f 100644 --- a/src/oca/ruby/OpenNebula/VirtualNetwork.rb +++ b/src/oca/ruby/OpenNebula/VirtualNetwork.rb @@ -31,9 +31,9 @@ module OpenNebula :chown => "vn.chown" } - NETWORK_TYPES=%w{RANGED FIXED} + VN_TYPES=%w{RANGED FIXED} - SHORT_NETWORK_TYPES={ + SHORT_VN_TYPES={ "RANGED" => "R", "FIXED" => "F" } @@ -144,12 +144,12 @@ module OpenNebula # Returns the type of the Virtual Network (string value) def type_str - NETWORK_TYPES[type] + VN_TYPES[type] end # Returns the state of the Virtual Network (string value) def short_type_str - SHORT_NETWORK_TYPES[type_str] + SHORT_VN_TYPES[type_str] end private diff --git a/src/sunstone/test/examples/image/image1.json b/src/sunstone/test/examples/image/image1.json index 91354fe95c..0e8e50a675 100644 --- a/src/sunstone/test/examples/image/image1.json +++ b/src/sunstone/test/examples/image/image1.json @@ -2,6 +2,6 @@ "image": { "name": "second_image", "type": "CDROM", - "size": "512" + "path": "/etc/hosts" } -} \ No newline at end of file +} diff --git a/src/sunstone/test/spec/cluster_spec.rb b/src/sunstone/test/spec/cluster_spec.rb deleted file mode 100644 index b483b9563c..0000000000 --- a/src/sunstone/test/spec/cluster_spec.rb +++ /dev/null @@ -1,176 +0,0 @@ -# -------------------------------------------------------------------------- # -# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # -# # -# Licensed under the Apache License, Version 2.0 (the "License"); you may # -# not use this file except in compliance with the License. You may obtain # -# a copy of the License at # -# # -# http://www.apache.org/licenses/LICENSE-2.0 # -# # -# Unless required by applicable law or agreed to in writing, software # -# distributed under the License is distributed on an "AS IS" BASIS, # -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # -# See the License for the specific language governing permissions and # -# limitations under the License. # -#--------------------------------------------------------------------------- # - -require File.expand_path(File.dirname(__FILE__) + '/spec_helper') - -describe 'Cluster tests' do - before(:all) do - basic_authorize('oneadmin','opennebula') - post '/login' - last_response.status.should eql(204) - - @host0_s = File.read(EXAMPLES_PATH + '/host/host0.json') - post '/host', @host0_s - last_response.status.should eql(201) - - @cluster1_s = File.read(EXAMPLES_PATH + '/cluster/cluster1.json') - @cluster1_h = JSON.parse(@cluster1_s) - - @cluster2_s = File.read(EXAMPLES_PATH + '/cluster/cluster2.json') - @cluster2_h = JSON.parse(@cluster2_s) - - @action_addhost = File.read(EXAMPLES_PATH + '/cluster/addhost.json') - @action_rmhost = File.read(EXAMPLES_PATH + '/cluster/rmhost.json') - @wrong_action = File.read(EXAMPLES_PATH + '/error/wrong_action.json') - end - - it "should create a first cluster" do - post '/cluster', @cluster1_s - - last_response.status.should eql(201) - - json_response = JSON.parse(last_response.body) - json_response['CLUSTER']['ID'].should eql("1") - end - - it "should create a second cluster" do - post '/cluster', @cluster2_s - - last_response.status.should eql(201) - - json_response = JSON.parse(last_response.body) - json_response['CLUSTER']['ID'].should eql("2") - end - - it "should get Cluster 1 information" do - get '/cluster/1' - - last_response.status.should eql(200) - - json_response = JSON.parse(last_response.body) - json_response['CLUSTER']['NAME'].should eql(@cluster1_h['cluster']['name']) - end - - it "should add Host 0 to Cluster 1" do - post '/cluster/1/action', @action_addhost - - last_response.status.should eql(204) - end - - it "should get Host 0 information after adding it to the Cluster 1" do - get '/host/0' - - last_response.status.should eql(200) - - json_response = JSON.parse(last_response.body) - json_response['HOST']['CLUSTER'].should eql("cluster_one") - end - - it "should remove Host 0 from Cluster 1" do - post '/cluster/1/action', @action_rmhost - - last_response.status.should eql(204) - end - - it "should get Host 0 information after removing it from Cluster 1" do - get '/host/0' - - last_response.status.should eql(200) - - json_response = JSON.parse(last_response.body) - json_response['HOST']['CLUSTER'].should eql("default") - end - - it "should get Cluster 2 information" do - get '/cluster/2' - - last_response.status.should eql(200) - - json_response = JSON.parse(last_response.body) - json_response['CLUSTER']['NAME'].should eql(@cluster2_h['cluster']['name']) - end - - it "should get cluster_pool information" do - get '/cluster' - - last_response.status.should eql(200) - - json_response = JSON.parse(last_response.body) - json_response['CLUSTER_POOL']['CLUSTER'].size.should eql(3) - json_response['CLUSTER_POOL']['CLUSTER'].each do |cluster| - if cluster['ID'] == '1' - cluster['NAME'].should eql(@cluster1_h['cluster']['name']) - elsif cluster['ID'] == '2' - cluster['NAME'].should eql(@cluster2_h['cluster']['name']) - else - cluster['NAME'].should eql("default") - end - end - end - - it "should try to get Cluster 3 information and check the error, because " << - "it does not exist" do - get '/cluster/3' - - last_response.status.should eql(404) - - json_response = JSON.parse(last_response.body) - json_response['error']['message'].should_not eql(nil) - end - - it "should try to add Host 0 to Cluster 3 and check the error, because " << - "it does not exist" do - post '/cluster/3/action', @action_addhost - last_response.status.should eql(404) - - json_response = JSON.parse(last_response.body) - json_response['error']['message'].should_not eql(nil) - end - - it "should try to remove Host 0 from Cluster 3 and check the error, " << - "because it does not exist" do - post '/cluster/3/action', @action_removehost - last_response.status.should eql(404) - - json_response = JSON.parse(last_response.body) - json_response['error']['message'].should_not eql(nil) - end - - it "should try to perform a wrong action and check the error" do - post '/cluster/0/action', @wrong_action - - last_response.status.should eql(500) - - json_response = JSON.parse(last_response.body) - json_response['error']['message'].should_not eql(nil) - end - - it "should delete the Cluster 2" do - delete '/cluster/2' - - last_response.status.should eql(204) - end - - it "should try to get the deleted Cluster information and check the error" do - url = '/cluster/2' - get url - - last_response.status.should eql(404) - - json_response = JSON.parse(last_response.body) - json_response['error']['message'].should_not eql(nil) - end -end diff --git a/src/sunstone/test/spec/host_spec.rb b/src/sunstone/test/spec/host_spec.rb index f652353438..251ca45759 100644 --- a/src/sunstone/test/spec/host_spec.rb +++ b/src/sunstone/test/spec/host_spec.rb @@ -71,7 +71,6 @@ describe 'Host tests NOKOGIRI' do json_response['HOST']['IM_MAD'].should eql(@host0_h['host']['im_mad']) json_response['HOST']['VM_MAD'].should eql(@host0_h['host']['vm_mad']) json_response['HOST']['TM_MAD'].should eql(@host0_h['host']['tm_mad']) - json_response['HOST']['CLUSTER'].should eql("default") json_response['HOST']['STATE'].should eql("0") end @@ -120,7 +119,6 @@ describe 'Host tests NOKOGIRI' do json_response['HOST']['IM_MAD'].should eql(@host1_h['host']['im_mad']) json_response['HOST']['VM_MAD'].should eql(@host1_h['host']['vm_mad']) json_response['HOST']['TM_MAD'].should eql(@host1_h['host']['tm_mad']) - json_response['HOST']['CLUSTER'].should eql("default") json_response['HOST']['STATE'].should eql("0") end diff --git a/src/sunstone/test/spec/image_spec.rb b/src/sunstone/test/spec/image_spec.rb index 447d9f6613..07c94be365 100644 --- a/src/sunstone/test/spec/image_spec.rb +++ b/src/sunstone/test/spec/image_spec.rb @@ -186,55 +186,55 @@ describe 'Image tests' do json_response['IMAGE']['STATE'].should eql("1") end - ############################################################################ - # Update / Remove attr - ############################################################################ - it "should add a new attribute to Image 0" do - url = '/image/0/action' - post url, @action_update - - last_response.status.should eql(204) - end - - it "should get first Image information after adding a new attribute" do - url = '/image/0' - get url - - last_response.status.should eql(200) - - json_response = JSON.parse(last_response.body) - json_response['IMAGE']['TEMPLATE']['FOO'].should eql("mock") - end - - it "should remove an attribute from Image 0" do - url = '/image/0/action' - post url, @action_removeattr - - last_response.status.should eql(204) - end - - it "should get Image 0 information after removing an attribute" do - url = '/image/0' - get url - - last_response.status.should eql(200) - - json_response = JSON.parse(last_response.body) - json_response['IMAGE']['TEMPLATE']['FOO'].should eql(nil) - end - - - it "should get Image 1 information" do - url = '/image/1' - get url - - last_response.status.should eql(200) - - json_response = JSON.parse(last_response.body) - json_response['IMAGE']['NAME'].should eql(@image1_h['image']['name']) - json_response['IMAGE']['TYPE'].should eql("1") - json_response['IMAGE']['TEMPLATE']['SIZE'].should eql(@image1_h['image']['size']) - end +# ############################################################################ +# # Update / Remove attr +# ############################################################################ +# it "should add a new attribute to Image 0" do +# url = '/image/0/action' +# post url, @action_update +# +# last_response.status.should eql(204) +# end +# +# it "should get first Image information after adding a new attribute" do +# url = '/image/0' +# get url +# +# last_response.status.should eql(200) +# +# json_response = JSON.parse(last_response.body) +# json_response['IMAGE']['TEMPLATE']['FOO'].should eql("mock") +# end +# +# it "should remove an attribute from Image 0" do +# url = '/image/0/action' +# post url, @action_removeattr +# +# last_response.status.should eql(204) +# end +# +# it "should get Image 0 information after removing an attribute" do +# url = '/image/0' +# get url +# +# last_response.status.should eql(200) +# +# json_response = JSON.parse(last_response.body) +# json_response['IMAGE']['TEMPLATE']['FOO'].should eql(nil) +# end +# +# +# it "should get Image 1 information" do +# url = '/image/1' +# get url +# +# last_response.status.should eql(200) +# +# json_response = JSON.parse(last_response.body) +# json_response['IMAGE']['NAME'].should eql(@image1_h['image']['name']) +# json_response['IMAGE']['TYPE'].should eql("1") +# json_response['IMAGE']['TEMPLATE']['SIZE'].should eql(@image1_h['image']['size']) +# end ############################################################################ # Pool @@ -317,6 +317,7 @@ describe 'Image tests' do it "should try to get the deleted Image information and check the error" do url = '/image/1' + sleep 2 get url last_response.status.should eql(404) diff --git a/src/sunstone/test/spec/spec_helper.rb b/src/sunstone/test/spec/spec_helper.rb index 52bc72f514..5a5668bb9b 100644 --- a/src/sunstone/test/spec/spec_helper.rb +++ b/src/sunstone/test/spec/spec_helper.rb @@ -25,7 +25,7 @@ require 'rack/test' require 'json' # Load the Sinatra app -require 'one-ui' +require 'sunstone-server' # Make Rack::Test available to all spec contexts Spec::Runner.configure do |conf| diff --git a/src/sunstone/test/test.sh b/src/sunstone/test/test.sh old mode 100644 new mode 100755