From da127d44e31306b4865e682be362fd9672d8201f Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Thu, 22 Apr 2010 04:39:04 +0300 Subject: [PATCH] s4/test: schemaInfo may not to be set yet On newly provisioned Forest schemaInfo is not initially set. It should be created after firs Schema modification --- .../lib/ldb/tests/python/dsdb_schema_info.py | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/source4/lib/ldb/tests/python/dsdb_schema_info.py b/source4/lib/ldb/tests/python/dsdb_schema_info.py index 5fd0ccb73af..f0c8c14d6d2 100755 --- a/source4/lib/ldb/tests/python/dsdb_schema_info.py +++ b/source4/lib/ldb/tests/python/dsdb_schema_info.py @@ -62,18 +62,26 @@ class SchemaInfoTestCase(samba.tests.RpcInterfaceTestCase): # get DC invocation_id self.invocation_id = GUID(ldb.get_invocation_id()) + def tearDown(self): super(SchemaInfoTestCase, self).tearDown() def _getSchemaInfo(self): - schema_info_data = ldb.searchone(attribute="schemaInfo", - basedn=self.schema_dn, - expression="(objectClass=*)", - scope=SCOPE_BASE) - self.assertEqual(len(schema_info_data), 21) - schema_info = ndr_unpack(schemaInfoBlob, schema_info_data) - self.assertEqual(schema_info.marker, 0xFF) + try: + schema_info_data = ldb.searchone(attribute="schemaInfo", + basedn=self.schema_dn, + expression="(objectClass=*)", + scope=SCOPE_BASE) + self.assertEqual(len(schema_info_data), 21) + schema_info = ndr_unpack(schemaInfoBlob, schema_info_data) + self.assertEqual(schema_info.marker, 0xFF) + except KeyError: + # create default schemaInfo if + # attribute value is not created yet + schema_info = schemaInfoBlob() + schema_info.revision = 0 + schema_info.invocation_id = self.invocation_id return schema_info def _checkSchemaInfo(self, schi_before, schi_after): -- 2.34.1