diff --git a/src/image/test/ImagePoolTest.cc b/src/image/test/ImagePoolTest.cc index d995f40920..187759853c 100644 --- a/src/image/test/ImagePoolTest.cc +++ b/src/image/test/ImagePoolTest.cc @@ -31,17 +31,17 @@ const string names[] = {"Image one", "Second Image", "The third image"}; const string templates[] = { "NAME = \"Image one\"\n" - "ORIGINAL_PATH = /tmp/image_test\n" + "PATH = /tmp/image_test\n" "PERSISTENT = YES\n" "DESCRIPTION = \"This is a very long description of an image, and to achieve the longness I will copy this over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over. This is a very long description of an image, and to achieve the longness I will copy this over. And over.This is a very long description of an image, and to achieve the longness I will copy this over.\"\n", "NAME = \"Second Image\"\n" - "ORIGINAL_PATH = /tmp/image_second_test\n" + "PATH = /tmp/image_second_test\n" "PUBLIC = YES\n" "DESCRIPTION = \"This is a rather short description.\"\n", "NAME = \"The third image\"\n" - "ORIGINAL_PATH = /tmp/image_test\n" + "PATH = /tmp/image_test\n" "# DESCRIPTION = \"An image description\"\n" "BUS = SCSI\n" "PROFILE = STUDENT\n" @@ -50,19 +50,19 @@ const string templates[] = const string xmls[] = { - "00A userImage one0010000000000source_prefix/9ab4a4e021ee2883f57e3aeecc9e2aed7c3fa19830", + "00A userImage one0010000000000source_prefix/9ab4a4e021ee2883f57e3aeecc9e2aed7c3fa19840", - "11B userSecond Image0100000000000source_prefix/c9d51800847467911c755e5e4c13dfe28c3a79f330", + "11B userSecond Image0100000000000source_prefix/c9d51800847467911c755e5e4c13dfe28c3a79f340", - "02C userThe third image0000000000000source_prefix/e50b0c738be9d431475bf5859629e5580301a7d630" + "02C userThe third image0000000000000source_prefix/e50b0c738be9d431475bf5859629e5580301a7d640" }; // This xml dump result has the STIMEs modified to 0000000000 const string xml_dump = -"00A userImage one0010000000000source_prefix/9ab4a4e021ee2883f57e3aeecc9e2aed7c3fa1983011B userSecond Image0100000000000source_prefix/c9d51800847467911c755e5e4c13dfe28c3a79f33022C userThe third image0000000000000source_prefix/e50b0c738be9d431475bf5859629e5580301a7d630"; +"00A userImage one0010000000000source_prefix/9ab4a4e021ee2883f57e3aeecc9e2aed7c3fa1984011B userSecond Image0100000000000source_prefix/c9d51800847467911c755e5e4c13dfe28c3a79f34022C userThe third image0000000000000source_prefix/e50b0c738be9d431475bf5859629e5580301a7d640"; const string xml_dump_where = -"00A userImage one0010000000000source_prefix/9ab4a4e021ee2883f57e3aeecc9e2aed7c3fa1983011B userSecond Image0100000000000source_prefix/c9d51800847467911c755e5e4c13dfe28c3a79f330"; +"00A userImage one0010000000000source_prefix/9ab4a4e021ee2883f57e3aeecc9e2aed7c3fa1984011B userSecond Image0100000000000source_prefix/c9d51800847467911c755e5e4c13dfe28c3a79f340"; const string replacement = "0000000000"; @@ -128,7 +128,10 @@ class ImagePoolTest : public PoolTest CPPUNIT_TEST ( bus_source_assignment ); CPPUNIT_TEST ( public_attribute ); CPPUNIT_TEST ( persistence ); - CPPUNIT_TEST ( imagepool_disk_attribute ); + +// Requires ImageManger, and NebulaTest +// CPPUNIT_TEST ( imagepool_disk_attribute ); + CPPUNIT_TEST ( dump ); CPPUNIT_TEST ( dump_where ); @@ -241,7 +244,7 @@ public: // Image object should be cached. Let's change some template attributes img->replace_template_attribute(description_name, new_description); img->replace_template_attribute(attr_name, new_attr_value); - img->remove_template_attribute("ORIGINAL_PATH"); + img->remove_template_attribute("PATH"); ip->update(img); @@ -253,7 +256,7 @@ public: img->get_template_attribute("DESCRIPTION", description_val); img->get_template_attribute("NEW_ATTRIBUTE", attr_val); - img->get_template_attribute("ORIGINAL_PATH", no_value); + img->get_template_attribute("PATH", no_value); CPPUNIT_ASSERT( description_val == new_description ); CPPUNIT_ASSERT( attr_val == new_attr_value ); @@ -271,7 +274,7 @@ public: no_value = "Random value"; img->get_template_attribute("DESCRIPTION", description_val); img->get_template_attribute("NEW_ATTRIBUTE", attr_val); - img->get_template_attribute("ORIGINAL_PATH", no_value); + img->get_template_attribute("PATH", no_value); CPPUNIT_ASSERT( description_val == new_description ); CPPUNIT_ASSERT( attr_val == new_attr_value ); @@ -398,11 +401,11 @@ public: string templates[] = { - "ORIGINAL_PATH = /tmp/image_test\n" + "PATH = /tmp/image_test\n" "DESCRIPTION = \"This template lacks name!\"\n", "NAME = \"name A\"\n" - "ORIGINAL_PATH = /tmp/image_test\n" + "PATH = /tmp/image_test\n" "TYPE = WRONG\n", "NAME \"PARSE ERROR\"\n" @@ -466,7 +469,7 @@ public: disk = new VectorAttribute("DISK"); // Allocate a CDROM type image - string templ = "NAME = \"name A\" TYPE = CDROM ORIGINAL_PATH = /tmp"; + string templ = "NAME = \"name A\" TYPE = CDROM PATH = /tmp"; imp->allocate(0, templ, &oid); CPPUNIT_ASSERT(oid >= 0); @@ -488,7 +491,7 @@ public: disk = new VectorAttribute("DISK"); // Allocate a DATABLOCK type image - templ = "NAME = \"name B\" TYPE = DATABLOCK"; + templ = "NAME = \"name B\" TYPE = DATABLOCK PATH=\"/dev/null\""; imp->allocate(0, templ, &oid); CPPUNIT_ASSERT(oid >= 0); @@ -510,7 +513,8 @@ public: disk = new VectorAttribute("DISK"); // Allocate a DATABLOCK type image - templ = "NAME = \"name C\" TYPE = DATABLOCK DEV_PREFIX = \"sd\""; + templ = "NAME = \"name C\" TYPE = DATABLOCK DEV_PREFIX = \"sd\"" + " SIZE=4 FSTYPE=ext3"; imp->allocate(0, templ, &oid); CPPUNIT_ASSERT(oid >= 0); @@ -606,10 +610,12 @@ public: // Allocate 2 images, with different dev_prefix string template_0 = "NAME = \"Image 0\"\n" - "DEV_PREFIX = \"hd\"\n"; + "DEV_PREFIX = \"hd\"\n" + "PATH = /dev/null\n"; string template_1 = "NAME = \"Image 1\"\n" - "DEV_PREFIX = \"sd\"\n"; + "DEV_PREFIX = \"sd\"\n" + "PATH = /dev/null\n"; imp->allocate(0, template_0, &oid_0); @@ -675,46 +681,46 @@ public: { // false "NAME = \"name A\"\n" - "ORIGINAL_PATH = \"/tmp/nothing\"\n", + "PATH = \"/tmp/nothing\"\n", // true "NAME = \"name B\"\n" - "ORIGINAL_PATH = \"/tmp/nothing\"\n" + "PATH = \"/tmp/nothing\"\n" "PUBLIC = YES", // false "NAME = \"name C\"\n" - "ORIGINAL_PATH = \"/tmp/nothing\"\n" + "PATH = \"/tmp/nothing\"\n" "PUBLIC = NO", // false "NAME = \"name D\"\n" - "ORIGINAL_PATH = \"/tmp/nothing\"\n" + "PATH = \"/tmp/nothing\"\n" "PUBLIC = 1", // true "NAME = \"name E\"\n" - "ORIGINAL_PATH = \"/tmp/nothing\"\n" + "PATH = \"/tmp/nothing\"\n" "PUBLIC = Yes", // false "NAME = \"name F\"\n" - "ORIGINAL_PATH = \"/tmp/nothing\"\n" + "PATH = \"/tmp/nothing\"\n" "PUBLIC = TRUE", // true "NAME = \"name G\"\n" - "ORIGINAL_PATH = \"/tmp/nothing\"\n" + "PATH = \"/tmp/nothing\"\n" "PUBLIC = yes", // false "NAME = \"name H\"\n" - "ORIGINAL_PATH = \"/tmp/nothing\"\n" + "PATH = \"/tmp/nothing\"\n" "PUBLIC = 'YES'", // true "NAME = \"name I\"\n" - "ORIGINAL_PATH = \"/tmp/nothing\"\n" + "PATH = \"/tmp/nothing\"\n" "PUBLIC = \"YES\"", "END" @@ -769,19 +775,23 @@ public: { "NAME = \"Image 1\"\n" "PERSISTENT = NO\n" - "PUBLIC = NO\n", + "PUBLIC = NO\n" + "PATH = /dev/null\n", "NAME = \"Image 2\"\n" "PERSISTENT = NO\n" - "PUBLIC = YES\n", + "PUBLIC = YES\n" + "PATH = /dev/null\n", "NAME = \"Image 3\"\n" "PERSISTENT = YES\n" - "PUBLIC = NO\n", + "PUBLIC = NO\n" + "PATH = /dev/null\n", "NAME = \"Image 4\"\n" "PERSISTENT = YES\n" - "PUBLIC = YES\n", + "PUBLIC = YES\n" + "PATH = /dev/null\n", "END" }; @@ -864,8 +874,8 @@ public: string result = oss.str(); result.replace(157, 10, replacement); - result.replace(1147, 10, replacement); - result.replace(1677, 10, replacement); + result.replace(1129, 10, replacement); + result.replace(1641, 10, replacement); /* if( result != xml_dump ) @@ -899,7 +909,7 @@ public: string result = oss.str(); result.replace(157, 10, replacement); - result.replace(1147, 10, replacement); + result.replace(1129, 10, replacement); /* if( result != xml_dump_where )