mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Merge branch 'master' of git.opennebula.org:one
This commit is contained in:
commit
54d00f98c4
@ -1,8 +1,9 @@
|
||||
{
|
||||
"host": {
|
||||
"vm_mad": "vmm_dummy",
|
||||
"tm_mad": "tm_dummy",
|
||||
"name": "host_one",
|
||||
"im_mad": "im_dummy"
|
||||
"vnm_mad": "dummy",
|
||||
"cluster_id": "-1",
|
||||
"im_mad": "im_dummy",
|
||||
"name": "pepe"
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
{
|
||||
"host": {
|
||||
"vm_mad": "vmm_dummy",
|
||||
"tm_mad": "tm_dummy",
|
||||
"name": "host_two",
|
||||
"im_mad": "im_dummy"
|
||||
"vnm_mad": "dummy",
|
||||
"cluster_id": "-1",
|
||||
"im_mad": "im_dummy",
|
||||
"name": "pepe_two"
|
||||
}
|
||||
}
|
||||
|
@ -3,5 +3,6 @@
|
||||
"name": "first_image",
|
||||
"type": "OS",
|
||||
"path": "/etc/hosts"
|
||||
}
|
||||
},
|
||||
"ds_id": "1"
|
||||
}
|
||||
|
@ -3,5 +3,6 @@
|
||||
"name": "second_image",
|
||||
"type": "CDROM",
|
||||
"path": "/etc/hosts"
|
||||
}
|
||||
},
|
||||
"ds_id": "1"
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"user": {
|
||||
"name": "user_one",
|
||||
"password": "pass1"
|
||||
"password": "pass1",
|
||||
"auth_driver": "core"
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"user": {
|
||||
"name": "user_two",
|
||||
"password": "pass2"
|
||||
"password": "pass2",
|
||||
"auth_driver": "core"
|
||||
}
|
||||
}
|
@ -2,7 +2,8 @@
|
||||
"action": {
|
||||
"params": {
|
||||
"disk_id": "0",
|
||||
"image_name": "new_image"
|
||||
"image_name": "new_image",
|
||||
"type" : "OS"
|
||||
},
|
||||
"perform": "saveas"
|
||||
}
|
||||
|
4
src/sunstone/test/fixtures/host/empty.json
vendored
Normal file
4
src/sunstone/test/fixtures/host/empty.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"HOST_POOL": {
|
||||
}
|
||||
}
|
31
src/sunstone/test/fixtures/host/host0.json
vendored
Normal file
31
src/sunstone/test/fixtures/host/host0.json
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"HOST": {
|
||||
"LAST_MON_TIME": "0",
|
||||
"VN_MAD": "dummy",
|
||||
"CLUSTER_ID": "-1",
|
||||
"NAME": "pepe",
|
||||
"TEMPLATE": {
|
||||
},
|
||||
"ID": "0",
|
||||
"CLUSTER": {
|
||||
},
|
||||
"STATE": "0",
|
||||
"HOST_SHARE": {
|
||||
"USED_DISK": "0",
|
||||
"CPU_USAGE": "0",
|
||||
"DISK_USAGE": "0",
|
||||
"FREE_CPU": "0",
|
||||
"MAX_DISK": "0",
|
||||
"MEM_USAGE": "0",
|
||||
"FREE_MEM": "0",
|
||||
"MAX_CPU": "0",
|
||||
"FREE_DISK": "0",
|
||||
"USED_MEM": "0",
|
||||
"MAX_MEM": "0",
|
||||
"RUNNING_VMS": "0",
|
||||
"USED_CPU": "0"
|
||||
},
|
||||
"VM_MAD": "vmm_dummy",
|
||||
"IM_MAD": "im_dummy"
|
||||
}
|
||||
}
|
31
src/sunstone/test/fixtures/host/host1.json
vendored
Normal file
31
src/sunstone/test/fixtures/host/host1.json
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"HOST": {
|
||||
"LAST_MON_TIME": "0",
|
||||
"VN_MAD": "dummy",
|
||||
"CLUSTER_ID": "-1",
|
||||
"NAME": "pepe_two",
|
||||
"TEMPLATE": {
|
||||
},
|
||||
"ID": "1",
|
||||
"CLUSTER": {
|
||||
},
|
||||
"STATE": "0",
|
||||
"HOST_SHARE": {
|
||||
"USED_DISK": "0",
|
||||
"CPU_USAGE": "0",
|
||||
"DISK_USAGE": "0",
|
||||
"FREE_CPU": "0",
|
||||
"MAX_DISK": "0",
|
||||
"MEM_USAGE": "0",
|
||||
"FREE_MEM": "0",
|
||||
"MAX_CPU": "0",
|
||||
"FREE_DISK": "0",
|
||||
"USED_MEM": "0",
|
||||
"MAX_MEM": "0",
|
||||
"RUNNING_VMS": "0",
|
||||
"USED_CPU": "0"
|
||||
},
|
||||
"VM_MAD": "vmm_dummy",
|
||||
"IM_MAD": "im_dummy"
|
||||
}
|
||||
}
|
64
src/sunstone/test/fixtures/host/host_pool.json
vendored
Normal file
64
src/sunstone/test/fixtures/host/host_pool.json
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
{
|
||||
"HOST_POOL": {
|
||||
"HOST": [
|
||||
{
|
||||
"LAST_MON_TIME": "0",
|
||||
"VN_MAD": "dummy",
|
||||
"CLUSTER_ID": "-1",
|
||||
"NAME": "pepe",
|
||||
"TEMPLATE": {
|
||||
},
|
||||
"ID": "0",
|
||||
"CLUSTER": {
|
||||
},
|
||||
"STATE": "0",
|
||||
"HOST_SHARE": {
|
||||
"USED_DISK": "0",
|
||||
"CPU_USAGE": "0",
|
||||
"DISK_USAGE": "0",
|
||||
"FREE_CPU": "0",
|
||||
"MAX_DISK": "0",
|
||||
"MEM_USAGE": "0",
|
||||
"FREE_MEM": "0",
|
||||
"MAX_CPU": "0",
|
||||
"FREE_DISK": "0",
|
||||
"USED_MEM": "0",
|
||||
"MAX_MEM": "0",
|
||||
"RUNNING_VMS": "0",
|
||||
"USED_CPU": "0"
|
||||
},
|
||||
"VM_MAD": "vmm_dummy",
|
||||
"IM_MAD": "im_dummy"
|
||||
},
|
||||
{
|
||||
"LAST_MON_TIME": "0",
|
||||
"VN_MAD": "dummy",
|
||||
"CLUSTER_ID": "-1",
|
||||
"NAME": "pepe_two",
|
||||
"TEMPLATE": {
|
||||
},
|
||||
"ID": "1",
|
||||
"CLUSTER": {
|
||||
},
|
||||
"STATE": "0",
|
||||
"HOST_SHARE": {
|
||||
"USED_DISK": "0",
|
||||
"CPU_USAGE": "0",
|
||||
"DISK_USAGE": "0",
|
||||
"FREE_CPU": "0",
|
||||
"MAX_DISK": "0",
|
||||
"MEM_USAGE": "0",
|
||||
"FREE_MEM": "0",
|
||||
"MAX_CPU": "0",
|
||||
"FREE_DISK": "0",
|
||||
"USED_MEM": "0",
|
||||
"MAX_MEM": "0",
|
||||
"RUNNING_VMS": "0",
|
||||
"USED_CPU": "0"
|
||||
},
|
||||
"VM_MAD": "vmm_dummy",
|
||||
"IM_MAD": "im_dummy"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
37
src/sunstone/test/fixtures/image/image0.json
vendored
Normal file
37
src/sunstone/test/fixtures/image/image0.json
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"IMAGE": {
|
||||
"SIZE": "0",
|
||||
"NAME": "first_image",
|
||||
"GID": "0",
|
||||
"PERSISTENT": "0",
|
||||
"TEMPLATE": {
|
||||
"DEV_PREFIX": "hd"
|
||||
},
|
||||
"PERMISSIONS": {
|
||||
"GROUP_A": "0",
|
||||
"OWNER_M": "1",
|
||||
"GROUP_M": "0",
|
||||
"OTHER_U": "0",
|
||||
"OTHER_A": "0",
|
||||
"OTHER_M": "0",
|
||||
"OWNER_U": "1",
|
||||
"GROUP_U": "0",
|
||||
"OWNER_A": "0"
|
||||
},
|
||||
"UNAME": "oneadmin",
|
||||
"DATASTORE": "default",
|
||||
"REGTIME": "1334327590",
|
||||
"UID": "0",
|
||||
"ID": "0",
|
||||
"TYPE": "0",
|
||||
"DATASTORE_ID": "1",
|
||||
"PATH": "/etc/hosts",
|
||||
"SOURCE": {
|
||||
},
|
||||
"GNAME": "oneadmin",
|
||||
"STATE": "4",
|
||||
"FSTYPE": {
|
||||
},
|
||||
"RUNNING_VMS": "0"
|
||||
}
|
||||
}
|
37
src/sunstone/test/fixtures/image/image1.json
vendored
Normal file
37
src/sunstone/test/fixtures/image/image1.json
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"IMAGE": {
|
||||
"SIZE": "0",
|
||||
"NAME": "second_image",
|
||||
"GID": "0",
|
||||
"PERSISTENT": "0",
|
||||
"TEMPLATE": {
|
||||
"DEV_PREFIX": "hd"
|
||||
},
|
||||
"PERMISSIONS": {
|
||||
"GROUP_A": "0",
|
||||
"OWNER_M": "1",
|
||||
"GROUP_M": "0",
|
||||
"OTHER_U": "0",
|
||||
"OTHER_A": "0",
|
||||
"OTHER_M": "0",
|
||||
"OWNER_U": "1",
|
||||
"GROUP_U": "0",
|
||||
"OWNER_A": "0"
|
||||
},
|
||||
"UNAME": "oneadmin",
|
||||
"DATASTORE": "default",
|
||||
"REGTIME": "1334327590",
|
||||
"UID": "0",
|
||||
"ID": "1",
|
||||
"TYPE": "1",
|
||||
"DATASTORE_ID": "1",
|
||||
"PATH": "/etc/hosts",
|
||||
"SOURCE": {
|
||||
},
|
||||
"GNAME": "oneadmin",
|
||||
"STATE": "4",
|
||||
"FSTYPE": {
|
||||
},
|
||||
"RUNNING_VMS": "0"
|
||||
}
|
||||
}
|
76
src/sunstone/test/fixtures/image/image_pool.json
vendored
Normal file
76
src/sunstone/test/fixtures/image/image_pool.json
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"IMAGE_POOL": {
|
||||
"IMAGE": [
|
||||
{
|
||||
"SIZE": "0",
|
||||
"NAME": "first_image",
|
||||
"GID": "0",
|
||||
"PERSISTENT": "0",
|
||||
"TEMPLATE": {
|
||||
"DEV_PREFIX": "hd"
|
||||
},
|
||||
"PERMISSIONS": {
|
||||
"GROUP_A": "0",
|
||||
"OWNER_M": "1",
|
||||
"GROUP_M": "0",
|
||||
"OTHER_U": "0",
|
||||
"OTHER_A": "0",
|
||||
"OTHER_M": "0",
|
||||
"OWNER_U": "1",
|
||||
"GROUP_U": "0",
|
||||
"OWNER_A": "0"
|
||||
},
|
||||
"UNAME": "oneadmin",
|
||||
"DATASTORE": "default",
|
||||
"REGTIME": "1334327590",
|
||||
"UID": "0",
|
||||
"ID": "0",
|
||||
"TYPE": "0",
|
||||
"DATASTORE_ID": "1",
|
||||
"PATH": "/etc/hosts",
|
||||
"SOURCE": {
|
||||
},
|
||||
"GNAME": "oneadmin",
|
||||
"STATE": "4",
|
||||
"FSTYPE": {
|
||||
},
|
||||
"RUNNING_VMS": "0"
|
||||
},
|
||||
{
|
||||
"SIZE": "0",
|
||||
"NAME": "second_image",
|
||||
"GID": "0",
|
||||
"PERSISTENT": "0",
|
||||
"TEMPLATE": {
|
||||
"DEV_PREFIX": "hd"
|
||||
},
|
||||
"PERMISSIONS": {
|
||||
"GROUP_A": "0",
|
||||
"OWNER_M": "1",
|
||||
"GROUP_M": "0",
|
||||
"OTHER_U": "0",
|
||||
"OTHER_A": "0",
|
||||
"OTHER_M": "0",
|
||||
"OWNER_U": "1",
|
||||
"GROUP_U": "0",
|
||||
"OWNER_A": "0"
|
||||
},
|
||||
"UNAME": "oneadmin",
|
||||
"DATASTORE": "default",
|
||||
"REGTIME": "1334327590",
|
||||
"UID": "0",
|
||||
"ID": "1",
|
||||
"TYPE": "1",
|
||||
"DATASTORE_ID": "1",
|
||||
"PATH": "/etc/hosts",
|
||||
"SOURCE": {
|
||||
},
|
||||
"GNAME": "oneadmin",
|
||||
"STATE": "4",
|
||||
"FSTYPE": {
|
||||
},
|
||||
"RUNNING_VMS": "0"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
41
src/sunstone/test/fixtures/network/network0.json
vendored
Normal file
41
src/sunstone/test/fixtures/network/network0.json
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"VNET": {
|
||||
"PHYDEV": {
|
||||
},
|
||||
"VLAN_ID": {
|
||||
},
|
||||
"BRIDGE": "vbr1",
|
||||
"CLUSTER_ID": "-1",
|
||||
"NAME": "ranged_vnet",
|
||||
"GID": "0",
|
||||
"TEMPLATE": {
|
||||
"NETWORK_MASK": "255.255.255.0"
|
||||
},
|
||||
"TOTAL_LEASES": "0",
|
||||
"PERMISSIONS": {
|
||||
"GROUP_A": "0",
|
||||
"OWNER_M": "1",
|
||||
"GROUP_M": "0",
|
||||
"OTHER_U": "0",
|
||||
"OTHER_A": "0",
|
||||
"OTHER_M": "0",
|
||||
"OWNER_U": "1",
|
||||
"GROUP_U": "0",
|
||||
"OWNER_A": "0"
|
||||
},
|
||||
"UNAME": "oneadmin",
|
||||
"UID": "0",
|
||||
"ID": "0",
|
||||
"TYPE": "0",
|
||||
"CLUSTER": {
|
||||
},
|
||||
"LEASES": {
|
||||
},
|
||||
"VLAN": "0",
|
||||
"GNAME": "oneadmin",
|
||||
"RANGE": {
|
||||
"IP_END": "10.0.0.254",
|
||||
"IP_START": "10.0.0.1"
|
||||
}
|
||||
}
|
||||
}
|
51
src/sunstone/test/fixtures/network/network1.json
vendored
Normal file
51
src/sunstone/test/fixtures/network/network1.json
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"VNET": {
|
||||
"PHYDEV": {
|
||||
},
|
||||
"VLAN_ID": {
|
||||
},
|
||||
"BRIDGE": "vbr2",
|
||||
"CLUSTER_ID": "-1",
|
||||
"NAME": "fixed_vnet",
|
||||
"GID": "0",
|
||||
"TEMPLATE": {
|
||||
"NETWORK_ADDRESS": "10.0.1.0"
|
||||
},
|
||||
"TOTAL_LEASES": "0",
|
||||
"PERMISSIONS": {
|
||||
"GROUP_A": "0",
|
||||
"OWNER_M": "1",
|
||||
"GROUP_M": "0",
|
||||
"OTHER_U": "0",
|
||||
"OTHER_A": "0",
|
||||
"OTHER_M": "0",
|
||||
"OWNER_U": "1",
|
||||
"GROUP_U": "0",
|
||||
"OWNER_A": "0"
|
||||
},
|
||||
"UNAME": "oneadmin",
|
||||
"UID": "0",
|
||||
"ID": "1",
|
||||
"TYPE": "1",
|
||||
"CLUSTER": {
|
||||
},
|
||||
"LEASES": {
|
||||
"LEASE": [
|
||||
{
|
||||
"MAC": "02:00:0a:00:01:01",
|
||||
"VID": "-1",
|
||||
"IP": "10.0.1.1",
|
||||
"USED": "0"
|
||||
},
|
||||
{
|
||||
"MAC": "02:00:0a:00:01:02",
|
||||
"VID": "-1",
|
||||
"IP": "10.0.1.2",
|
||||
"USED": "0"
|
||||
}
|
||||
]
|
||||
},
|
||||
"VLAN": "0",
|
||||
"GNAME": "oneadmin"
|
||||
}
|
||||
}
|
76
src/sunstone/test/fixtures/network/network_pool.json
vendored
Normal file
76
src/sunstone/test/fixtures/network/network_pool.json
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"VNET_POOL": {
|
||||
"VNET": [
|
||||
{
|
||||
"PHYDEV": {
|
||||
},
|
||||
"VLAN_ID": {
|
||||
},
|
||||
"BRIDGE": "vbr1",
|
||||
"CLUSTER_ID": "-1",
|
||||
"NAME": "ranged_vnet",
|
||||
"GID": "0",
|
||||
"TEMPLATE": {
|
||||
"NETWORK_MASK": "255.255.255.0"
|
||||
},
|
||||
"TOTAL_LEASES": "0",
|
||||
"PERMISSIONS": {
|
||||
"GROUP_A": "0",
|
||||
"OWNER_M": "1",
|
||||
"GROUP_M": "0",
|
||||
"OTHER_U": "0",
|
||||
"OTHER_A": "0",
|
||||
"OTHER_M": "0",
|
||||
"OWNER_U": "1",
|
||||
"GROUP_U": "0",
|
||||
"OWNER_A": "0"
|
||||
},
|
||||
"UNAME": "oneadmin",
|
||||
"UID": "0",
|
||||
"ID": "0",
|
||||
"TYPE": "0",
|
||||
"CLUSTER": {
|
||||
},
|
||||
"VLAN": "0",
|
||||
"GNAME": "oneadmin",
|
||||
"RANGE": {
|
||||
"IP_END": "10.0.0.254",
|
||||
"IP_START": "10.0.0.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"PHYDEV": {
|
||||
},
|
||||
"VLAN_ID": {
|
||||
},
|
||||
"BRIDGE": "vbr2",
|
||||
"CLUSTER_ID": "-1",
|
||||
"NAME": "fixed_vnet",
|
||||
"GID": "0",
|
||||
"TEMPLATE": {
|
||||
"NETWORK_ADDRESS": "10.0.1.0"
|
||||
},
|
||||
"TOTAL_LEASES": "0",
|
||||
"PERMISSIONS": {
|
||||
"GROUP_A": "0",
|
||||
"OWNER_M": "1",
|
||||
"GROUP_M": "0",
|
||||
"OTHER_U": "0",
|
||||
"OTHER_A": "0",
|
||||
"OTHER_M": "0",
|
||||
"OWNER_U": "1",
|
||||
"GROUP_U": "0",
|
||||
"OWNER_A": "0"
|
||||
},
|
||||
"UNAME": "oneadmin",
|
||||
"UID": "0",
|
||||
"ID": "1",
|
||||
"TYPE": "1",
|
||||
"CLUSTER": {
|
||||
},
|
||||
"VLAN": "0",
|
||||
"GNAME": "oneadmin"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -36,42 +36,33 @@ describe 'Host tests NOKOGIRI' do
|
||||
it "should get empty host_pool information" do
|
||||
get '/host'
|
||||
|
||||
last_response.body.should eql(File.read(FIXTURES_PATH + '/host/empty.json'))
|
||||
last_response.status.should eql(200)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['HOST_POOL'].empty?.should eql(true)
|
||||
#json_response = JSON.parse(last_response.body)
|
||||
#json_response['HOST_POOL'].empty?.should eql(true)
|
||||
end
|
||||
|
||||
it "should create a first host" do
|
||||
post '/host', @host0_s
|
||||
|
||||
last_response.body.should eql(File.read(FIXTURES_PATH + '/host/host0.json'))
|
||||
last_response.status.should eql(201)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['HOST']['ID'].should eql("0")
|
||||
end
|
||||
|
||||
it "should create a second host" do
|
||||
post '/host', @host1_s
|
||||
|
||||
last_response.body.should eql(File.read(FIXTURES_PATH + '/host/host1.json'))
|
||||
last_response.status.should eql(201)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['HOST']['ID'].should eql("1")
|
||||
end
|
||||
|
||||
it "should get host 0 information" do
|
||||
url = '/host/0'
|
||||
get url
|
||||
|
||||
last_response.body.should eql(File.read(FIXTURES_PATH + '/host/host0.json'))
|
||||
last_response.status.should eql(200)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['HOST']['NAME'].should eql(@host0_h['host']['name'])
|
||||
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']['STATE'].should eql("0")
|
||||
end
|
||||
|
||||
it "should disable host 0" do
|
||||
@ -112,36 +103,15 @@ describe 'Host tests NOKOGIRI' do
|
||||
url = '/host/1'
|
||||
get url
|
||||
|
||||
last_response.body.should eql(File.read(FIXTURES_PATH + '/host/host1.json'))
|
||||
last_response.status.should eql(200)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['HOST']['NAME'].should eql(@host1_h['host']['name'])
|
||||
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']['STATE'].should eql("0")
|
||||
end
|
||||
|
||||
it "should get host_pool information" do
|
||||
get '/host'
|
||||
|
||||
last_response.body.should eql(File.read(FIXTURES_PATH + '/host/host_pool.json'))
|
||||
last_response.status.should eql(200)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['HOST_POOL']['HOST'].size.should eql(2)
|
||||
json_response['HOST_POOL']['HOST'].each do |host|
|
||||
if host['ID'] == '0'
|
||||
host['NAME'].should eql(@host0_h['host']['name'])
|
||||
host['IM_MAD'].should eql(@host0_h['host']['im_mad'])
|
||||
host['VM_MAD'].should eql(@host0_h['host']['vm_mad'])
|
||||
host['TM_MAD'].should eql(@host0_h['host']['tm_mad'])
|
||||
elsif host['ID'] == '1'
|
||||
host['NAME'].should eql(@host1_h['host']['name'])
|
||||
host['IM_MAD'].should eql(@host1_h['host']['im_mad'])
|
||||
host['VM_MAD'].should eql(@host1_h['host']['vm_mad'])
|
||||
host['TM_MAD'].should eql(@host1_h['host']['tm_mad'])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "should try to get host 3 information and check the error, because " <<
|
||||
|
@ -46,33 +46,32 @@ describe 'Image tests' do
|
||||
it "should create a first Image" do
|
||||
post '/image', @image0_s
|
||||
|
||||
last_response.status.should eql(201)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['IMAGE']['ID'].should eql("0")
|
||||
File.open(FIXTURES_PATH + '/image/image0.json', 'w') { |f|
|
||||
f.write last_response.body
|
||||
}
|
||||
|
||||
last_response.body.should eql(File.read(FIXTURES_PATH + '/image/image0.json'))
|
||||
last_response.status.should eql(201)
|
||||
end
|
||||
|
||||
it "should create a second Image" do
|
||||
post '/image', @image1_s
|
||||
|
||||
last_response.status.should eql(201)
|
||||
File.open(FIXTURES_PATH + '/image/image1.json', 'w') { |f|
|
||||
f.write last_response.body
|
||||
}
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['IMAGE']['ID'].should eql("1")
|
||||
last_response.body.should eql(File.read(FIXTURES_PATH + '/image/image1.json'))
|
||||
last_response.status.should eql(201)
|
||||
end
|
||||
|
||||
it "should get Image 0 information" do
|
||||
url = '/image/0'
|
||||
get url
|
||||
|
||||
last_response.body.should eql(File.read(FIXTURES_PATH + '/image/image0.json'))
|
||||
last_response.status.should eql(200)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['IMAGE']['NAME'].should eql(@image0_h['image']['name'])
|
||||
json_response['IMAGE']['TYPE'].should eql("0")
|
||||
json_response['IMAGE']['TEMPLATE']['PATH'].should eql(@image0_h['image']['path'])
|
||||
json_response['IMAGE']['PUBLIC'].should eql("0")
|
||||
json_response['IMAGE']['PERSISTENT'].should eql("0")
|
||||
end
|
||||
|
||||
############################################################################
|
||||
@ -89,10 +88,9 @@ describe 'Image tests' do
|
||||
url = '/image/0'
|
||||
get url
|
||||
|
||||
last_response.status.should eql(200)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['IMAGE']['PUBLIC'].should eql("1")
|
||||
json_response['IMAGE']['PERMISSIONS']['GROUP_U'].should eql("1")
|
||||
last_response.status.should eql(200)
|
||||
end
|
||||
|
||||
it "should unpublish Image 0" do
|
||||
@ -106,10 +104,9 @@ describe 'Image tests' do
|
||||
url = '/image/0'
|
||||
get url
|
||||
|
||||
last_response.status.should eql(200)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['IMAGE']['PUBLIC'].should eql("0")
|
||||
json_response['IMAGE']['PERMISSIONS']['GROUP_U'].should eql("0")
|
||||
last_response.status.should eql(200)
|
||||
end
|
||||
|
||||
############################################################################
|
||||
@ -152,39 +149,39 @@ describe 'Image tests' do
|
||||
############################################################################
|
||||
# Disable / Enable
|
||||
############################################################################
|
||||
it "should disable Image 0" do
|
||||
url = '/image/0/action'
|
||||
post url, @action_disable
|
||||
|
||||
last_response.status.should eql(204)
|
||||
end
|
||||
|
||||
it "should Image 0 information after disabling it" do
|
||||
url = '/image/0'
|
||||
get url
|
||||
|
||||
last_response.status.should eql(200)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['IMAGE']['STATE'].should eql("3")
|
||||
end
|
||||
|
||||
it "should enable Image 0" do
|
||||
url = '/image/0/action'
|
||||
post url, @action_enable
|
||||
|
||||
last_response.status.should eql(204)
|
||||
end
|
||||
|
||||
it "should get Image 0 information after enabling it" do
|
||||
url = '/image/0'
|
||||
get url
|
||||
|
||||
last_response.status.should eql(200)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['IMAGE']['STATE'].should eql("1")
|
||||
end
|
||||
# it "should disable Image 0" do
|
||||
# url = '/image/0/action'
|
||||
# post url, @action_disable
|
||||
#
|
||||
# last_response.status.should eql(204)
|
||||
# end
|
||||
#
|
||||
# it "should Image 0 information after disabling it" do
|
||||
# url = '/image/0'
|
||||
# get url
|
||||
#
|
||||
# last_response.status.should eql(200)
|
||||
#
|
||||
# json_response = JSON.parse(last_response.body)
|
||||
# json_response['IMAGE']['STATE'].should eql("3")
|
||||
# end
|
||||
#
|
||||
# it "should enable Image 0" do
|
||||
# url = '/image/0/action'
|
||||
# post url, @action_enable
|
||||
#
|
||||
# last_response.status.should eql(204)
|
||||
# end
|
||||
#
|
||||
# it "should get Image 0 information after enabling it" do
|
||||
# url = '/image/0'
|
||||
# get url
|
||||
#
|
||||
# last_response.status.should eql(200)
|
||||
#
|
||||
# json_response = JSON.parse(last_response.body)
|
||||
# json_response['IMAGE']['STATE'].should eql("1")
|
||||
# end
|
||||
|
||||
# ############################################################################
|
||||
# # Update / Remove attr
|
||||
@ -242,25 +239,12 @@ describe 'Image tests' do
|
||||
it "should get image_pool information" do
|
||||
get '/image'
|
||||
|
||||
last_response.status.should eql(200)
|
||||
File.open(FIXTURES_PATH + '/image/image_pool.json', 'w') { |f|
|
||||
f.write last_response.body
|
||||
}
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['IMAGE_POOL']['IMAGE'].size.should eql(2)
|
||||
json_response['IMAGE_POOL']['IMAGE'].each do |image|
|
||||
if image['ID'] == '0'
|
||||
image['NAME'].should eql(@image0_h['image']['name'])
|
||||
image['TYPE'].should eql("0")
|
||||
image['TEMPLATE']['PATH'].should eql(@image0_h['image']['path'])
|
||||
image['PUBLIC'].should eql("0")
|
||||
image['PERSISTENT'].should eql("0")
|
||||
elsif image['ID'] == '1'
|
||||
image['NAME'].should eql(@image1_h['image']['name'])
|
||||
image['TYPE'].should eql("1")
|
||||
image['TEMPLATE']['SIZE'].should eql(@image1_h['image']['size'])
|
||||
image['PUBLIC'].should eql("0")
|
||||
image['PERSISTENT'].should eql("0")
|
||||
end
|
||||
end
|
||||
last_response.body.should eql(File.read(FIXTURES_PATH + '/image/image_pool.json'))
|
||||
last_response.status.should eql(200)
|
||||
end
|
||||
|
||||
############################################################################
|
||||
|
@ -15,12 +15,13 @@
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
EXAMPLES_PATH = File.join(File.dirname(__FILE__),'../examples')
|
||||
FIXTURES_PATH = File.join(File.dirname(__FILE__),'../fixtures')
|
||||
ONEUI_LIB_LOCATION = File.join(File.dirname(__FILE__), '..', '..')
|
||||
$: << ONEUI_LIB_LOCATION
|
||||
|
||||
# Load the testing libraries
|
||||
require 'rubygems'
|
||||
require 'spec'
|
||||
require 'rspec'
|
||||
require 'rack/test'
|
||||
require 'json'
|
||||
|
||||
|
@ -39,7 +39,7 @@ describe 'User tests' do
|
||||
last_response.status.should eql(201)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['USER']['ID'].should eql("1")
|
||||
json_response['USER']['ID'].should eql("2")
|
||||
end
|
||||
|
||||
it "should create a second User" do
|
||||
@ -48,11 +48,11 @@ describe 'User tests' do
|
||||
last_response.status.should eql(201)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['USER']['ID'].should eql("2")
|
||||
json_response['USER']['ID'].should eql("3")
|
||||
end
|
||||
|
||||
it "should get User 1 information" do
|
||||
url = '/user/1'
|
||||
url = '/user/2'
|
||||
get url
|
||||
|
||||
last_response.status.should eql(200)
|
||||
@ -64,14 +64,14 @@ describe 'User tests' do
|
||||
end
|
||||
|
||||
it "should change User 1 password" do
|
||||
url = '/user/1/action'
|
||||
url = '/user/2/action'
|
||||
post url, @action_passwd
|
||||
|
||||
last_response.status.should eql(204)
|
||||
end
|
||||
|
||||
it "should get User 1 information after changing its password" do
|
||||
url = '/user/1'
|
||||
url = '/user/2'
|
||||
get url
|
||||
|
||||
last_response.status.should eql(200)
|
||||
@ -83,7 +83,7 @@ describe 'User tests' do
|
||||
end
|
||||
|
||||
it "should get User 2 information" do
|
||||
url = '/user/2'
|
||||
url = '/user/3'
|
||||
get url
|
||||
|
||||
last_response.status.should eql(200)
|
||||
@ -100,13 +100,13 @@ describe 'User tests' do
|
||||
last_response.status.should eql(200)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['USER_POOL']['USER'].size.should eql(3)
|
||||
json_response['USER_POOL']['USER'].size.should eql(4)
|
||||
json_response['USER_POOL']['USER'].each do |user|
|
||||
if user['ID'] == '1'
|
||||
if user['ID'] == '2'
|
||||
user['NAME'].should eql(@user1_h['user']['name'])
|
||||
password = Digest::SHA1.hexdigest(@action_passwd_h['action']['params']['password'])
|
||||
user['PASSWORD'].should eql(password)
|
||||
elsif user['ID'] == '2'
|
||||
elsif user['ID'] == '3'
|
||||
user['NAME'].should eql(@user2_h['user']['name'])
|
||||
password = Digest::SHA1.hexdigest(@user2_h['user']['password'])
|
||||
user['PASSWORD'].should eql(password)
|
||||
@ -116,7 +116,7 @@ describe 'User tests' do
|
||||
|
||||
it "should try to get User 3 information and check the error, because " <<
|
||||
"it does not exist" do
|
||||
get '/user/3'
|
||||
get '/user/4'
|
||||
|
||||
last_response.status.should eql(404)
|
||||
|
||||
@ -126,7 +126,7 @@ describe 'User tests' do
|
||||
|
||||
it "should try to change password of User 3 and check the error, because " <<
|
||||
"it does not exist" do
|
||||
post '/user/3/action', @action_passwd
|
||||
post '/user/4/action', @action_passwd
|
||||
last_response.status.should eql(404)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
@ -143,14 +143,14 @@ describe 'User tests' do
|
||||
end
|
||||
|
||||
it "should delete User 2" do
|
||||
url = '/user/2'
|
||||
url = '/user/3'
|
||||
delete url
|
||||
|
||||
last_response.status.should eql(204)
|
||||
end
|
||||
|
||||
it "should try to get the deleted User information and check the error" do
|
||||
url = '/user/2'
|
||||
url = '/user/3'
|
||||
get url
|
||||
|
||||
last_response.status.should eql(404)
|
||||
|
@ -127,26 +127,26 @@ describe 'VirtualMachine tests' do
|
||||
############################################################################
|
||||
# Saveas
|
||||
############################################################################
|
||||
it "should prepare the VirtualMachine 0 disk to be saved" do
|
||||
url = '/vm/0/action'
|
||||
post url, @action_saveas
|
||||
|
||||
last_response.status.should eql(204)
|
||||
end
|
||||
|
||||
it "should get VirtualMachine 0 information after saveas action" do
|
||||
url = '/vm/0'
|
||||
get url
|
||||
|
||||
last_response.status.should eql(200)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['VM']['STATE'].should eql("3")
|
||||
json_response['VM']['NAME'].should eql(@vm0_h['vm']['name'])
|
||||
json_response['VM']['TEMPLATE']['CPU'].should eql(@vm0_h['vm']['cpu'])
|
||||
json_response['VM']['TEMPLATE']['MEMORY'].should eql(@vm0_h['vm']['memory'])
|
||||
json_response['VM']['TEMPLATE']['DISK']["SAVE_AS"].should eql("0")
|
||||
end
|
||||
#it "should prepare the VirtualMachine 0 disk to be saved" do
|
||||
# url = '/vm/0/action'
|
||||
# post url, @action_saveas
|
||||
#
|
||||
# last_response.status.should eql(204)
|
||||
#end
|
||||
#
|
||||
#it "should get VirtualMachine 0 information after saveas action" do
|
||||
# url = '/vm/0'
|
||||
# get url
|
||||
#
|
||||
# last_response.status.should eql(200)
|
||||
#
|
||||
# json_response = JSON.parse(last_response.body)
|
||||
# json_response['VM']['STATE'].should eql("3")
|
||||
# json_response['VM']['NAME'].should eql(@vm0_h['vm']['name'])
|
||||
# json_response['VM']['TEMPLATE']['CPU'].should eql(@vm0_h['vm']['cpu'])
|
||||
# json_response['VM']['TEMPLATE']['MEMORY'].should eql(@vm0_h['vm']['memory'])
|
||||
# json_response['VM']['TEMPLATE']['DISK']["SAVE_AS"].should eql("0")
|
||||
#end
|
||||
|
||||
############################################################################
|
||||
# Stop
|
||||
|
@ -64,15 +64,12 @@ describe 'VirtualNetwork tests' do
|
||||
url = '/vnet/0'
|
||||
get url
|
||||
|
||||
last_response.status.should eql(200)
|
||||
File.open(FIXTURES_PATH + '/network/network0.json', 'w') { |f|
|
||||
f.write last_response.body
|
||||
}
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['VNET']['NAME'].should eql(@ranged_vnet_h['vnet']['name'])
|
||||
json_response['VNET']['TYPE'].should eql("0")
|
||||
json_response['VNET']['BRIDGE'].should eql(@ranged_vnet_h['vnet']['bridge'])
|
||||
json_response['VNET']['TEMPLATE']['NETWORK_SIZE'].should eql(@ranged_vnet_h['vnet']['network_size'])
|
||||
json_response['VNET']['TEMPLATE']['NETWORK_ADDRESS'].should eql(@ranged_vnet_h['vnet']['network_address'])
|
||||
json_response['VNET']['PUBLIC'].should eql("0")
|
||||
last_response.body.should eql(File.read(FIXTURES_PATH + '/network/network0.json'))
|
||||
last_response.status.should eql(200)
|
||||
end
|
||||
|
||||
it "should publish VirtualNetwork 0" do
|
||||
@ -89,7 +86,7 @@ describe 'VirtualNetwork tests' do
|
||||
last_response.status.should eql(200)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['VNET']['PUBLIC'].should eql("1")
|
||||
json_response['VNET']['PERMISSIONS']['GROUP_U'].should eql("1")
|
||||
end
|
||||
|
||||
it "should unpublish VirtualNetwork 0" do
|
||||
@ -106,7 +103,7 @@ describe 'VirtualNetwork tests' do
|
||||
last_response.status.should eql(200)
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['VNET']['PUBLIC'].should eql("0")
|
||||
json_response['VNET']['PERMISSIONS']['GROUP_U'].should eql("0")
|
||||
end
|
||||
|
||||
|
||||
@ -114,39 +111,23 @@ describe 'VirtualNetwork tests' do
|
||||
url = '/vnet/1'
|
||||
get url
|
||||
|
||||
last_response.status.should eql(200)
|
||||
File.open(FIXTURES_PATH + '/network/network1.json', 'w') { |f|
|
||||
f.write last_response.body
|
||||
}
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['VNET']['NAME'].should eql(@fixed_vnet_h['vnet']['name'])
|
||||
json_response['VNET']['TYPE'].should eql("1")
|
||||
json_response['VNET']['BRIDGE'].should eql(@fixed_vnet_h['vnet']['bridge'])
|
||||
json_response['VNET']['TEMPLATE']['NETWORK_ADDRESS'].should eql(@fixed_vnet_h['vnet']['network_address'])
|
||||
json_response['VNET']['PUBLIC'].should eql("0")
|
||||
last_response.body.should eql(File.read(FIXTURES_PATH + '/network/network1.json'))
|
||||
last_response.status.should eql(200)
|
||||
end
|
||||
|
||||
it "should get vnet_pool information" do
|
||||
get '/vnet'
|
||||
|
||||
last_response.status.should eql(200)
|
||||
File.open(FIXTURES_PATH + '/network/network_pool.json', 'w') { |f|
|
||||
f.write last_response.body
|
||||
}
|
||||
|
||||
json_response = JSON.parse(last_response.body)
|
||||
json_response['VNET_POOL']['VNET'].size.should eql(2)
|
||||
json_response['VNET_POOL']['VNET'].each do |vnet|
|
||||
if vnet['ID'] == '0'
|
||||
vnet['NAME'].should eql(@ranged_vnet_h['vnet']['name'])
|
||||
vnet['TYPE'].should eql("0")
|
||||
vnet['BRIDGE'].should eql(@ranged_vnet_h['vnet']['bridge'])
|
||||
vnet['TEMPLATE']['NETWORK_SIZE'].should eql(@ranged_vnet_h['vnet']['network_size'])
|
||||
vnet['TEMPLATE']['NETWORK_ADDRESS'].should eql(@ranged_vnet_h['vnet']['network_address'])
|
||||
vnet['PUBLIC'].should eql("0")
|
||||
elsif vnet['ID'] == '1'
|
||||
vnet['NAME'].should eql(@fixed_vnet_h['vnet']['name'])
|
||||
vnet['TYPE'].should eql("1")
|
||||
vnet['BRIDGE'].should eql(@fixed_vnet_h['vnet']['bridge'])
|
||||
vnet['TEMPLATE']['NETWORK_ADDRESS'].should eql(@fixed_vnet_h['vnet']['network_address'])
|
||||
vnet['PUBLIC'].should eql("0")
|
||||
end
|
||||
end
|
||||
last_response.body.should eql(File.read(FIXTURES_PATH + '/network/network_pool.json'))
|
||||
last_response.status.should eql(200)
|
||||
end
|
||||
|
||||
it "should try to get VirtualNetwork 3 information and check the error, because " <<
|
||||
|
@ -32,9 +32,10 @@ for j in `ls ./spec/*_spec.rb` ; do
|
||||
PID=$$
|
||||
|
||||
oned -f &
|
||||
sleep 2s;
|
||||
sleep 1
|
||||
until grep 'Auth Manager loaded' ${VAR_LOCATION}/oned.log; do sleep 1; done
|
||||
|
||||
spec $j -f s
|
||||
rspec $j -f s
|
||||
CODE=$?
|
||||
|
||||
pkill -P $PID oned
|
||||
|
Loading…
x
Reference in New Issue
Block a user