This adds basic checks that PAM, DNS, and Kerberos are working before & after the backup&restore (in addition to DS, CA & IPA CLI that were there before).


--
PetrĀ³
From e9495d4c023eb99a19493c3cfbd7c259e12929f5 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pvikt...@redhat.com>
Date: Thu, 25 Sep 2014 10:11:49 +0200
Subject: [PATCH] Add additional backup & restore checks

https://fedorahosted.org/freeipa/ticket/3893
---
 .../test_integration/test_backup_and_restore.py    | 41 ++++++++++++++++++----
 1 file changed, 35 insertions(+), 6 deletions(-)

diff --git a/ipatests/test_integration/test_backup_and_restore.py b/ipatests/test_integration/test_backup_and_restore.py
index 3cf0d5d708e15a8d44e9f77c21c3ca5343c65f6a..c9b4271d40f292e26fbff3240b875f6c56620a89 100644
--- a/ipatests/test_integration/test_backup_and_restore.py
+++ b/ipatests/test_integration/test_backup_and_restore.py
@@ -65,6 +65,12 @@ def check_admin_in_cli(host):
     return result
 
 
+def check_admin_in_id(host):
+    result = host.run_command(['id', 'admin'])
+    assert 'admin' in result.stdout_text, result.stdout_text
+    return result
+
+
 def check_certs(host):
     result = host.run_command(['ipa', 'cert-find'])
     assert re.search('^Number of entries returned [1-9]\d*$',
@@ -72,20 +78,43 @@ def check_certs(host):
     return result
 
 
+def check_dns(host):
+    result = host.run_command(['host', host.hostname, 'localhost'])
+    return result
+
+
+def check_kinit(host):
+    result = host.run_command(['kinit', 'admin'],
+                              stdin_text=host.config.admin_password)
+    return result
+
+
+CHECKS = [
+    (check_admin_in_ldap, assert_entries_equal),
+    (check_admin_in_cli, assert_results_equal),
+    (check_admin_in_id, assert_results_equal),
+    (check_certs, assert_results_equal),
+    (check_dns, assert_results_equal),
+    (check_kinit, assert_results_equal),
+]
+
+
 @contextlib.contextmanager
 def restore_checker(host):
     """Check that the IPA at host works the same at context enter and exit"""
     tasks.kinit_admin(host)
 
-    admin_entry = check_admin_in_ldap(host)
-    admin_cli_result = check_admin_in_cli(host)
-    certs_output = check_certs(host)
+    results = []
+    for check, assert_func in CHECKS:
+        log.info('Storing result for %s', check)
+        results.append(check(host))
 
     yield
 
-    assert_entries_equal(admin_entry, check_admin_in_ldap(host))
-    assert_results_equal(admin_cli_result, check_admin_in_cli(host))
-    assert_results_equal(certs_output, check_certs(host))
+    for (check, assert_func), expected in zip(CHECKS, results):
+        log.info('Checking result for %s', check)
+        got = check(host)
+        assert_func(expected, got)
 
 
 def backup(host):
-- 
2.1.0

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to