mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
feature #523: Updated Image tests.
This commit is contained in:
parent
b9222df0e3
commit
3566698590
@ -35,6 +35,7 @@
|
||||
#include "RequestManager.h"
|
||||
#include "HookManager.h"
|
||||
#include "AuthManager.h"
|
||||
#include "ImageManager.h"
|
||||
|
||||
class NebulaTest
|
||||
{
|
||||
@ -71,6 +72,7 @@ public:
|
||||
bool need_rm;
|
||||
bool need_hm;
|
||||
bool need_authm;
|
||||
bool need_imagem;
|
||||
|
||||
static NebulaTest * instance()
|
||||
{
|
||||
@ -132,6 +134,8 @@ public:
|
||||
virtual HookManager* create_hm(VirtualMachinePool * vmpool);
|
||||
|
||||
virtual AuthManager* create_authm(time_t timer_period);
|
||||
|
||||
virtual ImageManager* create_imagem(ImagePool * ipool);
|
||||
};
|
||||
|
||||
#endif /*NEBULA_TEST_H_*/
|
||||
|
@ -451,7 +451,7 @@ public:
|
||||
CPPUNIT_ASSERT( img != 0 );
|
||||
CPPUNIT_ASSERT( oid == 0 );
|
||||
|
||||
img->enable(true);
|
||||
img->set_state(Image::READY);
|
||||
img->disk_attribute(disk, &index, &img_type);
|
||||
|
||||
value = disk->vector_value("TARGET");
|
||||
@ -474,7 +474,7 @@ public:
|
||||
img = imp->get(oid, false);
|
||||
CPPUNIT_ASSERT( img != 0 );
|
||||
|
||||
img->enable(true);
|
||||
img->set_state(Image::READY);
|
||||
img->disk_attribute(disk, &index, &img_type);
|
||||
|
||||
value = disk->vector_value("TARGET");
|
||||
@ -496,7 +496,7 @@ public:
|
||||
img = imp->get(oid, false);
|
||||
CPPUNIT_ASSERT( img != 0 );
|
||||
|
||||
img->enable(true);
|
||||
img->set_state(Image::READY);
|
||||
img->disk_attribute(disk, &index, &img_type);
|
||||
|
||||
value = disk->vector_value("TARGET");
|
||||
@ -518,7 +518,7 @@ public:
|
||||
img = imp->get(oid, false);
|
||||
CPPUNIT_ASSERT( img != 0 );
|
||||
|
||||
img->enable(true);
|
||||
img->set_state(Image::READY);
|
||||
img->disk_attribute(disk, &index, &img_type);
|
||||
|
||||
value = disk->vector_value("TARGET");
|
||||
@ -551,7 +551,7 @@ public:
|
||||
// A disk without a BUS attribute should not have it added.
|
||||
disk = new VectorAttribute("DISK");
|
||||
|
||||
img->enable(true);
|
||||
img->set_state(Image::READY);
|
||||
rc = img->disk_attribute(disk, &index, &img_type);
|
||||
CPPUNIT_ASSERT( rc == 0 );
|
||||
|
||||
@ -565,7 +565,7 @@ public:
|
||||
"source_prefix/9ab4a4e021ee2883f57e3aeecc9e2aed7c3fa198" );
|
||||
|
||||
// clean up
|
||||
img->release_image();
|
||||
//img->release_image();
|
||||
delete disk;
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
@ -573,7 +573,7 @@ public:
|
||||
disk = new VectorAttribute("DISK");
|
||||
disk->replace("BUS", "SCSI");
|
||||
|
||||
img->enable(true);
|
||||
img->set_state(Image::READY);
|
||||
rc = img->disk_attribute(disk, &index, &img_type);
|
||||
CPPUNIT_ASSERT( rc == 0 );
|
||||
|
||||
@ -621,11 +621,11 @@ public:
|
||||
|
||||
img = imp->get(oid_0, false);
|
||||
CPPUNIT_ASSERT( img != 0 );
|
||||
img->enable(true);
|
||||
img->set_state(Image::READY);
|
||||
|
||||
img = imp->get(oid_1, false);
|
||||
CPPUNIT_ASSERT( img != 0 );
|
||||
img->enable(true);
|
||||
img->set_state(Image::READY);
|
||||
|
||||
|
||||
// Disk using image 0
|
||||
|
@ -424,6 +424,29 @@ void Nebula::start()
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Auth Manager ----
|
||||
if (tester->need_imagem)
|
||||
{
|
||||
try
|
||||
{
|
||||
imagem = tester->create_imagem(ipool);
|
||||
}
|
||||
catch (bad_alloc&)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
if (imagem != 0)
|
||||
{
|
||||
rc = imagem->start();
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
throw runtime_error("Could not start the Image Manager");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Load mads
|
||||
// -----------------------------------------------------------
|
||||
|
@ -145,3 +145,18 @@ AuthManager* NebulaTest::create_authm(time_t timer_period)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ImageManager* NebulaTest::create_imagem(ImagePool * ipool)
|
||||
{
|
||||
map<string,string> mad_value;
|
||||
VectorAttribute * mad;
|
||||
|
||||
vector<const Attribute *> im_mads;
|
||||
|
||||
mad_value.insert(make_pair("executable","one_image"));
|
||||
|
||||
mad = new VectorAttribute("HM_MAD",mad_value);
|
||||
im_mads.push_back(mad);
|
||||
|
||||
return new ImageManager(ipool,im_mads);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user