Re: [Freeipa-devel] [PATCH] 0235 tests: Use ipa-getkeytab from /usr/sbin instead of the in-tree one
On 03/05/2014 03:51 PM, Petr Viktorin wrote: > On 09/24/2013 05:34 PM, Petr Viktorin wrote: >> On 06/04/2013 05:48 PM, Simo Sorce wrote: >>> On Tue, 2013-06-04 at 17:24 +0200, Petr Viktorin wrote: On 06/04/2013 02:53 PM, Simo Sorce wrote: > On Tue, 2013-06-04 at 13:48 +0200, Petr Viktorin wrote: >> Hardcoding the in-tree location for ipa-getkeytab makes testing >> outside >> the source tree impossible. This patch makes the tests use the >> installed >> location. >> >> In other places the test suite assumes IPA is installed system-wide, >> even if running from the source tree. >> I know I frequently forget to run `make` before testing, which >> makes the >> ipa-getkeytab tests fail. So this patch would work well for me (and >> probably other Python devs), but I guess others might be used to `make >> test` checking what `make` built. >> >> C developers, are you OK with e.g. adding `cp ipa-client/ipa-getkeytab >> /usr/sbin/ipa-getkeytab` to your testing workflow? > > Absolutely not. > >>Or should this be made configurable (or auto-detected)? > > You must not break a machine just to do make test. > > I often do make test, then make rpms and install rpms, I *never* > directly install on my development machine or VMs, I always go through > RPM in order to keep the system clean, and tests repeatable. I do the same except I never run make test on the development machine -- without IPA installed the tests don't work. > ipa-getkeytab specifically do not need root to be tested so I really do > not see that copying over a system path would ever be a good idea. > > Simo. With this version of the patch, the tests use ipa-getkeytab from $PATH, and the in-tree directory is added to PATH in make-test. Out-of-tree tests don't use make-test so they will use the system PATH. Is that OK? >>> >>> Sounds good to me. >>> >>> Simo. >>> >> >> Ping, could someone look at this patch? >> It should fix 7 of the 11 failures that happen when running the test >> suite out of tree. >> > > Attaching a slightly updated version. Any takers? Fixed the test failures for me. It should also help our CI to remove some more common failures - ACK. Pushed to master: 05f612e58a4954162dcaa724585869819ca77672 Martin ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 0235 tests: Use ipa-getkeytab from /usr/sbin instead of the in-tree one
On 09/24/2013 05:34 PM, Petr Viktorin wrote: On 06/04/2013 05:48 PM, Simo Sorce wrote: On Tue, 2013-06-04 at 17:24 +0200, Petr Viktorin wrote: On 06/04/2013 02:53 PM, Simo Sorce wrote: On Tue, 2013-06-04 at 13:48 +0200, Petr Viktorin wrote: Hardcoding the in-tree location for ipa-getkeytab makes testing outside the source tree impossible. This patch makes the tests use the installed location. In other places the test suite assumes IPA is installed system-wide, even if running from the source tree. I know I frequently forget to run `make` before testing, which makes the ipa-getkeytab tests fail. So this patch would work well for me (and probably other Python devs), but I guess others might be used to `make test` checking what `make` built. C developers, are you OK with e.g. adding `cp ipa-client/ipa-getkeytab /usr/sbin/ipa-getkeytab` to your testing workflow? Absolutely not. Or should this be made configurable (or auto-detected)? You must not break a machine just to do make test. I often do make test, then make rpms and install rpms, I *never* directly install on my development machine or VMs, I always go through RPM in order to keep the system clean, and tests repeatable. I do the same except I never run make test on the development machine -- without IPA installed the tests don't work. ipa-getkeytab specifically do not need root to be tested so I really do not see that copying over a system path would ever be a good idea. Simo. With this version of the patch, the tests use ipa-getkeytab from $PATH, and the in-tree directory is added to PATH in make-test. Out-of-tree tests don't use make-test so they will use the system PATH. Is that OK? Sounds good to me. Simo. Ping, could someone look at this patch? It should fix 7 of the 11 failures that happen when running the test suite out of tree. Attaching a slightly updated version. Any takers? -- Petr³ From 154ddde3d3baf4cd106055beeca9bf72adc196b6 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Mon, 3 Jun 2013 15:04:58 +0200 Subject: [PATCH] Do not hardcode path to ipa-getkeytab in tests Using the in-tree binary makes testing outside the source tree impossible. Use ipa-getkeytab from $PATH, and add the directory to $PATH when running the in-tree tests. Part of the work for https://fedorahosted.org/freeipa/ticket/3654 --- ipatests/test_cmdline/cmdline.py | 13 ++--- ipatests/test_cmdline/test_ipagetkeytab.py | 2 +- make-test | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ipatests/test_cmdline/cmdline.py b/ipatests/test_cmdline/cmdline.py index 6f3541d27081f2180f3f7b1da85d7bcd42eed353..0ef0137a67d9b51fa445b0b52b2c80a2a877dd08 100644 --- a/ipatests/test_cmdline/cmdline.py +++ b/ipatests/test_cmdline/cmdline.py @@ -23,12 +23,13 @@ import nose import krbV +import distutils.spawn +import os from ipalib import api from ipalib import errors from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test from ipaserver.plugins.ldap2 import ldap2 -from ipapython import ipautil # See if our LDAP server is up and we can talk to it over GSSAPI ccache = krbV.default_context().default_ccache() @@ -51,11 +52,17 @@ class cmdline_test(XMLRPC_test): command = '/bin/ls' def setUp(self): +# Find the executable in $PATH +# This is neded because ipautil.run resets the PATH to +# a system default. +original_command = self.command +if not os.path.isabs(self.command): +self.command = distutils.spawn.find_executable(self.command) # raise an error if the command is missing even if the remote # server is not available. -if not ipautil.file_exists(self.command): +if not self.command: raise AssertionError( -'Command %r not available' % self.command +'Command %r not available' % original_command ) super(cmdline_test, self).setUp() if not server_available: diff --git a/ipatests/test_cmdline/test_ipagetkeytab.py b/ipatests/test_cmdline/test_ipagetkeytab.py index cb46fd23bf320f59c30e53ceaa85d09aa7a3e2b4..ee2fdecf041c2af14c435db0f93493cd49a3999b 100644 --- a/ipatests/test_cmdline/test_ipagetkeytab.py +++ b/ipatests/test_cmdline/test_ipagetkeytab.py @@ -59,7 +59,7 @@ class test_ipagetkeytab(cmdline_test): """ Test `ipa-getkeytab`. """ -command = "ipa-client/ipa-getkeytab" +command = "ipa-getkeytab" host_fqdn = u'ipatest.%s' % api.env.domain service_princ = u'test/%s@%s' % (host_fqdn, api.env.realm) [keytabfd, keytabname] = tempfile.mkstemp() diff --git a/make-test b/make-test index 1cf5bb32975df76574726d5da4522517e5e12eed..2a48ab18181fe313b413b8c64f300533215380bc 100755 --- a/make-test +++ b/make-test @@ -29,6 +29,9 @@ cmd += sys.argv[1:] # This must be set so ipalib.api gets initialized property for tests: os.environ['IPA_UNIT_TEST_MODE'] = 'cli_test' +# A
Re: [Freeipa-devel] [PATCH] 0235 tests: Use ipa-getkeytab from /usr/sbin instead of the in-tree one
On 06/04/2013 05:48 PM, Simo Sorce wrote: On Tue, 2013-06-04 at 17:24 +0200, Petr Viktorin wrote: On 06/04/2013 02:53 PM, Simo Sorce wrote: On Tue, 2013-06-04 at 13:48 +0200, Petr Viktorin wrote: Hardcoding the in-tree location for ipa-getkeytab makes testing outside the source tree impossible. This patch makes the tests use the installed location. In other places the test suite assumes IPA is installed system-wide, even if running from the source tree. I know I frequently forget to run `make` before testing, which makes the ipa-getkeytab tests fail. So this patch would work well for me (and probably other Python devs), but I guess others might be used to `make test` checking what `make` built. C developers, are you OK with e.g. adding `cp ipa-client/ipa-getkeytab /usr/sbin/ipa-getkeytab` to your testing workflow? Absolutely not. Or should this be made configurable (or auto-detected)? You must not break a machine just to do make test. I often do make test, then make rpms and install rpms, I *never* directly install on my development machine or VMs, I always go through RPM in order to keep the system clean, and tests repeatable. I do the same except I never run make test on the development machine -- without IPA installed the tests don't work. ipa-getkeytab specifically do not need root to be tested so I really do not see that copying over a system path would ever be a good idea. Simo. With this version of the patch, the tests use ipa-getkeytab from $PATH, and the in-tree directory is added to PATH in make-test. Out-of-tree tests don't use make-test so they will use the system PATH. Is that OK? Sounds good to me. Simo. Ping, could someone look at this patch? It should fix 7 of the 11 failures that happen when running the test suite out of tree. -- Petr³ ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 0235 tests: Use ipa-getkeytab from /usr/sbin instead of the in-tree one
On Tue, 2013-06-04 at 17:24 +0200, Petr Viktorin wrote: > On 06/04/2013 02:53 PM, Simo Sorce wrote: > > On Tue, 2013-06-04 at 13:48 +0200, Petr Viktorin wrote: > >> Hardcoding the in-tree location for ipa-getkeytab makes testing outside > >> the source tree impossible. This patch makes the tests use the installed > >> location. > >> > >> In other places the test suite assumes IPA is installed system-wide, > >> even if running from the source tree. > >> I know I frequently forget to run `make` before testing, which makes the > >> ipa-getkeytab tests fail. So this patch would work well for me (and > >> probably other Python devs), but I guess others might be used to `make > >> test` checking what `make` built. > >> > >> C developers, are you OK with e.g. adding `cp ipa-client/ipa-getkeytab > >> /usr/sbin/ipa-getkeytab` to your testing workflow? > > > > Absolutely not. > > > >> Or should this be made configurable (or auto-detected)? > > > > You must not break a machine just to do make test. > > > > I often do make test, then make rpms and install rpms, I *never* > > directly install on my development machine or VMs, I always go through > > RPM in order to keep the system clean, and tests repeatable. > > I do the same except I never run make test on the development machine -- > without IPA installed the tests don't work. > > > ipa-getkeytab specifically do not need root to be tested so I really do > > not see that copying over a system path would ever be a good idea. > > > > Simo. > > > With this version of the patch, the tests use ipa-getkeytab from $PATH, > and the in-tree directory is added to PATH in make-test. Out-of-tree > tests don't use make-test so they will use the system PATH. > Is that OK? > Sounds good to me. Simo. -- Simo Sorce * Red Hat, Inc * New York ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 0235 tests: Use ipa-getkeytab from /usr/sbin instead of the in-tree one
On 06/04/2013 02:53 PM, Simo Sorce wrote: On Tue, 2013-06-04 at 13:48 +0200, Petr Viktorin wrote: Hardcoding the in-tree location for ipa-getkeytab makes testing outside the source tree impossible. This patch makes the tests use the installed location. In other places the test suite assumes IPA is installed system-wide, even if running from the source tree. I know I frequently forget to run `make` before testing, which makes the ipa-getkeytab tests fail. So this patch would work well for me (and probably other Python devs), but I guess others might be used to `make test` checking what `make` built. C developers, are you OK with e.g. adding `cp ipa-client/ipa-getkeytab /usr/sbin/ipa-getkeytab` to your testing workflow? Absolutely not. Or should this be made configurable (or auto-detected)? You must not break a machine just to do make test. I often do make test, then make rpms and install rpms, I *never* directly install on my development machine or VMs, I always go through RPM in order to keep the system clean, and tests repeatable. I do the same except I never run make test on the development machine -- without IPA installed the tests don't work. ipa-getkeytab specifically do not need root to be tested so I really do not see that copying over a system path would ever be a good idea. Simo. With this version of the patch, the tests use ipa-getkeytab from $PATH, and the in-tree directory is added to PATH in make-test. Out-of-tree tests don't use make-test so they will use the system PATH. Is that OK? -- Petr³ From de25676eee63815c76754b7f313c6c3d10d1a036 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Mon, 3 Jun 2013 15:04:58 +0200 Subject: [PATCH] Do not hardcode path to ipa-getkeytab in tests Using the in-tree binary makes testing outside the source tree impossible. Use ipa-getkeytab from $PATH, and add the directory to $PATH when running the in-tree tests. Part of the work for https://fedorahosted.org/freeipa/ticket/3654 --- ipatests/test_cmdline/cmdline.py | 13 ++--- ipatests/test_cmdline/test_ipagetkeytab.py | 2 +- make-test | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ipatests/test_cmdline/cmdline.py b/ipatests/test_cmdline/cmdline.py index 6f3541d27081f2180f3f7b1da85d7bcd42eed353..ed4dc15c0f98d6fb90575c76f37c24d23a34be26 100644 --- a/ipatests/test_cmdline/cmdline.py +++ b/ipatests/test_cmdline/cmdline.py @@ -23,12 +23,13 @@ import nose import krbV +import distutils +import os from ipalib import api from ipalib import errors from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test from ipaserver.plugins.ldap2 import ldap2 -from ipapython import ipautil # See if our LDAP server is up and we can talk to it over GSSAPI ccache = krbV.default_context().default_ccache() @@ -51,11 +52,17 @@ class cmdline_test(XMLRPC_test): command = '/bin/ls' def setUp(self): +# Find the executable in $PATH +# This is neded because ipautil.run resets the PATH to +# a system default. +original_command = self.command +if not os.path.isabs(self.command): +self.command = distutils.spawn.find_executable(self.command) # raise an error if the command is missing even if the remote # server is not available. -if not ipautil.file_exists(self.command): +if not self.command: raise AssertionError( -'Command %r not available' % self.command +'Command %r not available' % original_command ) super(cmdline_test, self).setUp() if not server_available: diff --git a/ipatests/test_cmdline/test_ipagetkeytab.py b/ipatests/test_cmdline/test_ipagetkeytab.py index cb46fd23bf320f59c30e53ceaa85d09aa7a3e2b4..ee2fdecf041c2af14c435db0f93493cd49a3999b 100644 --- a/ipatests/test_cmdline/test_ipagetkeytab.py +++ b/ipatests/test_cmdline/test_ipagetkeytab.py @@ -59,7 +59,7 @@ class test_ipagetkeytab(cmdline_test): """ Test `ipa-getkeytab`. """ -command = "ipa-client/ipa-getkeytab" +command = "ipa-getkeytab" host_fqdn = u'ipatest.%s' % api.env.domain service_princ = u'test/%s@%s' % (host_fqdn, api.env.realm) [keytabfd, keytabname] = tempfile.mkstemp() diff --git a/make-test b/make-test index b39e4dbde410d64edc69791d617349cbb6e9c903..5830c7b9aa2d5bfa350ce37686308ecb3b8ba9e6 100755 --- a/make-test +++ b/make-test @@ -29,6 +29,9 @@ cmd += sys.argv[1:] # This must be set so ipalib.api gets initialized property for tests: os.environ['IPA_UNIT_TEST_MODE'] = 'cli_test' +# Add in-tree client binaries to PATH +os.environ['PATH'] = './ipa-client:' + os.environ['PATH'] + if not path.isfile(nose): print 'ERROR: need %r' % nose sys.exit(100) -- 1.8.1.4 ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 0235 tests: Use ipa-getkeytab from /usr/sbin instead of the in-tree one
On 06/04/2013 04:30 PM, Rob Crittenden wrote: Petr Viktorin wrote: On 06/04/2013 02:09 PM, Jan Pazdziora wrote: On Tue, Jun 04, 2013 at 01:48:23PM +0200, Petr Viktorin wrote: Hardcoding the in-tree location for ipa-getkeytab makes testing outside the source tree impossible. This patch makes the tests use the installed location. In other places the test suite assumes IPA is installed system-wide, even if running from the source tree. I know I frequently forget to run `make` before testing, which makes the ipa-getkeytab tests fail. So this patch would work well for me (and probably other Python devs), but I guess others might be used to `make test` checking what `make` built. C developers, are you OK with e.g. adding `cp ipa-client/ipa-getkeytab /usr/sbin/ipa-getkeytab` to your testing workflow? Or should this be made configurable (or auto-detected)? Will the environment running the test have access rights to do that copy operation? Yes. To set up any meaningful testing of IPA, you need root. Can't you just use PATH value (let PATH do its work)? That's probably the easiest way to make it configurable. But ipa-client/ipa-getkeytab (the old value) is not normally in PATH so some workflow change would be necessary in this case, too. Testing has bit in a bit split-brain since the beginning. We initially did all testing using the lite-server. That seems to have fallen by the way-side recently. I still use the lite-server for testing. I'm not brave enough to try extracting coverage info from mod_wsgi. The traditional route was to install IPA, mostly to get Kerberos and 389-ds running, then to test changes/code in the local tree before committing/submitting upstream. This is the reason that the local ipa-getkeytab is used, for example, to make it easier to test changes without having to reinstall. It's my impression that everyone runs the tests differently. Well, at least more bugs should be found that way. I'll send a patch that uses $PATH as soon as I test it. -- Petr³ ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 0235 tests: Use ipa-getkeytab from /usr/sbin instead of the in-tree one
Petr Viktorin wrote: On 06/04/2013 02:09 PM, Jan Pazdziora wrote: On Tue, Jun 04, 2013 at 01:48:23PM +0200, Petr Viktorin wrote: Hardcoding the in-tree location for ipa-getkeytab makes testing outside the source tree impossible. This patch makes the tests use the installed location. In other places the test suite assumes IPA is installed system-wide, even if running from the source tree. I know I frequently forget to run `make` before testing, which makes the ipa-getkeytab tests fail. So this patch would work well for me (and probably other Python devs), but I guess others might be used to `make test` checking what `make` built. C developers, are you OK with e.g. adding `cp ipa-client/ipa-getkeytab /usr/sbin/ipa-getkeytab` to your testing workflow? Or should this be made configurable (or auto-detected)? Will the environment running the test have access rights to do that copy operation? Yes. To set up any meaningful testing of IPA, you need root. Can't you just use PATH value (let PATH do its work)? That's probably the easiest way to make it configurable. But ipa-client/ipa-getkeytab (the old value) is not normally in PATH so some workflow change would be necessary in this case, too. Testing has bit in a bit split-brain since the beginning. We initially did all testing using the lite-server. That seems to have fallen by the way-side recently. The traditional route was to install IPA, mostly to get Kerberos and 389-ds running, then to test changes/code in the local tree before committing/submitting upstream. This is the reason that the local ipa-getkeytab is used, for example, to make it easier to test changes without having to reinstall. rob ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 0235 tests: Use ipa-getkeytab from /usr/sbin instead of the in-tree one
On Tue, 2013-06-04 at 13:48 +0200, Petr Viktorin wrote: > Hardcoding the in-tree location for ipa-getkeytab makes testing outside > the source tree impossible. This patch makes the tests use the installed > location. > > In other places the test suite assumes IPA is installed system-wide, > even if running from the source tree. > I know I frequently forget to run `make` before testing, which makes the > ipa-getkeytab tests fail. So this patch would work well for me (and > probably other Python devs), but I guess others might be used to `make > test` checking what `make` built. > > C developers, are you OK with e.g. adding `cp ipa-client/ipa-getkeytab > /usr/sbin/ipa-getkeytab` to your testing workflow? Absolutely not. > Or should this be made configurable (or auto-detected)? You must not break a machine just to do make test. I often do make test, then make rpms and install rpms, I *never* directly install on my development machine or VMs, I always go through RPM in order to keep the system clean, and tests repeatable. ipa-getkeytab specifically do not need root to be tested so I really do not see that copying over a system path would ever be a good idea. Simo. -- Simo Sorce * Red Hat, Inc * New York ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 0235 tests: Use ipa-getkeytab from /usr/sbin instead of the in-tree one
On 06/04/2013 02:09 PM, Jan Pazdziora wrote: On Tue, Jun 04, 2013 at 01:48:23PM +0200, Petr Viktorin wrote: Hardcoding the in-tree location for ipa-getkeytab makes testing outside the source tree impossible. This patch makes the tests use the installed location. In other places the test suite assumes IPA is installed system-wide, even if running from the source tree. I know I frequently forget to run `make` before testing, which makes the ipa-getkeytab tests fail. So this patch would work well for me (and probably other Python devs), but I guess others might be used to `make test` checking what `make` built. C developers, are you OK with e.g. adding `cp ipa-client/ipa-getkeytab /usr/sbin/ipa-getkeytab` to your testing workflow? Or should this be made configurable (or auto-detected)? Will the environment running the test have access rights to do that copy operation? Yes. To set up any meaningful testing of IPA, you need root. Can't you just use PATH value (let PATH do its work)? That's probably the easiest way to make it configurable. But ipa-client/ipa-getkeytab (the old value) is not normally in PATH so some workflow change would be necessary in this case, too. -- Petr³ ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 0235 tests: Use ipa-getkeytab from /usr/sbin instead of the in-tree one
On Tue, Jun 04, 2013 at 01:48:23PM +0200, Petr Viktorin wrote: > Hardcoding the in-tree location for ipa-getkeytab makes testing > outside the source tree impossible. This patch makes the tests use > the installed location. > > In other places the test suite assumes IPA is installed system-wide, > even if running from the source tree. > I know I frequently forget to run `make` before testing, which makes > the ipa-getkeytab tests fail. So this patch would work well for me > (and probably other Python devs), but I guess others might be used > to `make test` checking what `make` built. > > C developers, are you OK with e.g. adding `cp > ipa-client/ipa-getkeytab /usr/sbin/ipa-getkeytab` to your testing > workflow? Or should this be made configurable (or auto-detected)? Will the environment running the test have access rights to do that copy operation? Can't you just use PATH value (let PATH do its work)? -- Jan Pazdziora | adelton at #ipa*, #brno Principal Software Engineer, Identity Management Engineering, Red Hat ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 0235 tests: Use ipa-getkeytab from /usr/sbin instead of the in-tree one
On 06/04/2013 01:48 PM, Petr Viktorin wrote: Hardcoding the in-tree location for ipa-getkeytab makes testing outside the source tree impossible. This patch makes the tests use the installed location. In other places the test suite assumes IPA is installed system-wide, even if running from the source tree. I know I frequently forget to run `make` before testing, which makes the ipa-getkeytab tests fail. So this patch would work well for me (and probably other Python devs), but I guess others might be used to `make test` checking what `make` built. C developers, are you OK with e.g. adding `cp ipa-client/ipa-getkeytab /usr/sbin/ipa-getkeytab` to your testing workflow? Or should this be made configurable (or auto-detected)? I forgot to say: Apply this on top of my patches 0227-0229. -- Petr³ ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel