Skip to content

Commit

Permalink
Make an ipa-tests package
Browse files Browse the repository at this point in the history
Rename the 'tests' directory to 'ipa-tests', and create an ipa-tests RPM
containing the test suite

Part of the work for: https://fedorahosted.org/freeipa/ticket/3654
  • Loading branch information
encukou authored and mkosek committed Jun 17, 2013
1 parent 6d66e82 commit c60142e
Show file tree
Hide file tree
Showing 105 changed files with 237 additions and 93 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@ ipapython/setup.py
ipapython/version.py
version.m4
ipapython/services.py
ipatests/setup.py
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ endif

PYTHON ?= $(shell rpm -E %__python)

all: bootstrap-autogen server
all: bootstrap-autogen server tests
@for subdir in $(SUBDIRS); do \
(cd $$subdir && $(MAKE) $@) || exit 1; \
done
Expand All @@ -71,7 +71,7 @@ client-autogen: version-update
cd ipa-client; if [ ! -e Makefile ]; then ../autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=$(LIBDIR); fi
cd install; if [ ! -e Makefile ]; then ../autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=$(LIBDIR); fi

install: all server-install
install: all server-install tests-install
@for subdir in $(SUBDIRS); do \
(cd $$subdir && $(MAKE) $@) || exit 1; \
done
Expand Down Expand Up @@ -118,6 +118,8 @@ version-update: release-update
> ipapython/setup.py
sed -e s/__VERSION__/$(IPA_VERSION)/ ipapython/version.py.in \
> ipapython/version.py
sed -e s/__VERSION__/$(IPA_VERSION)/ ipatests/setup.py.in \
> ipatests/setup.py
perl -pi -e "s:__NUM_VERSION__:$(IPA_NUM_VERSION):" ipapython/version.py
perl -pi -e "s:__API_VERSION__:$(IPA_API_VERSION_MAJOR).$(IPA_API_VERSION_MINOR):" ipapython/version.py
sed -e s/__VERSION__/$(IPA_VERSION)/ daemons/ipa-version.h.in \
Expand Down Expand Up @@ -149,6 +151,16 @@ server-install: server
$(PYTHON) setup.py install --root $(DESTDIR); \
fi

tests: version-update
cd ipatests; $(PYTHON) setup.py build

tests-install: tests
if [ "$(DESTDIR)" = "" ]; then \
cd ipatests; $(PYTHON) setup.py install; \
else \
cd ipatests; $(PYTHON) setup.py install --root $(DESTDIR); \
fi

archive:
-mkdir -p dist
git archive --format=tar --prefix=ipa/ $(TARGET) | (cd dist && tar xf -)
Expand Down
43 changes: 43 additions & 0 deletions freeipa.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,26 @@ user, virtual machines, groups, authentication credentials), Policy
logs, analysis thereof). If you are using IPA you need to install this
package.

%if ! %{ONLY_CLIENT}
%package tests
Summary: IPA tests and test tools
Requires: %{name}-client = %{version}-%{release}
Requires: %{name}-python = %{version}-%{release}
Requires: python-nose
Requires: python-paste
Requires: python-coverage
Requires: python-polib

%description tests
IPA is an integrated solution to provide centrally managed Identity (machine,
user, virtual machines, groups, authentication credentials), Policy
(configuration settings, access control information) and Audit (events,
logs, analysis thereof).
This package contains tests that verify IPA functionality.

%endif # ! %{ONLY_CLIENT}


%prep
%setup -n freeipa-%{version} -q

Expand Down Expand Up @@ -432,6 +452,10 @@ install -pm 644 ipa-compliance.cron %{buildroot}%{_sysconfdir}/cron.d/ipa-compli
grep -v dcerpc | grep -v adtrustinstance | \
sed -e 's,\.py.*$,.*,g' | sort -u | \
sed -e 's,\./,%%{python_sitelib}/ipaserver/,g' ) >server-python.list

(cd %{buildroot}/%{python_sitelib}/ipatests && find . -type f | \
sed -e 's,\.py.*$,.*,g' | sort -u | \
sed -e 's,\./,%%{python_sitelib}/ipatests/,g' ) >tests-python.list
%endif # ! %{ONLY_CLIENT}

%clean
Expand Down Expand Up @@ -777,7 +801,26 @@ fi
%ghost %attr(0644,root,apache) %config(noreplace) %{_sysconfdir}/ipa/default.conf
%ghost %attr(0644,root,apache) %config(noreplace) %{_sysconfdir}/ipa/ca.crt

%if ! %{ONLY_CLIENT}
%files tests -f tests-python.list
%defattr(-,root,root,-)
%doc COPYING README Contributors.txt
%dir %{python_sitelib}/ipatests
%dir %{python_sitelib}/ipatests/test_cmdline
%dir %{python_sitelib}/ipatests/test_install
%dir %{python_sitelib}/ipatests/test_ipalib
%dir %{python_sitelib}/ipatests/test_ipapython
%dir %{python_sitelib}/ipatests/test_ipaserver
%dir %{python_sitelib}/ipatests/test_ipaserver/install
%dir %{python_sitelib}/ipatests/test_pkcs10
%dir %{python_sitelib}/ipatests/test_xmlrpc
%{python_sitelib}/ipatests-*.egg-info
%endif # ! %{ONLY_CLIENT}

%changelog
* Mon Jun 17 2013 Petr Viktorin <[email protected]> - 3.2.99-2
- Add the freeipa-tests subpackage

* Thu Jun 13 2013 Martin Kosek <[email protected]> - 3.2.99-1
- Drop freeipa-server-selinux subpackage
- Drop redundant directory /var/cache/ipa/sessions
Expand Down
4 changes: 2 additions & 2 deletions install/po/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ MSGMERGE = @MSGMERGE@
MSGCMP = @MSGCMP@
MSGATTRIB = @MSGATTRIB@
TX = @TX@
IPA_TEST_I18N = ../../tests/i18n.py
IPA_TEST_I18N = ../../ipatests/i18n.py

DOMAIN = @GETTEXT_DOMAIN@
MSGMERGE_UPDATE = $(MSGMERGE) --update
Expand All @@ -35,7 +35,7 @@ po_files = $(patsubst %, %.po, $(languages))
mo_files = $(patsubst %.po, %.mo, $(po_files))
po_count=$(words $(po_files))

PY_FILES = $(shell cd ../..; git ls-files | grep -v -e "^tests/" -e "^doc/" -e "^install/po/" -e "^ipapython/test/" -e "setup.py" -e "setup-client.py" | grep "\.py$$" | tr '\n' ' '; cd install/po)
PY_FILES = $(shell cd ../..; git ls-files | grep -v -e "^ipatests/" -e "^doc/" -e "^install/po/" -e "^ipapython/test/" -e "setup.py" -e "setup-client.py" | grep "\.py$$" | tr '\n' ' '; cd install/po)
C_FILES = $(shell cd ../..; git ls-files | grep "\.c$$" | tr '\n' ' '; cd install/po)
H_FILES = $(shell cd ../..; git ls-files | grep "\.h$$" | tr '\n' ' '; cd install/po)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
87 changes: 87 additions & 0 deletions ipatests/setup.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/python
# Copyright (C) 2007 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

"""FreeIPA tests
FreeIPA is a server for identity, policy, and audit.
"""

DOCLINES = __doc__.split("\n")

import os
import sys
import distutils.sysconfig

CLASSIFIERS = """\
Development Status :: 4 - Beta
Intended Audience :: System Environment/Base
License :: GPL
Programming Language :: Python
Operating System :: POSIX
Operating System :: Unix
"""

# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
# update it when the contents of directories change.
if os.path.exists('MANIFEST'):
os.remove('MANIFEST')

def setup_package():

from distutils.core import setup

old_path = os.getcwd()
local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
os.chdir(local_path)
sys.path.insert(0, local_path)

try:
setup(
name = "ipatests",
version = "__VERSION__",
license = "GPL",
author = "FreeIPA Developers",
author_email = "[email protected]",
maintainer = "FreeIPA Developers",
maintainer_email = "[email protected]",
url = "http://www.freeipa.org/",
description = DOCLINES[0],
long_description = "\n".join(DOCLINES[2:]),
download_url = "http://www.freeipa.org/page/Downloads",
classifiers=filter(None, CLASSIFIERS.split('\n')),
package_dir = {'ipatests': ''},
packages = ["ipatests",
"ipatests.test_cmdline",
"ipatests.test_install",
"ipatests.test_ipalib",
"ipatests.test_ipapython",
"ipatests.test_ipaserver",
"ipatests.test_ipaserver.install",
"ipatests.test_pkcs10",
"ipatests.test_xmlrpc"],
package_data = {
'ipatests.test_install': ['*.update'],
'ipatests.test_pkcs10': ['*.csr']}
)
finally:
del sys.path[0]
os.chdir(old_path)
return

if __name__ == '__main__':
setup_package()
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from ipalib import api
from ipalib import errors
from tests.test_xmlrpc.xmlrpc_test import XMLRPC_test
from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test
from ipaserver.plugins.ldap2 import ldap2
from ipapython import ipautil

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import nose

from tests import util
from ipatests import util
from ipalib import api, errors
from ipapython.version import API_VERSION

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def setUp(self):
self.ld.do_simple_bind(bindpw=self.dm_password)
if ipautil.file_exists("0_reset.update"):
self.testdir="./"
elif ipautil.file_exists("tests/test_install/0_reset.update"):
self.testdir= "./tests/test_install/"
elif ipautil.file_exists("ipatests/test_install/0_reset.update"):
self.testdir= "./ipatests/test_install/"
else:
raise nose.SkipTest("Unable to find test update files")

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"""

import threading
from tests.util import ClassChecker, raises, create_test_api
from tests.data import unicode_str
from ipatests.util import ClassChecker, raises, create_test_api
from ipatests.data import unicode_str
from ipalib.request import context, Connection
from ipalib.frontend import Command
from ipalib import backend, plugable, errors, base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Test the `ipalib.base` module.
"""

from tests.util import ClassChecker, raises
from ipatests.util import ClassChecker, raises
from ipalib.constants import NAME_REGEX, NAME_ERROR
from ipalib.constants import TYPE_ERROR, SET_ERROR, DEL_ERROR, OVERRIDE_ERROR
from ipalib import base
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Test the `ipalib.cli` module.
"""

from tests.util import raises, get_api, ClassChecker
from ipatests.util import raises, get_api, ClassChecker
from ipalib import cli, plugable, frontend, backend


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
from os import path
import sys
import socket
from tests.util import raises, setitem, delitem, ClassChecker
from tests.util import getitem, setitem, delitem
from tests.util import TempDir, TempHome
from ipatests.util import raises, setitem, delitem, ClassChecker
from ipatests.util import getitem, setitem, delitem
from ipatests.util import TempDir, TempHome
from ipalib.constants import TYPE_ERROR, OVERRIDE_ERROR, SET_ERROR, DEL_ERROR
from ipalib.constants import NAME_REGEX, NAME_ERROR
from ipalib import config, constants, base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Test the `ipalib.crud` module.
"""

from tests.util import read_only, raises, get_api, ClassChecker
from ipatests.util import read_only, raises, get_api, ClassChecker
from ipalib import crud, frontend, plugable, config
from ipalib.parameters import Str

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import re
import inspect

from tests.util import assert_equal, raises
from ipatests.util import assert_equal, raises
from ipalib import errors, text
from ipalib.constants import TYPE_ERROR

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
Test the `ipalib.frontend` module.
"""

from tests.util import raises, getitem, no_set, no_del, read_only
from tests.util import check_TypeError, ClassChecker, create_test_api
from tests.util import assert_equal
from ipatests.util import raises, getitem, no_set, no_del, read_only
from ipatests.util import check_TypeError, ClassChecker, create_test_api
from ipatests.util import assert_equal
from ipalib.constants import TYPE_ERROR
from ipalib.base import NameSpace
from ipalib import frontend, backend, plugable, errors, parameters, config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from ipalib import messages
from ipalib.capabilities import capabilities
from tests.test_ipalib import test_errors
from ipatests.test_ipalib import test_errors


class HelloMessage(messages.PublicMessage):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Test the `ipalib.output` module.
"""

from tests.util import raises, ClassChecker
from ipatests.util import raises, ClassChecker
from ipalib import output
from ipalib.frontend import Command
from ipalib import _
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
from types import NoneType
from decimal import Decimal
from inspect import isclass
from tests.util import raises, ClassChecker, read_only
from tests.util import dummy_ugettext, assert_equal
from tests.data import binary_bytes, utf8_bytes, unicode_str
from ipatests.util import raises, ClassChecker, read_only
from ipatests.util import dummy_ugettext, assert_equal
from ipatests.data import binary_bytes, utf8_bytes, unicode_str
from ipalib import parameters, text, errors, config
from ipalib.constants import TYPE_ERROR, CALLABLE_ERROR, NULLS
from ipalib.errors import ValidationError, ConversionError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"""

import inspect
from tests.util import raises, no_set, no_del, read_only
from tests.util import getitem, setitem, delitem
from tests.util import ClassChecker, create_test_api
from ipatests.util import raises, no_set, no_del, read_only
from ipatests.util import getitem, setitem, delitem
from ipatests.util import ClassChecker, create_test_api
from ipalib import plugable, errors, text


Expand Down Expand Up @@ -247,7 +247,7 @@ class check(self.cls):
info = 'whatever'
e = raises(StandardError, check)
assert str(e) == \
"info is already bound to tests.test_ipalib.test_plugable.check()"
"info is already bound to ipatests.test_ipalib.test_plugable.check()"

def test_set_api(self):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

import threading
from xmlrpclib import Binary, Fault, dumps, loads, ServerProxy
from tests.util import raises, assert_equal, PluginTester, DummyClass
from tests.data import binary_bytes, utf8_bytes, unicode_str
from ipatests.util import raises, assert_equal, PluginTester, DummyClass
from ipatests.data import binary_bytes, utf8_bytes, unicode_str
from ipalib.frontend import Command
from ipalib.request import context, Connection
from ipalib import rpc, errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import re
import nose
import locale
from tests.util import raises, assert_equal
from tests.i18n import create_po, po_file_iterate
from ipatests.util import raises, assert_equal
from ipatests.i18n import create_po, po_file_iterate
from ipalib.request import context
from ipalib import request
from ipalib import text
Expand Down
File renamed without changes.
Loading

0 comments on commit c60142e

Please sign in to comment.