Re: [Freeipa-devel] [patch 0035] ipatests: Add test case for requesting a certificate with full principal.

2016-04-21 Thread Martin Basti



On 21.04.2016 16:30, Martin Babinsky wrote:

On 04/21/2016 03:55 PM, Milan Kubík wrote:

On 04/21/2016 03:29 PM, Martin Babinsky wrote:

On 04/21/2016 03:25 PM, Martin Babinsky wrote:

On 04/21/2016 11:24 AM, Milan Kubík wrote:

On 04/05/2016 12:07 PM, Martin Babinsky wrote:

On 04/05/2016 10:24 AM, Milan Kubík wrote:

On 04/05/2016 10:17 AM, Milan Kubík wrote:

On 04/05/2016 09:31 AM, Martin Babinsky wrote:

On 04/01/2016 12:02 PM, Milan Kubík wrote:


Patches attached.



https://fedorahosted.org/freeipa/ticket/5733








Hi Milan,



I would be more happy if you could send a separate patch for the
context
manager fix, since the issue is orthogonal to the added test case
(even
if the test suite explodes without it).



Otherwise LGTM.







Done. Patch 0035 now applies to all branches, context manager fix
needs separate patch for ipa-4-2.


Updated commit message in patches 0036 to include the ticket.


Thanks, ACK.


Add freeipa-devel back to the loop & push request :)

--
Milan Kubik


Ah sorry I forgot how to mailing list.

ACK again for our push-bot (aka mbasti)



I see that the fix for the failing test was already pushed so you can
remove the xfail mark from the test and it should be all green now.

Sorry for the confusion.



I haven't noticed, sorry. Updated patch attached.


--
Milan Kubik



All is green, ACK.

I would recommend pushing patch 0036 first, then patch 0035 to avoid 
false negative errors when bisecting.



Tests pushed to:

master:
* b0b9972213760dcf351cdd85dbfe2c38fc21b2e6 ipatests: fix for 
change_principal context manager
* 0472300dffc1b77533a6bb7397d6a5fa11439303 ipatests: Add test case for 
requesting a certificate with full principal.

ipa-4-3:
* c4fa656b0e0850ddd6400caaa676eae4ec46da06 ipatests: fix for 
change_principal context manager
* e183030067bae2df318324e9fcaafa8ea272f4b4 ipatests: Add test case for 
requesting a certificate with full principal.

ipa-4-2:
* eadd47eec6ceb38b001bc9bff14e2a5aa83eb2ab ipatests: fix for 
change_principal context manager
* ffd670379b16940499c1ef86d676c05886cb1116 ipatests: Add test case for 
requesting a certificate with full principal.


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

Re: [Freeipa-devel] [patch 0035] ipatests: Add test case for requesting a certificate with full principal.

2016-04-21 Thread Martin Babinsky

On 04/21/2016 03:55 PM, Milan Kubík wrote:

On 04/21/2016 03:29 PM, Martin Babinsky wrote:

On 04/21/2016 03:25 PM, Martin Babinsky wrote:

On 04/21/2016 11:24 AM, Milan Kubík wrote:

On 04/05/2016 12:07 PM, Martin Babinsky wrote:

On 04/05/2016 10:24 AM, Milan Kubík wrote:

On 04/05/2016 10:17 AM, Milan Kubík wrote:

On 04/05/2016 09:31 AM, Martin Babinsky wrote:

On 04/01/2016 12:02 PM, Milan Kubík wrote:


Patches attached.



https://fedorahosted.org/freeipa/ticket/5733








Hi Milan,



I would be more happy if you could send a separate patch for the
context
manager fix, since the issue is orthogonal to the added test case
(even
if the test suite explodes without it).



Otherwise LGTM.







Done. Patch 0035 now applies to all branches, context manager fix
needs separate patch for ipa-4-2.


Updated commit message in patches 0036 to include the ticket.


Thanks, ACK.


Add freeipa-devel back to the loop & push request :)

--
Milan Kubik


Ah sorry I forgot how to mailing list.

ACK again for our push-bot (aka mbasti)



I see that the fix for the failing test was already pushed so you can
remove the xfail mark from the test and it should be all green now.

Sorry for the confusion.



I haven't noticed, sorry. Updated patch attached.


--
Milan Kubik



All is green, ACK.

I would recommend pushing patch 0036 first, then patch 0035 to avoid 
false negative errors when bisecting.


--
Martin^3 Babinsky

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

Re: [Freeipa-devel] [patch 0035] ipatests: Add test case for requesting a certificate with full principal.

2016-04-21 Thread Milan Kubík

On 04/21/2016 03:29 PM, Martin Babinsky wrote:

On 04/21/2016 03:25 PM, Martin Babinsky wrote:

On 04/21/2016 11:24 AM, Milan Kubík wrote:

On 04/05/2016 12:07 PM, Martin Babinsky wrote:

On 04/05/2016 10:24 AM, Milan Kubík wrote:

On 04/05/2016 10:17 AM, Milan Kubík wrote:

On 04/05/2016 09:31 AM, Martin Babinsky wrote:

On 04/01/2016 12:02 PM, Milan Kubík wrote:


Patches attached.



https://fedorahosted.org/freeipa/ticket/5733








Hi Milan,



I would be more happy if you could send a separate patch for the
context
manager fix, since the issue is orthogonal to the added test case
(even
if the test suite explodes without it).



Otherwise LGTM.







Done. Patch 0035 now applies to all branches, context manager fix
needs separate patch for ipa-4-2.


Updated commit message in patches 0036 to include the ticket.


Thanks, ACK.


Add freeipa-devel back to the loop & push request :)

--
Milan Kubik


Ah sorry I forgot how to mailing list.

ACK again for our push-bot (aka mbasti)



I see that the fix for the failing test was already pushed so you can 
remove the xfail mark from the test and it should be all green now.


Sorry for the confusion.



I haven't noticed, sorry. Updated patch attached.


--
Milan Kubik

From cd49ec790918c7b006afe9ee542ff055739b0b74 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20Kub=C3=ADk?= 
Date: Tue, 5 Apr 2016 10:04:03 +0200
Subject: [PATCH] ipatests: Add test case for requesting a certificate with
 full principal.

https://fedorahosted.org/freeipa/ticket/5733
---
 ipatests/test_xmlrpc/test_caacl_profile_enforcement.py | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
index dca4151d614a4c2e2f5a09455426d117da4c1c80..11c040966003e2ea86149359c8aacb953e9fdd37 100644
--- a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
+++ b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
@@ -130,6 +130,13 @@ class TestCertSignMIME(XMLRPC_test):
 api.Command.cert_request(csr, principal=smime_user,
  profile_id=smime_profile.name)
 
+def test_sign_smime_csr_full_principal(self, smime_profile, smime_user):
+csr = generate_user_csr(smime_user)
+smime_user_principal = '@'.join((smime_user, api.env.realm))
+with change_principal(smime_user, SMIME_USER_PW):
+api.Command.cert_request(csr, principal=smime_user_principal,
+ profile_id=smime_profile.name)
+
 
 @pytest.mark.tier1
 class TestSignWithDisabledACL(XMLRPC_test):
-- 
2.8.0

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

Re: [Freeipa-devel] [patch 0035] ipatests: Add test case for requesting a certificate with full principal.

2016-04-21 Thread Martin Basti



On 21.04.2016 15:30, Martin Basti wrote:



On 21.04.2016 15:25, Martin Babinsky wrote:

On 04/21/2016 11:24 AM, Milan Kubík wrote:

On 04/05/2016 12:07 PM, Martin Babinsky wrote:

On 04/05/2016 10:24 AM, Milan Kubík wrote:

On 04/05/2016 10:17 AM, Milan Kubík wrote:

On 04/05/2016 09:31 AM, Martin Babinsky wrote:

On 04/01/2016 12:02 PM, Milan Kubík wrote:


Patches attached.



https://fedorahosted.org/freeipa/ticket/5733








Hi Milan,



I would be more happy if you could send a separate patch for the
context
manager fix, since the issue is orthogonal to the added test case
(even
if the test suite explodes without it).



Otherwise LGTM.







Done. Patch 0035 now applies to all branches, context manager fix
needs separate patch for ipa-4-2.


Updated commit message in patches 0036 to include the ticket.


Thanks, ACK.


Add freeipa-devel back to the loop & push request :)

--
Milan Kubik


Ah sorry I forgot how to mailing list.

ACK again for our push-bot (aka mbasti)

PushError: Push rejected by bot (Reason: test should not be marked as 
xfail)



... because issue was already fixed

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

Re: [Freeipa-devel] [patch 0035] ipatests: Add test case for requesting a certificate with full principal.

2016-04-21 Thread Martin Basti



On 21.04.2016 15:25, Martin Babinsky wrote:

On 04/21/2016 11:24 AM, Milan Kubík wrote:

On 04/05/2016 12:07 PM, Martin Babinsky wrote:

On 04/05/2016 10:24 AM, Milan Kubík wrote:

On 04/05/2016 10:17 AM, Milan Kubík wrote:

On 04/05/2016 09:31 AM, Martin Babinsky wrote:

On 04/01/2016 12:02 PM, Milan Kubík wrote:


Patches attached.



https://fedorahosted.org/freeipa/ticket/5733








Hi Milan,



I would be more happy if you could send a separate patch for the
context
manager fix, since the issue is orthogonal to the added test case
(even
if the test suite explodes without it).



Otherwise LGTM.







Done. Patch 0035 now applies to all branches, context manager fix
needs separate patch for ipa-4-2.


Updated commit message in patches 0036 to include the ticket.


Thanks, ACK.


Add freeipa-devel back to the loop & push request :)

--
Milan Kubik


Ah sorry I forgot how to mailing list.

ACK again for our push-bot (aka mbasti)


PushError: Push rejected by bot (Reason: test should not be marked as xfail)

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

Re: [Freeipa-devel] [patch 0035] ipatests: Add test case for requesting a certificate with full principal.

2016-04-21 Thread Martin Babinsky

On 04/21/2016 03:25 PM, Martin Babinsky wrote:

On 04/21/2016 11:24 AM, Milan Kubík wrote:

On 04/05/2016 12:07 PM, Martin Babinsky wrote:

On 04/05/2016 10:24 AM, Milan Kubík wrote:

On 04/05/2016 10:17 AM, Milan Kubík wrote:

On 04/05/2016 09:31 AM, Martin Babinsky wrote:

On 04/01/2016 12:02 PM, Milan Kubík wrote:


Patches attached.



https://fedorahosted.org/freeipa/ticket/5733








Hi Milan,



I would be more happy if you could send a separate patch for the
context
manager fix, since the issue is orthogonal to the added test case
(even
if the test suite explodes without it).



Otherwise LGTM.







Done. Patch 0035 now applies to all branches, context manager fix
needs separate patch for ipa-4-2.


Updated commit message in patches 0036 to include the ticket.


Thanks, ACK.


Add freeipa-devel back to the loop & push request :)

--
Milan Kubik


Ah sorry I forgot how to mailing list.

ACK again for our push-bot (aka mbasti)



I see that the fix for the failing test was already pushed so you can 
remove the xfail mark from the test and it should be all green now.


Sorry for the confusion.

--
Martin^3 Babinsky

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

Re: [Freeipa-devel] [patch 0035] ipatests: Add test case for requesting a certificate with full principal.

2016-04-21 Thread Martin Babinsky

On 04/21/2016 11:24 AM, Milan Kubík wrote:

On 04/05/2016 12:07 PM, Martin Babinsky wrote:

On 04/05/2016 10:24 AM, Milan Kubík wrote:

On 04/05/2016 10:17 AM, Milan Kubík wrote:

On 04/05/2016 09:31 AM, Martin Babinsky wrote:

On 04/01/2016 12:02 PM, Milan Kubík wrote:


Patches attached.



https://fedorahosted.org/freeipa/ticket/5733








Hi Milan,



I would be more happy if you could send a separate patch for the
context
manager fix, since the issue is orthogonal to the added test case
(even
if the test suite explodes without it).



Otherwise LGTM.







Done. Patch 0035 now applies to all branches, context manager fix
needs separate patch for ipa-4-2.


Updated commit message in patches 0036 to include the ticket.


Thanks, ACK.


Add freeipa-devel back to the loop & push request :)

--
Milan Kubik


Ah sorry I forgot how to mailing list.

ACK again for our push-bot (aka mbasti)

--
Martin^3 Babinsky

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

Re: [Freeipa-devel] [patch 0035] ipatests: Add test case for requesting a certificate with full principal.

2016-04-21 Thread Milan Kubík

On 04/05/2016 12:07 PM, Martin Babinsky wrote:

On 04/05/2016 10:24 AM, Milan Kubík wrote:

On 04/05/2016 10:17 AM, Milan Kubík wrote:

On 04/05/2016 09:31 AM, Martin Babinsky wrote:

On 04/01/2016 12:02 PM, Milan Kubík wrote:


Patches attached.



https://fedorahosted.org/freeipa/ticket/5733








Hi Milan,



I would be more happy if you could send a separate patch for the 
context
manager fix, since the issue is orthogonal to the added test case 
(even

if the test suite explodes without it).



Otherwise LGTM.







Done. Patch 0035 now applies to all branches, context manager fix
needs separate patch for ipa-4-2.


Updated commit message in patches 0036 to include the ticket.


Thanks, ACK.


Add freeipa-devel back to the loop & push request :)

--
Milan Kubik

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

Re: [Freeipa-devel] [patch 0035] ipatests: Add test case for requesting a certificate with full principal.

2016-04-05 Thread Milan Kubík

On 04/05/2016 10:17 AM, Milan Kubík wrote:

On 04/05/2016 09:31 AM, Martin Babinsky wrote:

On 04/01/2016 12:02 PM, Milan Kubík wrote:


Patches attached.



https://fedorahosted.org/freeipa/ticket/5733








Hi Milan,



I would be more happy if you could send a separate patch for the context
manager fix, since the issue is orthogonal to the added test case (even
if the test suite explodes without it).



Otherwise LGTM.







Done. Patch 0035 now applies to all branches, context manager fix 
needs separate patch for ipa-4-2.



Updated commit message in patches 0036 to include the ticket.

--
Milan Kubik

From eebad5ad31107f3383b4b2755a97929a75170d6f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20Kub=C3=ADk?= 
Date: Tue, 5 Apr 2016 10:04:03 +0200
Subject: [PATCH 1/2] ipatests: Add test case for requesting a certificate with
 full principal.

https://fedorahosted.org/freeipa/ticket/5733
---
 ipatests/test_xmlrpc/test_caacl_profile_enforcement.py | 8 
 1 file changed, 8 insertions(+)

diff --git a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
index dca4151d614a4c2e2f5a09455426d117da4c1c80..a0b8d614cf6dd42b18eb03100a318e4a3fbfb4e0 100644
--- a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
+++ b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
@@ -130,6 +130,14 @@ class TestCertSignMIME(XMLRPC_test):
 api.Command.cert_request(csr, principal=smime_user,
  profile_id=smime_profile.name)
 
+@pytest.mark.xfail(strict=True, reason='freeipa ticket 5733')
+def test_sign_smime_csr_full_principal(self, smime_profile, smime_user):
+csr = generate_user_csr(smime_user)
+smime_user_principal = '@'.join((smime_user, api.env.realm))
+with change_principal(smime_user, SMIME_USER_PW):
+api.Command.cert_request(csr, principal=smime_user_principal,
+ profile_id=smime_profile.name)
+
 
 @pytest.mark.tier1
 class TestSignWithDisabledACL(XMLRPC_test):
-- 
2.8.0

From b103f0165db3536db0c3bd02aec82961e631c08b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20Kub=C3=ADk?= 
Date: Tue, 5 Apr 2016 10:04:37 +0200
Subject: [PATCH] ipatests: fix for change_principal context manager

The context manager was leaving API object disconnected when
an exception was raised inside of it. This led to resource leak
in the tests.

https://fedorahosted.org/freeipa/ticket/5733
---
 ipatests/util.py | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/ipatests/util.py b/ipatests/util.py
index 6aefe74d34fd7b1bd063c4b17c98af4840d6f042..118c47a12e0d97907cb559d716989a9ca6c5f304 100644
--- a/ipatests/util.py
+++ b/ipatests/util.py
@@ -696,17 +696,18 @@ def change_principal(user, password, client=None, path=None):
 
 client.Backend.rpcclient.disconnect()
 
-with private_ccache(ccache_name):
-kinit_password(user, password, ccache_name)
+try:
+with private_ccache(ccache_name):
+kinit_password(user, password, ccache_name)
+client.Backend.rpcclient.connect()
+
+try:
+yield
+finally:
+client.Backend.rpcclient.disconnect()
+finally:
 client.Backend.rpcclient.connect()
 
-try:
-yield
-finally:
-client.Backend.rpcclient.disconnect()
-
-client.Backend.rpcclient.connect()
-
 def get_group_dn(cn):
 return DN(('cn', cn), api.env.container_group, api.env.basedn)
 
-- 
2.8.0

From b15dc58c9b810cdff02438cb78c89240c9eb5416 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20Kub=C3=ADk?= 
Date: Tue, 5 Apr 2016 10:04:37 +0200
Subject: [PATCH] ipatests: fix for change_principal context manager

The context manager was leaving API object disconnected when
an exception was raised inside of it. This led to resource leak
in the tests.

https://fedorahosted.org/freeipa/ticket/5733
---
 ipatests/util.py | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/ipatests/util.py b/ipatests/util.py
index 4d99ff6e0a505cd3f75053f97caca9edbc802bcf..56b731407b3544b3b922f1831df4bc59845486d1 100644
--- a/ipatests/util.py
+++ b/ipatests/util.py
@@ -687,13 +687,14 @@ def change_principal(user, password, client=None, path=None):
 
 client.Backend.rpcclient.disconnect()
 
-with private_ccache(ccache_name):
-kinit_password(user, password, ccache_name)
+try:
+with private_ccache(ccache_name):
+kinit_password(user, password, ccache_name)
+client.Backend.rpcclient.connect()
+
+try:
+yield
+finally:
+client.Backend.rpcclient.disconnect()
+finally:
 client.Backend.rpcclient.connect()
-
-try:
-yield
-finally:
-client.Backend.rpcclient.disconnect()
-
-client.Backend.rpcclient.connect()
-- 
2.8.0


Re: [Freeipa-devel] [patch 0035] ipatests: Add test case for requesting a certificate with full principal.

2016-04-05 Thread Milan Kubík

On 04/05/2016 09:31 AM, Martin Babinsky wrote:

On 04/01/2016 12:02 PM, Milan Kubík wrote:


Patches attached.



https://fedorahosted.org/freeipa/ticket/5733








Hi Milan,



I would be more happy if you could send a separate patch for the context
manager fix, since the issue is orthogonal to the added test case (even
if the test suite explodes without it).



Otherwise LGTM.







Done. Patch 0035 now applies to all branches, context manager fix needs 
separate patch for ipa-4-2.


--
Milan Kubik

From eebad5ad31107f3383b4b2755a97929a75170d6f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20Kub=C3=ADk?= 
Date: Tue, 5 Apr 2016 10:04:03 +0200
Subject: [PATCH 1/2] ipatests: Add test case for requesting a certificate with
 full principal.

https://fedorahosted.org/freeipa/ticket/5733
---
 ipatests/test_xmlrpc/test_caacl_profile_enforcement.py | 8 
 1 file changed, 8 insertions(+)

diff --git a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
index dca4151d614a4c2e2f5a09455426d117da4c1c80..a0b8d614cf6dd42b18eb03100a318e4a3fbfb4e0 100644
--- a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
+++ b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
@@ -130,6 +130,14 @@ class TestCertSignMIME(XMLRPC_test):
 api.Command.cert_request(csr, principal=smime_user,
  profile_id=smime_profile.name)
 
+@pytest.mark.xfail(strict=True, reason='freeipa ticket 5733')
+def test_sign_smime_csr_full_principal(self, smime_profile, smime_user):
+csr = generate_user_csr(smime_user)
+smime_user_principal = '@'.join((smime_user, api.env.realm))
+with change_principal(smime_user, SMIME_USER_PW):
+api.Command.cert_request(csr, principal=smime_user_principal,
+ profile_id=smime_profile.name)
+
 
 @pytest.mark.tier1
 class TestSignWithDisabledACL(XMLRPC_test):
-- 
2.8.0

From a9c7fe8b5a2f477e5dd6e70496e878c373183747 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20Kub=C3=ADk?= 
Date: Tue, 5 Apr 2016 10:04:37 +0200
Subject: [PATCH 2/2] ipatests: fix for change_principal context manager

The context manager was leaving API object disconnected when
an exception was raised inside of it. This led to resource leak
in the tests.
---
 ipatests/util.py | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/ipatests/util.py b/ipatests/util.py
index 6aefe74d34fd7b1bd063c4b17c98af4840d6f042..118c47a12e0d97907cb559d716989a9ca6c5f304 100644
--- a/ipatests/util.py
+++ b/ipatests/util.py
@@ -696,17 +696,18 @@ def change_principal(user, password, client=None, path=None):
 
 client.Backend.rpcclient.disconnect()
 
-with private_ccache(ccache_name):
-kinit_password(user, password, ccache_name)
+try:
+with private_ccache(ccache_name):
+kinit_password(user, password, ccache_name)
+client.Backend.rpcclient.connect()
+
+try:
+yield
+finally:
+client.Backend.rpcclient.disconnect()
+finally:
 client.Backend.rpcclient.connect()
 
-try:
-yield
-finally:
-client.Backend.rpcclient.disconnect()
-
-client.Backend.rpcclient.connect()
-
 def get_group_dn(cn):
 return DN(('cn', cn), api.env.container_group, api.env.basedn)
 
-- 
2.8.0

From 3923b51494cd5336a5a9cd9c2120d6d639f6b9ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20Kub=C3=ADk?= 
Date: Tue, 5 Apr 2016 10:04:37 +0200
Subject: [PATCH] ipatests: fix for change_principal context manager

The context manager was leaving API object disconnected when
an exception was raised inside of it. This led to resource leak
in the tests.
---
 ipatests/util.py | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/ipatests/util.py b/ipatests/util.py
index 4d99ff6e0a505cd3f75053f97caca9edbc802bcf..56b731407b3544b3b922f1831df4bc59845486d1 100644
--- a/ipatests/util.py
+++ b/ipatests/util.py
@@ -687,13 +687,14 @@ def change_principal(user, password, client=None, path=None):
 
 client.Backend.rpcclient.disconnect()
 
-with private_ccache(ccache_name):
-kinit_password(user, password, ccache_name)
+try:
+with private_ccache(ccache_name):
+kinit_password(user, password, ccache_name)
+client.Backend.rpcclient.connect()
+
+try:
+yield
+finally:
+client.Backend.rpcclient.disconnect()
+finally:
 client.Backend.rpcclient.connect()
-
-try:
-yield
-finally:
-client.Backend.rpcclient.disconnect()
-
-client.Backend.rpcclient.connect()
-- 
2.8.0

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

Re: [Freeipa-devel] [patch 0035] ipatests: Add test case for requesting a certificate with full principal.

2016-04-05 Thread Martin Babinsky

On 04/01/2016 12:02 PM, Milan Kubík wrote:

Patches attached.

https://fedorahosted.org/freeipa/ticket/5733




Hi Milan,

I would be more happy if you could send a separate patch for the context 
manager fix, since the issue is orthogonal to the added test case (even 
if the test suite explodes without it).


Otherwise LGTM.

--
Martin^3 Babinsky

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


[Freeipa-devel] [patch 0035] ipatests: Add test case for requesting a certificate with full principal.

2016-04-01 Thread Milan Kubík

Patches attached.

https://fedorahosted.org/freeipa/ticket/5733

--
Milan Kubik

From 985814ef076a828ac59aeafd0598d87983edc809 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20Kub=C3=ADk?= 
Date: Fri, 1 Apr 2016 11:11:54 +0200
Subject: [PATCH] ipatests: Add test case for requesting a certificate with
 full principal.

Also fixes an issue in change_principal context manager that caused
a resource leak on test case failure.

https://fedorahosted.org/freeipa/ticket/5733
---
 .../test_xmlrpc/test_caacl_profile_enforcement.py |  8 
 ipatests/util.py  | 19 ++-
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
index dca4151d614a4c2e2f5a09455426d117da4c1c80..a0b8d614cf6dd42b18eb03100a318e4a3fbfb4e0 100644
--- a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
+++ b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
@@ -130,6 +130,14 @@ class TestCertSignMIME(XMLRPC_test):
 api.Command.cert_request(csr, principal=smime_user,
  profile_id=smime_profile.name)
 
+@pytest.mark.xfail(strict=True, reason='freeipa ticket 5733')
+def test_sign_smime_csr_full_principal(self, smime_profile, smime_user):
+csr = generate_user_csr(smime_user)
+smime_user_principal = '@'.join((smime_user, api.env.realm))
+with change_principal(smime_user, SMIME_USER_PW):
+api.Command.cert_request(csr, principal=smime_user_principal,
+ profile_id=smime_profile.name)
+
 
 @pytest.mark.tier1
 class TestSignWithDisabledACL(XMLRPC_test):
diff --git a/ipatests/util.py b/ipatests/util.py
index 6aefe74d34fd7b1bd063c4b17c98af4840d6f042..118c47a12e0d97907cb559d716989a9ca6c5f304 100644
--- a/ipatests/util.py
+++ b/ipatests/util.py
@@ -696,17 +696,18 @@ def change_principal(user, password, client=None, path=None):
 
 client.Backend.rpcclient.disconnect()
 
-with private_ccache(ccache_name):
-kinit_password(user, password, ccache_name)
+try:
+with private_ccache(ccache_name):
+kinit_password(user, password, ccache_name)
+client.Backend.rpcclient.connect()
+
+try:
+yield
+finally:
+client.Backend.rpcclient.disconnect()
+finally:
 client.Backend.rpcclient.connect()
 
-try:
-yield
-finally:
-client.Backend.rpcclient.disconnect()
-
-client.Backend.rpcclient.connect()
-
 def get_group_dn(cn):
 return DN(('cn', cn), api.env.container_group, api.env.basedn)
 
-- 
2.8.0

From f3cb98f26551d342968281fb01d288e10cda85de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20Kub=C3=ADk?= 
Date: Fri, 1 Apr 2016 11:11:54 +0200
Subject: [PATCH] ipatests: Add test case for requesting a certificate with
 full principal.

Also fixes an issue in change_principal context manager that caused
a resource leak on test case failure.

https://fedorahosted.org/freeipa/ticket/5733
---
 .../test_xmlrpc/test_caacl_profile_enforcement.py |  8 
 ipatests/util.py  | 19 ++-
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
index 78262ae8c17716633ac33fcc8114f6b549066a42..98165c4919e719e72fd7a4aec977f12dacd79249 100644
--- a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
+++ b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
@@ -125,6 +125,14 @@ class TestCertSignMIME(XMLRPC_test):
 api.Command.cert_request(csr, principal=smime_user,
  profile_id=smime_profile.name)
 
+@pytest.mark.xfail(strict=True, reason='freeipa ticket 5733')
+def test_sign_smime_csr_full_principal(self, smime_profile, smime_user):
+csr = generate_user_csr(smime_user)
+smime_user_principal = '@'.join((smime_user, api.env.realm))
+with change_principal(smime_user, SMIME_USER_PW):
+api.Command.cert_request(csr, principal=smime_user_principal,
+ profile_id=smime_profile.name)
+
 
 @pytest.mark.tier1
 class TestSignWithDisabledACL(XMLRPC_test):
diff --git a/ipatests/util.py b/ipatests/util.py
index 4d99ff6e0a505cd3f75053f97caca9edbc802bcf..a3c4889c6fd0026bf5caa655170f785f571e09f5 100644
--- a/ipatests/util.py
+++ b/ipatests/util.py
@@ -687,13 +687,14 @@ def change_principal(user, password, client=None, path=None):
 
 client.Backend.rpcclient.disconnect()
 
-with private_ccache(ccache_name):
-kinit_password(user, password, ccache_name)
+try:
+with private_ccache(ccache_name):
+kinit_password(user, password, ccache_name)
+client.Backend.rpcclient.connect()
+
+