URL: https://github.com/freeipa/freeipa/pull/5183
Author: fcami
 Title: #5183: ipatests: various enhancement to hidden replica tests
Action: opened

PR body:
"""

    ipatests: hidden replica: misc fixes
    
    Split a test in two and add additional fixes.
    

    ipatests: run freeipa-healthcheck on hidden replica
    

    ipatests: use wait_for_replication for hidden replica checks
    
    Previously, hidden replica checks were run without waiting for replication
    to complete, potentially leading to unstable behavior.
    Use wait_for_replication.
    
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/5183/head:pr5183
git checkout pr5183
From 60b3b048a3cb5b649fde0836b8c29e6d2e026053 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= <fc...@redhat.com>
Date: Thu, 8 Oct 2020 17:41:45 +0200
Subject: [PATCH 1/3] ipatests: use wait_for_replication for hidden replica
 checks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Previously, hidden replica checks were run without waiting for replication
to complete, potentially leading to unstable behavior.
Use wait_for_replication.

Fixes:
Signed-off-by: François Cami <fc...@redhat.com>
---
 ipatests/test_integration/test_replica_promotion.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py
index f0b72e1f8e..5525ddfacc 100644
--- a/ipatests/test_integration/test_replica_promotion.py
+++ b/ipatests/test_integration/test_replica_promotion.py
@@ -922,6 +922,8 @@ def test_hidden_replica_promote(self):
             self.replicas[0].hostname, '--state=enabled'
         ])
         self._check_server_role(self.replicas[0], 'enabled')
+        ldap = self.replicas[0].ldap_connect()
+        tasks.wait_for_replication(ldap)
         self._check_dnsrecords([self.master, self.replicas[0]])
         self._check_config([self.master, self.replicas[0]])
 
@@ -938,6 +940,8 @@ def test_hidden_replica_demote(self):
             self.replicas[0].hostname, '--state=hidden'
         ])
         self._check_server_role(self.replicas[0], 'hidden')
+        ldap = self.replicas[0].ldap_connect()
+        tasks.wait_for_replication(ldap)
         self._check_dnsrecords([self.master], [self.replicas[0]])
 
     def test_replica_from_hidden(self):

From 593a446e60f9ec9fb3b536b8f84da4fd1b2d17d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= <fc...@redhat.com>
Date: Thu, 8 Oct 2020 17:47:34 +0200
Subject: [PATCH 2/3] ipatests: run freeipa-healthcheck on hidden replica
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes:
Signed-off-by: François Cami <fc...@redhat.com>
---
 .../test_integration/test_replica_promotion.py   | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py
index 5525ddfacc..e0a9dd9d13 100644
--- a/ipatests/test_integration/test_replica_promotion.py
+++ b/ipatests/test_integration/test_replica_promotion.py
@@ -10,6 +10,8 @@
 
 import pytest
 
+from test_ipahealthcheck import run_healthcheck
+
 from ipatests.test_integration.base import IntegrationTest
 from ipatests.pytest_ipa.integration import tasks
 from ipatests.pytest_ipa.integration.tasks import (
@@ -17,7 +19,8 @@
 from ipatests.pytest_ipa.integration.firewall import Firewall
 from ipatests.pytest_ipa.integration.env_config import get_global_config
 from ipalib.constants import (
-    DOMAIN_LEVEL_1, IPA_CA_NICKNAME, CA_SUFFIX_NAME)
+    DOMAIN_LEVEL_1, IPA_CA_NICKNAME, CA_SUFFIX_NAME
+)
 from ipaplatform.paths import paths
 from ipapython import certdb
 from ipatests.test_integration.test_dns_locations import (
@@ -887,11 +890,20 @@ def _check_config(self, enabled=(), hidden=()):
             assert values.get(hservice, set()) == hidden
 
     def test_hidden_replica_install(self):
-        # TODO: check that all services are running on hidden replica
         self._check_server_role(self.master, 'enabled')
         self._check_server_role(self.replicas[0], 'hidden')
         self._check_dnsrecords([self.master], [self.replicas[0]])
         self._check_config([self.master], [self.replicas[0]])
+        returncode0, _unused = run_healthcheck(
+            self.master,
+            failures_only=True
+        )
+        returncode1, _unused = run_healthcheck(
+            self.replicas[0],
+            failures_only=True
+        )
+        assert returncode0 == 0
+        assert returncode1 == 0
 
     def test_hide_master_fails(self):
         # verify state

From 15a3a8b7bde2ec0e80d8b489b93e4b558bb58903 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Cami?= <fc...@redhat.com>
Date: Thu, 8 Oct 2020 18:22:29 +0200
Subject: [PATCH 3/3] ipatests: hidden replica: misc fixes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Split a test in two and add additional fixes.

Fixes:
Signed-off-by: François Cami <fc...@redhat.com>
---
 ipatests/test_integration/test_replica_promotion.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py
index e0a9dd9d13..8d53eb8716 100644
--- a/ipatests/test_integration/test_replica_promotion.py
+++ b/ipatests/test_integration/test_replica_promotion.py
@@ -936,9 +936,10 @@ def test_hidden_replica_promote(self):
         self._check_server_role(self.replicas[0], 'enabled')
         ldap = self.replicas[0].ldap_connect()
         tasks.wait_for_replication(ldap)
-        self._check_dnsrecords([self.master, self.replicas[0]])
         self._check_config([self.master, self.replicas[0]])
+        self._check_dnsrecords([self.master, self.replicas[0]])
 
+    def test_promote_twice_fails(self):
         result = self.replicas[0].run_command([
             'ipa', 'server-state',
             self.replicas[0].hostname, '--state=enabled'
@@ -954,6 +955,7 @@ def test_hidden_replica_demote(self):
         self._check_server_role(self.replicas[0], 'hidden')
         ldap = self.replicas[0].ldap_connect()
         tasks.wait_for_replication(ldap)
+        self._check_config([self.master], [self.replicas[0]])
         self._check_dnsrecords([self.master], [self.replicas[0]])
 
     def test_replica_from_hidden(self):
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org

Reply via email to