summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-06-03 15:04:58 +0200
committerMartin Kosek <mkosek@redhat.com>2014-03-13 15:52:18 +0100
commit05f612e58a4954162dcaa724585869819ca77672 (patch)
tree8dccfd72710db010599a01bdd514c332aa807bed
parent65bde3ecd7dc0b2d51fd7c3faf49edbe662151e2 (diff)
downloadfreeipa-05f612e58a4954162dcaa724585869819ca77672.tar.gz
freeipa-05f612e58a4954162dcaa724585869819ca77672.tar.xz
freeipa-05f612e58a4954162dcaa724585869819ca77672.zip
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 Reviewed-By: Martin Kosek <mkosek@redhat.com>
-rw-r--r--ipatests/test_cmdline/cmdline.py13
-rw-r--r--ipatests/test_cmdline/test_ipagetkeytab.py2
-rwxr-xr-xmake-test3
3 files changed, 14 insertions, 4 deletions
diff --git a/ipatests/test_cmdline/cmdline.py b/ipatests/test_cmdline/cmdline.py
index 6f3541d27..0ef0137a6 100644
--- a/ipatests/test_cmdline/cmdline.py
+++ b/ipatests/test_cmdline/cmdline.py
@@ -23,12 +23,13 @@ Base class for all cmdline tests
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 cb46fd23b..ee2fdecf0 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 1cf5bb329..2a48ab181 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)