1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Feature #938: Update zona unit tests

They now work with latest master status. Pending: add new tests.
This commit is contained in:
Hector Sanjuan 2012-02-29 14:33:59 +01:00
parent 1b21b3ba16
commit cd3978ea9c
7 changed files with 155 additions and 71 deletions

View File

@ -0,0 +1,57 @@
HOST_MONITORING_INTERVAL = 600
#HOST_PER_INTERVAL = 15
VM_POLLING_INTERVAL = 600
#VM_PER_INTERVAL = 5
#VM_DIR=/srv/cloud/one/var
SCRIPTS_REMOTE_DIR=/var/tmp/one
PORT = 2666
DB = [ backend = "sqlite" ]
VNC_BASE_PORT = 5900
DEBUG_LEVEL = 3
NETWORK_SIZE = 254
MAC_PREFIX = "02:00"
DEFAULT_IMAGE_TYPE = "OS"
DEFAULT_DEVICE_PREFIX = "hd"
IM_MAD = [ name="im_dummy", executable="one_im_dummy"]
VM_MAD = [ name="vmm_dummy", executable="one_vmm_dummy", type="xml" ]
TM_MAD = [
name = "tm_dummy",
executable = "one_tm",
arguments = "tm_dummy/tm_dummy.conf" ]
IMAGE_MAD = [
executable = "one_image",
arguments = "fs -t 15" ]
HM_MAD = [
executable = "one_hm" ]
AUTH_MAD = [
executable = "one_auth_mad",
arguments = "--authn ssh,x509,ldap,server_cipher,server_x509"
# arguments = "--authz quota --authn ssh,x509,ldap,server_cipher,server_x509"
]
SESSION_EXPIRATION_TIME = 900
VM_RESTRICTED_ATTR = "CONTEXT/FILES"
VM_RESTRICTED_ATTR = "DISK/SOURCE"
VM_RESTRICTED_ATTR = "NIC/MAC"
VM_RESTRICTED_ATTR = "NIC/VLAN_ID"
VM_RESTRICTED_ATTR = "RANK"
IMAGE_RESTRICTED_ATTR = "SOURCE"

View File

@ -1,30 +1,57 @@
#*******************************************************************************
# OpenNebula Configuration file
#*******************************************************************************
# General
HOST_MONITORING_INTERVAL = 600
#HOST_PER_INTERVAL = 15
VM_POLLING_INTERVAL = 600
#VM_PER_INTERVAL = 5
#VM_DIR=/srv/cloud/one/var
SCRIPTS_REMOTE_DIR=/var/tmp/one
PORT=2637
PORT = 2667
DB = [ backend = "sqlite" ]
VNC_BASE_PORT = 5900
DEBUG_LEVEL=3
DEBUG_LEVEL = 3
NETWORK_SIZE = 254
MAC_PREFIX = "02:00"
DEFAULT_IMAGE_TYPE = "OS"
DEFAULT_DEVICE_PREFIX = "hd"
# Dummy
IM_MAD = [ name="im_dummy", executable="one_im_dummy"]
VM_MAD = [ name="vmm_dummy",executable="one_vmm_dummy", type="xml" ]
TM_MAD = [ name="tm_dummy", executable="one_tm", arguments ="tm_dummy/tm_dummy.conf" ]
# Image
IMAGE_MAD = [ executable = "one_image", arguments = "fs -t 15" ]
VM_MAD = [ name="vmm_dummy", executable="one_vmm_dummy", type="xml" ]
# Hook
HM_MAD = [ executable = "one_hm" ]
TM_MAD = [
name = "tm_dummy",
executable = "one_tm",
arguments = "tm_dummy/tm_dummy.conf" ]
IMAGE_MAD = [
executable = "one_image",
arguments = "fs -t 15" ]
HM_MAD = [
executable = "one_hm" ]
AUTH_MAD = [
executable = "one_auth_mad",
arguments = "--authn ssh,x509,ldap,server_cipher,server_x509"
# arguments = "--authz quota --authn ssh,x509,ldap,server_cipher,server_x509"
]
SESSION_EXPIRATION_TIME = 900
VM_RESTRICTED_ATTR = "CONTEXT/FILES"
VM_RESTRICTED_ATTR = "DISK/SOURCE"
VM_RESTRICTED_ATTR = "NIC/MAC"
VM_RESTRICTED_ATTR = "NIC/VLAN_ID"
VM_RESTRICTED_ATTR = "RANK"
IMAGE_RESTRICTED_ATTR = "SOURCE"

View File

@ -33,85 +33,90 @@ module OZones
describe "oZones server regarding VDCs" do
before(:all) do
@zonehelper =
@zonehelper =
ZonesHelper.new("zone", "ozonesadmin","ozonespassword")
@vdchelper =
VDCHelper.new("vdc", "ozonesadmin","ozonespassword")
@vdchelper =
VDCHelper.new("vdc", "ozonesadmin","ozonespassword")
@clientA = OpenNebula::Client.new(File.read(
File.dirname(__FILE__)+"/../etc/one_auth_a"),
"http://localhost:2636/RPC2")
File.dirname(__FILE__)+"/../etc/one_auth_a"),
"http://localhost:2666/RPC2")
@clientB = OpenNebula::Client.new(File.read(
File.dirname(__FILE__)+"/../etc/one_auth_b"),
"http://localhost:2637/RPC2")
File.dirname(__FILE__)+"/../etc/one_auth_b"),
"http://localhost:2667/RPC2")
hostA=OpenNebula::Host.new(OpenNebula::Host.build_xml, @clientA)
hostA.allocate("hostA1","im_dummy","vmm_dummy","tm_dummy")
hostA.allocate("hostA2","im_dummy","vmm_dummy","tm_dummy")
hostA.allocate("hostA3","im_dummy","vmm_dummy","tm_dummy")
hostA.allocate("hostA4","im_dummy","vmm_dummy","tm_dummy")
hostA.allocate("hostA1","im_dummy","vmm_dummy","tm_dummy","dummy")
hostA.allocate("hostA2","im_dummy","vmm_dummy","tm_dummy","dummy")
hostA.allocate("hostA3","im_dummy","vmm_dummy","tm_dummy","dummy")
hostA.allocate("hostA4","im_dummy","vmm_dummy","tm_dummy","dummy")
hostB=OpenNebula::Host.new(OpenNebula::Host.build_xml, @clientB)
hostB.allocate("hostB1","im_dummy","vmm_dummy","tm_dummy")
hostB.allocate("hostB2","im_dummy","vmm_dummy","tm_dummy")
hostB.allocate("hostB3","im_dummy","vmm_dummy","tm_dummy")
hostB.allocate("hostB1","im_dummy","vmm_dummy","tm_dummy","dummy")
hostB.allocate("hostB2","im_dummy","vmm_dummy","tm_dummy","dummy")
hostB.allocate("hostB3","im_dummy","vmm_dummy","tm_dummy","dummy")
end
it "should be able to create a couple of zones" do
@zonehelper.create_resource(File.dirname(__FILE__)+
"/../templates/zoneA.template")[0].should eql(0)
@zonehelper.create_resource(File.dirname(__FILE__)+
"/../templates/zoneB.template")[0].should eql(0)
end
"/../templates/zoneB.template")[0].should eql(0)
end
it "should be able to create one vdc with the apropiate ONE resources" do
@vdchelper.create_resource(File.dirname(__FILE__)+
"/../templates/vdcA.template")[0].should eql(0)
"/../templates/vdcA.template",
{:force => false})[0].should eql(0)
upool = OpenNebula::UserPool.new(@clientA)
upool.info
userExist=false
upool.each{|user|
upool.each{|user|
if user['NAME'] == "vdcadminA"
userExist=true
end
}
userExist.should eql(true)
gpool = OpenNebula::GroupPool.new(@clientA)
gpool.info
groupExist=false
gpool.each{|group|
gpool.each{|group|
if group['NAME'] == "vdcA"
groupExist=true
end
}
}
groupExist.should eql(true)
apool = OpenNebula::AclPool.new(@clientA)
apool.info
# TODO check ACLs
end
it "should be able to create a couple of VDCs" do
it "should be able to create a couple of VDCs" do
@vdchelper.create_resource(File.dirname(__FILE__)+
"/../templates/vdcB.template")[0].should eql(0)
"/../templates/vdcB.template",
{:force => false})[0].should eql(0)
@vdchelper.create_resource(File.dirname(__FILE__)+
"/../templates/vdcC.template")[0].should eql(0)
end
it "should fail when creating an existing VDC" do
"/../templates/vdcC.template",
{:force => false})[0].should eql(0)
end
it "should fail when creating an existing VDC" do
@vdchelper.create_resource(File.dirname(__FILE__)+
"/../templates/vdcA.template")[0].should eql(-1)
end
it "should fail when creating a VDC upon a non existing zone" do
"/../templates/vdcA.template",
{:force => false})[0].should eql(-1)
end
it "should fail when creating a VDC upon a non existing zone" do
@vdchelper.create_resource(File.dirname(__FILE__)+
"/../templates/vdc.no.zone.template")[0].should eql(-1)
end
"/../templates/vdc.no.zone.template",
{:force => false})[0].should eql(-1)
end
end
end

View File

@ -2,4 +2,4 @@ NAME=vdcC
VDCADMINNAME=vdcadminC
VDCADMINPASS=vdcpassC
ZONEID=1
HOSTS=3
HOSTS=4

View File

@ -1,5 +1,5 @@
NAME=zoneA
ONENAME=oneadminA
ONEPASS=opennebulaA
ENDPOINT=http://localhost:2636/RPC2
SUNSENDPOINT=http://localhost:9869
ENDPOINT=http://localhost:2666/RPC2
SUNSENDPOINT=http://localhost:9869

View File

@ -1,4 +1,4 @@
NAME=zoneB
ONENAME=oneadminB
ONEPASS=opennebulaB
ENDPOINT=http://localhost:2637/RPC2
ENDPOINT=http://localhost:2667/RPC2

View File

@ -35,8 +35,7 @@ for j in `ls ./spec/*_spec.rb` ; do
OZONES_AUTH=$PWD/etc/ozones_auth ONE_LOCATION=$ONE_LOCATION_A oneA/bin/ozones-server start
sleep 5
ONE_LOCATION=$ONE_LOCATION_A spec $j -f s
ONE_LOCATION=$ONE_LOCATION_A rspec $j -f s
CODE=$?
if [ $CODE != 0 ] ; then
@ -62,8 +61,4 @@ if (($CODE == 0)); then
# Delete directories
rm -rf oneA
rm -rf oneB
fi
fi