Module tests.test_orphan

Functions

def create_disks_on_host(client, disk_names, request)
def create_orphaned_directories_on_host(volume, disk_paths, num_orphans)
def create_volume_with_replica_on_host(client, volume_name)
def delete_extra_disks_on_host(client, disk_names)
def delete_orphan(client, orphan_name)
def delete_orphaned_directory_on_host(directories)
def delete_orphans(client)
def generate_random_id(num_bytes)
def test_delete_orphan_after_orphaned_dir_is_deleted(client, volume_name, request)

Test the immediate deletion of orphan CRs after the orphaned replica directory is deleted 1. Create a new disk for holding valid and invalid orphaned replica directories 2. Create a volume and attach to the current node 3. Create a valid orphaned replica directories by copying the active replica directory 4. Clean up volume 5. Verify orphan list contains the orphan CR for the orphaned replica directories 6. Delete the on-disk orphaned replica directories 7. Delete the orphan CRs immediately 8. Verify orphan list is empty

def test_delete_orphans(client, volume_name, request)

Test the deletion of orphaned replica directories 1. Create a new disk holding valid and invalid orphaned replica directories 2. Create a volume and attach to the current node 3. Create multiple orphaned replica directories by copying the active replica directory 4. Clean up volume 5. Verify orphan list contains CRs for the valid orphaned replica directories 6. Delete all orphan CRs 7. Verify orphan list is empty and the orphan replica directories are deleted 8. Verify all orphaned replica directories are deleted

def test_disk_evicted(client, volume_name, request)

Test the orphan CR is deleted in background but on-disk data still exists if the disk is evicted 1. Create a new disk for holding valid and invalid orphaned replica directories 2. Create a volume and attach to the current node 3. Create a valid orphaned replica directories by copying the active replica directory 4. Clean up volume 5. Verify orphan list contains the valid orphaned replica directory 6. Evict the disk containing the orphaned replica directory 7. Verify the orphan CR is deleted in background, but the on-disk orphaned replica directory still exists 8. Set the disk scheduleable again 9. Verify the orphan CR is created again and the on-disk orphaned replica directory still exists

def test_node_evicted(client, volume_name, request)

Test the orphan CR is deleted in background but on-disk data still exists if the node is evicted 1. Create a new-disk for holding valid and invalid orphaned replica directories 2. Create a volume and attach to the current node 3. Create a valid orphaned replica directories by copying the active replica directory 4. Clean up volume 5. Verify orphan list contains the valid orphaned replica directory 6. Evict the node containing the orphaned replica directory 7. Verify the orphan CR is deleted in background, but the on-disk orphaned replica directory still exists 8. Disable node eviction 9. Verify the orphan CR is created again and the on-disk orphaned replica directory still exists

def test_orphan_auto_deletion(client, volume_name, request)

Test orphaned dirs creation and background deletion in multiple disks 1. Create a new disks for holding orphaned replica directories 2. Create a volume and attach to the current node 3. Create orphaned replica directories by copying the active replica directory 4. Clean up volume 5. Verify orphan list contains the orphan CRs for replica directories 6. Enable the orphan-auto-deletion setting 7. Verify orphan list is empty and the orphaned directory is deleted in background 8. Clean up disk

def test_orphan_creation_and_background_deletion_in_multiple_disks(client, volume_name, request)

Test orphaned dirs creation and background deletion in multiple disks 1. Create multiple new-disks for holding orphaned replica directories 2. Create a volume and attach to the current node 3. Create multiple orphaned replica directories by copying the active replica directory 4. Clean up volume 5. Verify orphan list contains the orphan CRs for replica directories 6. Delete the orphaned replica directories in background 7. Verify orphan list is empty

def test_orphan_creation_and_deletion_in_multiple_disks(client, volume_name, request)

Test orphan creation and deletion in multiple disks 1. Create multiple new-disks for holding orphaned replica directories 2. Create a volume and attach to the current node 3. Create multiple orphaned replica directories by copying the active replica directory 4. Clean up volume 5. Verify orphan list contains the orphan CRs for replica directories 6. Delete all orphaned CRs 7. Verify orphan list is empty 8. Verify orphaned replica directories are deleted

def test_orphan_with_same_orphaned_dir_name_in_another_disk(client, volume_name, request)

Test orphan creation and deletion with same orphaned dir name in another disk 1. Create a volume and attach to the current node's default disk 2. Create a new disks for holding orphaned replica directories 3. Create orphaned replica directories by copying the active replica directory 4. Clean up volume 5. Verify orphan list contains the orphan CRs for replica directories 6. Delete the orphaned replica directories 7. Verify orphan list is empty

def test_orphaned_dirs_in_duplicated_disks(client, volume_name, request)

Test orphaned dirs in duplicated disks. LH should not create a orphan CR for the orphaned dir in the deduplicate and unscheduled disk. 1. Create a new disk for holding orphaned replica directories 2. Create a folder under the new disk. This folder will be the duplicated disk. Add it to the node. 3. Create a volume and attach to the current node 4. Create multiple orphaned replica directories in the two disks by copying the active replica directory 5. Clean up volume 6. Verify orphan list only contains the orphan CRs for replica directories in the ready disk 7. Delete all orphan CRs 8. Verify orphan list is empty 9. Verify orphaned directories in the new disk are deleted 10. Verify orphaned directories in the duplicated disk are no deleted

def test_orphaned_dirs_with_wrong_naming_format(client, volume_name, request)

Test orphan CRs are not created for the orphaned directories with wrong naming formats 1. Create a new disk holding valid and invalid orphaned replica directories 2. Create a volume and then attach to the current node 3. Create one valid orphaned replica directories by copying the active replica directory 4. Create multiple invalid orphan replica directories with wrong naming format 5. Clean up volume 6. Verify orphan list only contains the orphan CR for valid orphaned replica directory 7. Clean up disk

def test_orphaned_replica_dir_missing(client, volume_name, request)

Test orphan CRs are deleted in background if the orphaned replica directories are missing 1. Create a new disk for holding valid and invalid orphaned replica directories 2. Create a volume and attach to the current node 3. Create a orphaned replica directories by copying the active replica directory 4. Clean up volume 5. Verify orphan list contains the orphan CRs for the orphaned replica directories 6. Delete the on-disk orphaned replica directories 7. Verify the orphan CR is deleted in background 8. Clean up disk

def wait_for_file_count(path, number, retry_counts=120)
def wait_for_orphan_count(client, number, retry_counts=120)