Hi,

On 11/27/2015 03:26 PM, Martin Basti wrote:


On 27.11.2015 15:04, Oleg Fayans wrote:
Hi Martin,

All your suggestions were taken into account. Both patches are
updated. Thank you for your help!

On 11/26/2015 10:50 AM, Martin Basti wrote:


On 26.11.2015 10:04, Oleg Fayans wrote:
Hi Martin,

I agree to all your points but one. please, see my comment below

On 11/25/2015 07:42 PM, Martin Basti wrote:
Hi,

0) Note
Please be aware of https://fedorahosted.org/freeipa/ticket/5469 during
KRA testing

1)
Please do not use MIN and MAX_DOMAIN_LEVEL constants, this may change
over time, use DOMAIN_LEVEL_0 and DOMAIN_LEVEL_1 for domain level 0
and 1

2)
Why uninstall KRA then server, is not enough just uninstall server
which
covers KRA uninstall?

+    def teardown_method(self, method):
+        for host in self.replicas:
+            host.run_command(self.kra_uninstall, raiseonerr=False)
+            tasks.uninstall_master(host)


3)
Can be this function more generic? It should allow specify host where
KRA should be installed not just master

+    def test_kra_install_master(self):
+        self.master.run_command(self.kra_install)


4)

TestLevel0(Dummy):
Can be the test name more specific, something like
TestReplicaPromotionLevel0


5)
please remove this, the patch is on review and it will be pushed
sooner
than tests
+    @pytest.mark.xfail  # Ticket N 5455

and as I mentioned in ticket #5455, I cannot reproduce it with
ipa-kra-install, so please provide steps to reproduce if you insist
that
this still does not work as expected with KRA.

6) This is completely wrong, it removes everything that we tried to
achieve with previous patches with domain level in CI

Actually, being able to configure domain level per class is WAY more
convenient, than to always have to think which domain level is
appropriate for which particular test during jenkins job
configuration. In fact, I should have thought about it from the very
beginning. For example, in test_replica_promotion.py we have on class,
which intiates with domain level = 1, while others - with domain level
0. With config-based approach, we would have to implement a separate
step that raises domain level. Overall, I am against the approach,
when you have to remember to set certain domain level in config for
any particular test. The tests themselves should be aware of the
domain level they need.
I do not say that we should not have something that overrides settings
in from config in a particular test case, I say your patch is doing it
wrong.

I agree it is useful to have param domain_level in install_master, and
intall_topo methods,  but is cannot be MAX_DOMAIN_LEVEL by default,
because with your current patch the domain_level in config is not used
at all, it will be always MAX_DOMAIN_LEVEL

For example I want to achieve this goal:
test_vault.py, this test suite can run on domain level1 and on domain
level0, so with one test we can test 2 domain levels just with putting
domain level into config file.

I agree that with extraordinary test like replica promotion test is, we
need something that allows override the config file.

As I said bellow, domain_level default value should be None in
install_master and install_topo plugin. If domain level was specified
use the specified one, if not (value is None) use the domain level from
config file.

Agreed :)


Martin


[PATCH] Enabled setting domain_level per class derived from
TestIntegration

When I configure domain level 0 in yaml config, how is this
supposed to
get into install methods when you removed that code?

-        "--domain-level=%i" % host.config.domain_level
+        "--domain-level=%i" % domain_level


You always use MAX_DOMAIN_LEVEL in this case or whatever is
specified in
domain_level option.
I suggest to use domain_level=None, and when it is None use
'host.config.domain_level', if it is not None, use 'domain_level'

With this we can specify domain level in config file for test that can
be used for both domain levels and you can manually specify domain
level
for test that requires specific domain level.

Also this should go away

      @classmethod
      def install(cls, mh):
+        if hasattr(cls, "domain_level") and cls.master:
+            cls.master.config.domain_level = cls.domain_level
          if cls.topology is None:
              return

I do not see reason why test should override configuration in
config in
this case.

Martin

On 25.11.2015 16:44, Oleg Fayans wrote:
Hi,

Here is the updated version of the patch (more tests + fixed the
issues of the first one) + patch 0017, that implements the necessary
changes in the background code, i. e. patch 16 does not work without
patch 17

On 11/18/2015 05:20 PM, Martin Basti wrote:


On 09.11.2015 15:09, Oleg Fayans wrote:
Hi guys,

Here are first two automated testcases from this (so far
incomplete)
testplan:
http://www.freeipa.org/page/V4/Replica_Promotion/Test_plan

Testplan review is highly appreciated




PATCH 16: NACK

1)
What is the reason to add an unused parameter to 'domain_level' to
install_topo()?
Also it is good practise to add new option as the last parameter.

2)
cab you in both tests specify a domain level with constant
instead of
number literal?

3)
both test call install_topo with custom domain level, but it cannot
work
because 1)  (did you run the test?)

4)
How the test "TestLevel1" is supposed to work?
Respectively why there is call of install_topo() that installs
replica.
As this test just tests that ipa-replica-prepare is not working
anymore,
is it worth to spend 20 minutes with installing replica and then
just no
tot use it? IMO to install master in install step is enough.

Martin^2






./make-lint
************* Module ipatests.test_integration.base
ipatests/test_integration/base.py:66: [E1101(no-member),
IntegrationTest.install] Class 'IntegrationTest' has no 'domain_level'
member)
************* Module ipatests.test_integration.test_replica_promotion
ipatests/test_integration/test_replica_promotion.py:16:
[E1101(no-member), Dummy.install] Class 'Dummy' has no 'domain_level'
member)
ipatests/test_integration/test_replica_promotion.py:117:
[E1101(no-member), TestCAInstall.test_ca_install_without_replica_file]
Module 'ipatests.test_integration.tasks' has no 'setup_replica' member)


Is it so hard to run pylint before patch is posted for review?

Sorry, my bad. Fixed.

--
Oleg Fayans
Quality Engineer
FreeIPA team
RedHat.
From a0a8ac9e0f85e019d3debbacf4c77c099f943975 Mon Sep 17 00:00:00 2001
From: Oleg Fayans <ofay...@redhat.com>
Date: Fri, 27 Nov 2015 15:49:42 +0100
Subject: [PATCH] Enabled setting domain_level per class derived from
 TestIntegration

---
 ipatests/test_integration/base.py  |  9 +++++++-
 ipatests/test_integration/tasks.py | 44 +++++++++++++++++++++++++++++++-------
 2 files changed, 44 insertions(+), 9 deletions(-)

diff --git a/ipatests/test_integration/base.py b/ipatests/test_integration/base.py
index 4f57e959032a5fda0ad002fca95501da1160605b..a34c1502cf1c2a2d8ed73c05b1d706d71ac257b1 100644
--- a/ipatests/test_integration/base.py
+++ b/ipatests/test_integration/base.py
@@ -37,6 +37,7 @@ class IntegrationTest(object):
     num_ad_domains = 0
     required_extra_roles = []
     topology = None
+    domain_level = None
 
     @classmethod
     def setup_class(cls):
@@ -62,11 +63,17 @@ class IntegrationTest(object):
 
     @classmethod
     def install(cls, mh):
+        if cls.domain_level is not None:
+            domain_level = cls.domain_level
+        else:
+            domain_level = cls.master.config.domain_level
         if cls.topology is None:
             return
         else:
             tasks.install_topo(cls.topology,
-                               cls.master, cls.replicas, cls.clients)
+                               cls.master, cls.replicas,
+                               cls.clients, domain_level)
+
     @classmethod
     def teardown_class(cls):
         pass
diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index ae26444f6d267c2ea2688cb2aaab5a2059688595..4688b2471440861d390c98626a028c2a79722656 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -196,9 +196,6 @@ def unapply_fixes(host):
     restore_hostname(host)
     undo_nm_resolv_conf_settings(host)
 
-    # Clean up the test directory
-    host.run_command(['rm', '-rvf', host.config.test_dir])
-
 
 def restore_files(host):
     backupname = os.path.join(host.config.test_dir, 'file_backup')
@@ -252,7 +249,11 @@ def enable_replication_debugging(host):
                      stdin_text=logging_ldif)
 
 
-def install_master(host, setup_dns=True, setup_kra=False):
+def install_master(host, setup_dns=True,
+                   setup_kra=False,
+                   domain_level=None):
+    if domain_level is None:
+        domain_level = host.config.domain_level
     host.collect_log(paths.IPASERVER_INSTALL_LOG)
     host.collect_log(paths.IPACLIENT_INSTALL_LOG)
     inst = host.domain.realm.replace('.', '-')
@@ -267,7 +268,7 @@ def install_master(host, setup_dns=True, setup_kra=False):
         '-r', host.domain.name,
         '-p', host.config.dirman_password,
         '-a', host.config.admin_password,
-        "--domain-level=%i" % host.config.domain_level
+        "--domain-level=%i" % domain_level
     ]
 
     if setup_dns:
@@ -369,7 +370,7 @@ def install_replica(master, replica, setup_ca=True, setup_dns=False,
 
 def install_client(master, client, extra_args=()):
     client.collect_log(paths.IPACLIENT_INSTALL_LOG)
-
+    allow_sync_ptr(master)
     apply_common_fixes(client)
 
     client.run_command(['ipa-client-install', '-U',
@@ -804,13 +805,15 @@ def tree2_topo(master, replicas):
         master = replica
 
 
-def install_topo(topo, master, replicas, clients,
+def install_topo(topo, master, replicas, clients, domain_level=None,
                  skip_master=False, setup_replica_cas=True):
     """Install IPA servers and clients in the given topology"""
+    if domain_level is None:
+        domain_level = master.config.domain_level
     replicas = list(replicas)
     installed = {master}
     if not skip_master:
-        install_master(master)
+        install_master(master, domain_level=domain_level)
 
     add_a_records_for_hosts_in_master_domain(master)
 
@@ -920,3 +923,28 @@ def resolve_record(nameserver, query, rtype="SOA", retry=True, timeout=100):
             if not retry:
                 raise
         time.sleep(1)
+
+def ipa_backup(master):
+    result = master.run_command(["ipa-backup"])
+    myre = re.compile(".*Backed up to (?P<backup>.*?)\n.*")
+    matched = myre.search(result.stdout_text + result.stderr_text)
+    return matched.group("backup")
+
+def ipa_restore(master, backup_path):
+    master.run_command(["ipa-restore", "-U",
+                        "-p", master.config.dirman_password,
+                        backup_path])
+
+def install_kra(host, raiseonerr=True):
+    command = ["ipa-kra-install", "-U", "-p", host.config.dirman_password]
+    return host.run_command(command, raiseonerr=raiseonerr)
+
+def uninstall_replica(master, replica, cleanhost=False):
+    master.run_command(["ipa-replica-manage", "del", "--force",
+                        "-p", master.config.dirman_password,
+                        replica.hostname], raiseonerr=False)
+    uninstall_master(replica)
+    if cleanhost:
+        kinit_admin(master)
+        master.run_command(["ipa", "host-del", "--updatedns", replica.hostname],
+                           raiseonerr=False)
-- 
2.4.3

-- 
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