URL: https://github.com/freeipa/freeipa/pull/164
Author: mirielka
 Title: #164: Trust AD cleanup
Action: opened

PR body:
"""
Adding operations that remove test related trust information from AD machines.
Package samba-client is necessary for this operation, hence tests are skipped 
if the package is not installed.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/164/head:pr164
git checkout pr164
From 4ac9457ea602eb06e7c077b075a20b198b69ee03 Mon Sep 17 00:00:00 2001
From: Lenka Doudova <ldoud...@redhat.com>
Date: Thu, 6 Oct 2016 07:44:47 +0200
Subject: [PATCH 1/2] Tests: Provide AD cleanup for trust tests

Providing cleanup of trust information from AD machines for trusts tests.

https://fedorahosted.org/freeipa/ticket/6396
---
 ipatests/test_integration/tasks.py      | 10 ++++++++++
 ipatests/test_integration/test_trust.py |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index 6c26626..7dbde3d 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -517,6 +517,16 @@ def remove_trust_with_ad(master, ad_domain):
     range_name = ad_domain.upper() + '_id_range'
     master.run_command(['ipa', 'idrange-del', range_name])
 
+    remove_trust_info_from_ad(master, ad_domain)
+
+def remove_trust_info_from_ad(master, ad_domain):
+    # Remove record about trust from AD
+    master.run_command(['rpcclient', ad_domain,
+                        '-U\\Administrator%{}'.format(
+                            master.config.ad_admin_password),
+                        '-c', 'deletetrustdom {}'.format(master.domain.name)],
+                       raiseonerr=False)
+
 
 def configure_auth_to_local_rule(master, ad):
     """
diff --git a/ipatests/test_integration/test_trust.py b/ipatests/test_integration/test_trust.py
index 6b30338..27c0e56 100644
--- a/ipatests/test_integration/test_trust.py
+++ b/ipatests/test_integration/test_trust.py
@@ -35,6 +35,9 @@ class ADTrustBase(IntegrationTest):
 
     @classmethod
     def install(cls, mh):
+        if not cls.master.transport.file_exists('/usr/bin/rpcclient'):
+            raise nose.SkipTest("Package samba-client not available "
+                                "on {}".format(cls.master.hostname))
         super(ADTrustBase, cls).install(mh)
         cls.ad = cls.ad_domains[0].ads[0]
         cls.ad_domain = cls.ad.domain.name

From e2b5bddd08e2f5ef905199f5d692673e552e0bc1 Mon Sep 17 00:00:00 2001
From: Lenka Doudova <ldoud...@redhat.com>
Date: Fri, 14 Oct 2016 08:04:43 +0200
Subject: [PATCH 2/2] Tests: Provide AD cleanup for legacy client tests

Providing cleanup of trust information from AD machines for legacy client tests.

https://fedorahosted.org/freeipa/ticket/6396
---
 ipatests/test_integration/test_legacy_clients.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ipatests/test_integration/test_legacy_clients.py b/ipatests/test_integration/test_legacy_clients.py
index 8380e50..33958a2 100644
--- a/ipatests/test_integration/test_legacy_clients.py
+++ b/ipatests/test_integration/test_legacy_clients.py
@@ -368,6 +368,10 @@ def uninstall(cls, mh):
         cls.master.run_command(['ipa', 'user-del', 'disabledipauser'],
                                 raiseonerr=False)
 
+        # Remove information about trust from AD, if domain was defined
+        if hasattr(cls, 'ad_domain'):
+            tasks.remove_trust_info_from_ad(cls.master, cls.ad_domain)
+
         # Also unapply fixes on the legacy client, if defined
         if hasattr(cls, 'legacy_client'):
             tasks.unapply_fixes(cls.legacy_client)
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to