mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
feature #192: New test for ImagePool initialization.
This commit is contained in:
parent
9fe40f27c9
commit
518a74ad1a
@ -74,6 +74,7 @@ class ImagePoolTest : public PoolTest
|
||||
|
||||
ALL_POOLTEST_CPPUNIT_TESTS();
|
||||
|
||||
CPPUNIT_TEST ( names_initialization );
|
||||
CPPUNIT_TEST ( update );
|
||||
CPPUNIT_TEST ( get_using_name );
|
||||
CPPUNIT_TEST ( wrong_get_name );
|
||||
@ -131,6 +132,34 @@ public:
|
||||
|
||||
/* ********************************************************************* */
|
||||
|
||||
void names_initialization()
|
||||
{
|
||||
ImagePool * imp;
|
||||
Image * img;
|
||||
|
||||
// Allocate 2 users, so they are written to the DB.
|
||||
allocate(0);
|
||||
allocate(2);
|
||||
|
||||
// Create a new pool, using the same DB. This new pool should read the
|
||||
// allocated images.
|
||||
imp = new ImagePool(db, "source_prefix", "OS", "hd");
|
||||
|
||||
img = imp->get(names[0], false);
|
||||
CPPUNIT_ASSERT( img != 0 );
|
||||
|
||||
img = imp->get(names[1], false);
|
||||
CPPUNIT_ASSERT( img == 0 );
|
||||
|
||||
img = imp->get(names[2], false);
|
||||
CPPUNIT_ASSERT( img != 0 );
|
||||
|
||||
|
||||
delete imp;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void update()
|
||||
{
|
||||
@ -194,6 +223,8 @@ public:
|
||||
CPPUNIT_ASSERT( no_value == "" );
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void get_using_name()
|
||||
{
|
||||
@ -249,6 +280,8 @@ public:
|
||||
CPPUNIT_ASSERT( obj == 0 );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void duplicates()
|
||||
{
|
||||
@ -271,6 +304,9 @@ public:
|
||||
CPPUNIT_ASSERT( oid == rc );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void extra_attributes()
|
||||
{
|
||||
int oid;
|
||||
@ -295,6 +331,9 @@ public:
|
||||
CPPUNIT_ASSERT( value == "STUDENT" );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void wrong_templates()
|
||||
{
|
||||
int rc;
|
||||
@ -339,6 +378,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void target_generation()
|
||||
{
|
||||
ImagePool * imp = static_cast<ImagePool *>(pool);
|
||||
@ -439,6 +481,8 @@ public:
|
||||
delete disk;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void bus_source_assignment()
|
||||
{
|
||||
@ -491,6 +535,8 @@ public:
|
||||
delete disk;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void dump()
|
||||
{
|
||||
@ -515,6 +561,9 @@ public:
|
||||
CPPUNIT_ASSERT( result == xml_dump );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void dump_where()
|
||||
{
|
||||
ImagePool * imp = static_cast<ImagePool*>(pool);
|
||||
|
Loading…
x
Reference in New Issue
Block a user