def test_indexes(topology_st, create_backend): """Test creating, listing, getting, and deleting an index :id: 800f432a-52ab-4661-ac66-a2bdd9b984d78 :setup: Standalone instance :steps: 1. Add index (description) 2. Verify index was added 3. Modify index (Add type) 4. Verify index was modified 5. Modify index (Delete type) 6. Verify index was modified 7. Modify index (Add MR) 8. Verify index was modified 9. Modify index (Delete MR) 10. Verify index was modified 11. Reindex index 12. Remove index 13. Verify index was removed :expectedresults: 1. Success 2. Success 3. Success 4. Success 5. Success 6. Success 7. Success 8. Success 9. Success 10. Success 11. Success 12. Success 13. Success """ sys.stdout = io.StringIO() args = FakeArgs() args.cn = BE_NAME args.be_name = BE_NAME args.suffix = False args.nsslapd_suffix = SUFFIX args.attr = 'description' args.index_type = 'eq' args.matching_rule = None args.reindex = False args.json = False args.just_names = False args.add_type = None args.del_type = None args.add_mr = None args.del_mr = None # Add an index backend_add_index(topology_st.standalone, None, None, args) check_output("added index") # List indexes backend_list_index(topology_st.standalone, None, None, args) check_output("cn: description") # Modify index (Add type) args.add_type = ['sub'] backend_set_index(topology_st.standalone, None, None, args) args.add_type = None check_output("successfully updated") # Verify type was added args.attr = ['description'] backend_get_index(topology_st.standalone, None, None, args) check_output("nsindextype: sub") # Remove index type sub args.attr = 'description' args.del_type = ['sub'] backend_set_index(topology_st.standalone, None, None, args) args.del_type = None check_output("successfully updated") # Verify type was removed args.attr = ['description'] backend_get_index(topology_st.standalone, None, None, args) check_output("nsindextype: sub", missing=True) # Modify index (add MR) args.attr = 'description' args.add_mr = ['1.1.1.1.1.1'] backend_set_index(topology_st.standalone, None, None, args) args.add_mr = None check_output("successfully updated") # Verify MR was added args.attr = ['description'] backend_get_index(topology_st.standalone, None, None, args) check_output("nsmatchingrule: 1.1.1.1.1.1") # Modify index (delete MR) args.attr = 'description' args.del_mr = ['1.1.1.1.1.1'] backend_set_index(topology_st.standalone, None, None, args) args.del_mr = None check_output("successfully updated") # Verify MR was added args.attr = ['description'] backend_get_index(topology_st.standalone, None, None, args) check_output("nsmatchingrule: 1.1.1.1.1.1", missing=True) # Reindex index backend_reindex(topology_st.standalone, None, None, args) check_output("reindexed database") time.sleep(2) # Delete index backend_del_index(topology_st.standalone, None, None, args) check_output("deleted index") # Verify index was removed backend_list_index(topology_st.standalone, None, None, args) check_output("cn: description", missing=True)