Hi Martin. Now I have this client installation thing sorted out. The
test works as expected

On 06/30/2016 02:57 PM, Martin Basti wrote:
> 
> 
> On 30.06.2016 14:40, Oleg Fayans wrote:
>> Hi Martin,
>>
>> Attached is a new version of the patch with two test cases separated.
>>
>> On 06/29/2016 12:23 PM, Martin Basti wrote:
>>>
>>> On 29.06.2016 10:56, Oleg Fayans wrote:
>>>>
>>> Hello,
>>>
>>> +        assert_error(result,
>>> +                     "Failed to verify that %s is an IPA Server" %
>>> +                     self.master.hostname)
>>>
>>>
>>> I would expect this error there:
>>>
>>> "Cannot promote this client to a replica. Local domain '{local}' does
>>> not match IPA domain '{ipadomain}'. "
>> Right, that's what this ticket is about:
>> https://fedorahosted.org/freeipa/ticket/6006
>>
>> Once these changes are implemented, we can update this test
> 
> Wat?
> 
> You get exactly the right message from ipa-replica-install, tested,
> reviewed by several people.
>>
>>> You should not use random REALM, in this case you don't test domains but
>>> realms. You can leave the test with incorrect realm there, but as
>>> separated testcase
>> Oh, ok. But it does not seem possible to setup client providing only
>> --realm without --domain: installer would not do it.
>>
> 
> Try to read again: "should not use *random* REALM". Nothing prevents you
> to use, --realm=TEST.REALM --domain=random-blah-domain
>>
>>> Martin^2
>>>
>>>
>>
>>
> 
> NACK
> 
> +    domain_name = 'exxample.test'
> +    realm_name = domain_name.upper()
> 
> you still use random realm name, and you still don't test
> ipa-replica-install, that ticket has nothing related to domain in
> ipa-client-install, it is related to replica promotion
> 
> Martin^2

-- 
Oleg Fayans
Quality Engineer
FreeIPA team
RedHat.
From 056105d13fda655469d7a9c8ca2526a09ae31373 Mon Sep 17 00:00:00 2001
From: Oleg Fayans <ofay...@redhat.com>
Date: Fri, 1 Jul 2016 14:33:06 +0200
Subject: [PATCH] Test for incorrect client domain

https://fedorahosted.org/freeipa/ticket/5976
---
 .../test_integration/test_replica_promotion.py     | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/ipatests/test_integration/test_replica_promotion.py b/ipatests/test_integration/test_replica_promotion.py
index 1f683b6d5c067ec526b307eea1460cafbadb80cb..1d72d08120a874eb93976d48b8b062bc28d64a0a 100644
--- a/ipatests/test_integration/test_replica_promotion.py
+++ b/ipatests/test_integration/test_replica_promotion.py
@@ -377,3 +377,53 @@ class TestOldReplicaWorksAfterDomainUpgrade(IntegrationTest):
         result1 = self.master.run_command(['ipa', 'user-show', self.username],
                                           raiseonerr=False)
         assert_error(result1, "%s: user not found" % self.username, 2)
+
+
+class TestWrongClientDomain(IntegrationTest):
+    topology = "star"
+    num_clients = 1
+    domain_name = 'exxample.test'
+    realm_name = domain_name.upper()
+
+    @classmethod
+    def install(cls, mh):
+        tasks.install_master(cls.master, domain_level=cls.domain_level)
+
+    def teardown_method(self, method):
+        self.clients[0].run_command(['ipa-client-install',
+                                     '--uninstall', '-U'])
+        tasks.kinit_admin(self.master)
+        self.master.run_command(['ipa', 'host-del', self.clients[0].hostname])
+
+    def test_wrong_client_domain(self):
+        client = self.clients[0]
+        client.run_command(['ipa-client-install', '-U',
+                            '--domain', self.domain_name,
+                            '--realm', self.master.domain.realm,
+                            '-p', 'admin',
+                            '-w', self.master.config.dirman_password,
+                            '--server', self.master.hostname,
+                            '--force-join'])
+        result = client.run_command(['ipa-replica-install', '-U', '-w',
+                                     self.master.config.dirman_password],
+                                    raiseonerr=False)
+        assert_error(result,
+                     "Cannot promote this client to a replica. Local domain "
+                     "'%s' does not match IPA domain "
+                     "'%s'" % (self.domain_name, self.master.domain.name))
+
+    def test_upcase_client_domain(self):
+        client = self.clients[0]
+        result = client.run_command(['ipa-client-install', '-U', '--domain',
+                                     self.master.domain.realm, '-w',
+                                     self.master.config.dirman_password,
+                                     '-p', 'admin',
+                                     '--server', self.master.hostname,
+                                     '--force-join'], raiseonerr=False)
+        assert(result.returncode == 0), (
+            'Failed to setup client with the upcase domain name')
+        result1 = client.run_command(['ipa-replica-install', '-U', '-w',
+                                      self.master.config.dirman_password],
+                                     raiseonerr=False)
+        assert(result1.returncode == 0), (
+            'Failed to promote the client installed with the upcase domain name')
-- 
1.8.3.1

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