Exemple #1
0
 def apply(self, inst):
     be = Backends(inst).get(self.suffix)
     indexes = be.get_indexes()
     try:
         # If it exists, return. Could be the case as we created the
         # BE and the default indexes applied now.
         indexes.get(self.attr)
         return
     except ldap.NO_SUCH_OBJECT:
         pass
     be.add_index(self.attr, self.type)
Exemple #2
0
def test_entryuuid_indexed_import_and_search(topology):
    """ Test that an ldif of entries containing entryUUID's can be indexed and searched
    correctly. As https://tools.ietf.org/html/rfc4530 states, the MR's are equality and
    ordering, so we check these are correct.

    :id: c98ee6dc-a7ee-4bd4-974d-597ea966dad9

    :setup: Standalone instance

    :steps:
        1. Import the db from the ldif
        2. EQ search for an entryuuid (match)
        3. EQ search for an entryuuid that does not exist
        4. LE search for an entryuuid lower (1 res)
        5. GE search for an entryuuid greater (1 res)
        6. LE for the 0 uuid (0 res)
        7. GE for the f uuid (0 res)
        8. export the db to ldif

    :expectedresults:
        1. Success
        2. 1 match
        3. 0 match
        4. 1 match
        5. 1 match
        6. 0 match
        7. 0 match
        8. success
    """
    # Assert that the index correctly exists.
    be = Backends(topology.standalone).get('userRoot')
    indexes = be.get_indexes()
    indexes.ensure_state(
        properties={
            'cn': 'entryUUID',
            'nsSystemIndex': 'false',
            'nsIndexType': ['eq', 'pres'],
        })
    _entryuuid_import_and_search(topology)
Exemple #3
0
def test_entryuuid_unindexed_import_and_search(topology):
    """ Test that an ldif of entries containing entryUUID's can be UNindexed searched
    correctly. As https://tools.ietf.org/html/rfc4530 states, the MR's are equality and
    ordering, so we check these are correct.

    :id: b652b54d-f009-464b-b5bd-299a33f97243

    :setup: Standalone instance

    :steps:
        1. Import the db from the ldif
        2. EQ search for an entryuuid (match)
        3. EQ search for an entryuuid that does not exist
        4. LE search for an entryuuid lower (1 res)
        5. GE search for an entryuuid greater (1 res)
        6. LE for the 0 uuid (0 res)
        7. GE for the f uuid (0 res)
        8. export the db to ldif

    :expectedresults:
        1. Success
        2. 1 match
        3. 0 match
        4. 1 match
        5. 1 match
        6. 0 match
        7. 0 match
        8. success
    """
    # Assert that the index does NOT exist for this test.
    be = Backends(topology.standalone).get('userRoot')
    indexes = be.get_indexes()
    try:
        idx = indexes.get('entryUUID')
        idx.delete()
    except ldap.NO_SUCH_OBJECT:
        # It's already not present, move along, nothing to see here.
        pass
    _entryuuid_import_and_search(topology)