From a7168658210c85e746c6bb2d1a0be9b546702677 Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud Date: Sep 23 2019 09:53:52 +0000 Subject: ipatests: ensure that backup/restore restores pkcs 11 modules config file In the test_backup_and_restore, add a new test: - before backup, save the content of /etc/pkcs11/modules/softhsm2.module - after restore, ensure the file is present with the same content. Related: https://pagure.io/freeipa/issue/8073 Reviewed-By: Rob Crittenden Reviewed-By: Rob Crittenden --- diff --git a/ipatests/test_integration/test_backup_and_restore.py b/ipatests/test_integration/test_backup_and_restore.py index 5bad40f..369de29 100644 --- a/ipatests/test_integration/test_backup_and_restore.py +++ b/ipatests/test_integration/test_backup_and_restore.py @@ -116,6 +116,17 @@ def check_custodia_files(host): return True +def check_pkcs11_modules(host): + """regression test for https://pagure.io/freeipa/issue/8073""" + # Return a dictionary with key = filename, value = file content + # containing all the PKCS11 modules modified by the installer + result = dict() + for filename in platformtasks.get_pkcs11_modules(): + assert host.transport.file_exists(filename) + result[filename] = host.get_file_contents(filename) + return result + + CHECKS = [ (check_admin_in_ldap, assert_entries_equal), (check_admin_in_cli, assert_results_equal), @@ -123,7 +134,8 @@ CHECKS = [ (check_certs, assert_results_equal), (check_dns, assert_results_equal), (check_kinit, assert_results_equal), - (check_custodia_files, assert_deepequal) + (check_custodia_files, assert_deepequal), + (check_pkcs11_modules, assert_deepequal) ]