[prev in list] [next in list] [prev in thread] [next in thread] 

List:       spacewalk-commits
Subject:    7 commits - backend/common backend/Makefile.backend backend/server backend/spacewalk-backend.spec
From:       mmraka () fedoraproject ! org (Michael Mraka)
Date:       2010-11-29 12:13:02
Message-ID: 20101129121302.897221201AE () lists ! fedorahosted ! org
[Download RAW message or body]

 backend/Makefile.backend                           |    4 ++--
 backend/common/test/unit-test/Makefile             |    5 ++---
 backend/common/test/unit-test/test_rhnCache.py     |    1 +
 backend/common/test/unit-test/test_rhnLib.py       |    7 +++++--
 backend/server/test/unit-test/Makefile             |    9 +++++++--
 backend/server/test/unit-test/test_capabilities.py |    8 +++++++-
 backend/spacewalk-backend.spec                     |    3 +++
 7 files changed, 27 insertions(+), 10 deletions(-)

New commits:
commit e2179ac40e903f2cdccde8c29435202f603cff88
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Mon Nov 29 13:03:25 2010 +0100

    moved tests which require db to DB_TESTS
    and let run only (non-db) TESTS in rpmbuild

diff --git a/backend/server/test/unit-test/Makefile \
b/backend/server/test/unit-test/Makefile index 97701ae..60e7a18 100644
--- a/backend/server/test/unit-test/Makefile
+++ b/backend/server/test/unit-test/Makefile
@@ -1,12 +1,16 @@
 
-TESTS       = \
+DB_TESTS       = \
         test_capabilities.py \
         test_misc_functions.py \
         test_rhnActivationKey.py \
         test_rhnChannel.py \
+	test_rhnDatabaseCache.py \
         test_rhnServerGroup.py \
         test_server_registration.py
 
+TESTS       = \
+        test_rhnLib_timestamp.py
+
 all:	$(addprefix test-,$(TESTS))
 
 test-%:


commit 51bdb504a41ce76a54d45dcd99a8f80f87cea6ed
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Mon Nov 29 12:05:20 2010 +0100

    fixed test_capabilities

diff --git a/backend/server/test/unit-test/test_capabilities.py \
b/backend/server/test/unit-test/test_capabilities.py index 2c13456..02ab8eb 100644
--- a/backend/server/test/unit-test/test_capabilities.py
+++ b/backend/server/test/unit-test/test_capabilities.py
@@ -31,6 +31,7 @@ if _basedir not in sys.path:
 import time
 from rhn import rpclib
 from spacewalk.server import rhnSQL, rhnServer, rhnCapability
+from spacewalk.common.rhnConfig import ConfigParserError
 
 def main():
     if len(sys.argv) == 1:
@@ -43,7 +44,12 @@ def main():
     else:
         db_name = sys.argv[2]
 
-    rhnSQL.initDB(db_name)
+    try:
+        rhnSQL.initDB(db_name)
+    except ConfigParserError:
+        # database is not available when running in rpmbuild time
+        print "Test skipped"
+        return 0
 
     uri = "http://%s/XMLRPC" % (server_name, )
     s = rpclib.Server(uri)


commit b2e8356ff7bd2086479eb268070434bb0ddd729b
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Mon Nov 29 11:01:29 2010 +0100

    test_tsort.py is no longer with us

diff --git a/backend/common/test/unit-test/Makefile \
b/backend/common/test/unit-test/Makefile index ae398c9..5241126 100644
--- a/backend/common/test/unit-test/Makefile
+++ b/backend/common/test/unit-test/Makefile
@@ -1,8 +1,7 @@
 TESTS       = \
         test_gettext.py \
         test_rhnCache.py \
-        test_rhnLib.py \
-        test_tsort.py
+        test_rhnLib.py
 
 all:	$(addprefix test-,$(TESTS))
 


commit 8d0986426aa8a985376e9b6f36d40fe6ffdb850f
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Mon Nov 29 10:45:18 2010 +0100

    fixed rfc822time unit tests

diff --git a/backend/common/test/unit-test/test_rhnLib.py \
b/backend/common/test/unit-test/test_rhnLib.py index 58ba015..aed9a2a 100644
--- a/backend/common/test/unit-test/test_rhnLib.py
+++ b/backend/common/test/unit-test/test_rhnLib.py
@@ -19,8 +19,11 @@
 import sys
 import locale
 import unittest
+import time
 from spacewalk.common import rhnLib
 
+TIMEZONE_SHIFT = time.timezone / 3600
+
 class Tests(unittest.TestCase):
 
     ###########################################################################
@@ -29,14 +32,14 @@ class Tests(unittest.TestCase):
 
     def test_rfc822time_normal_tuple_arg(self):
         "rfc822time: Simple call using a valid tuple argument."
-        test_arg = (2006, 1, 27, 9, 12, 5, 4, 27, -1)
+        test_arg = (2006, 1, 27, (14 - TIMEZONE_SHIFT), 12, 5, 4, 27, -1)
         target = "Fri, 27 Jan 2006 14:12:05 GMT"
         result = rhnLib.rfc822time(test_arg)
         self.assertEqual(result, target, result + " != " + target)
         
     def test_rfc822time_normal_list_arg(self):
         "rfc822time: Simple call using a valid list argument."
-        test_arg = [2006, 1, 27, 9, 12, 5, 4, 27, -1]
+        test_arg = [2006, 1, 27, (14 - TIMEZONE_SHIFT), 12, 5, 4, 27, -1]
         target = "Fri, 27 Jan 2006 14:12:05 GMT"
         result = rhnLib.rfc822time(test_arg)
         self.assertEqual(result, target, result + " != " + target)


commit c782639d17ed22a6f080b9a18f1c1a3af4c3680b
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Mon Nov 29 10:21:10 2010 +0100

    fixed rhnCache.CACHEDIR in unit tests

diff --git a/backend/common/test/unit-test/test_rhnCache.py \
b/backend/common/test/unit-test/test_rhnCache.py index 0f27c6f..fe7d38b 100644
--- a/backend/common/test/unit-test/test_rhnCache.py
+++ b/backend/common/test/unit-test/test_rhnCache.py
@@ -49,6 +49,7 @@ class Tests(unittest.TestCase):
 
     def _test(self, key, content, **modifiers):
         # Blow it away
+        rhnCache.CACHEDIR = '/tmp/rhn'
         self._cleanup(key)
         apply(rhnCache.set, (key, content), modifiers)
         self.failUnless(rhnCache.has_key(key))


commit a7b784b118f94080894e07f324fe13e17fc42b38
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Mon Nov 29 11:32:56 2010 +0100

    look for python modules in buildroot

diff --git a/backend/Makefile.backend b/backend/Makefile.backend
index e2393fa..912527f 100644
--- a/backend/Makefile.backend
+++ b/backend/Makefile.backend
@@ -25,5 +25,5 @@ install :: install-code install-conf
 clean :: clean-code clean-conf
 
 test    ::  
-	$(MAKE) -C common/test/unit-test
-	$(MAKE) -C server/test/unit-test
+	$(MAKE) -C common/test/unit-test PYTHONPATH=$(PYTHONPATH)
+	$(MAKE) -C server/test/unit-test PYTHONPATH=$(PYTHONPATH)
diff --git a/backend/common/test/unit-test/Makefile \
b/backend/common/test/unit-test/Makefile index 8b0d180..ae398c9 100644
--- a/backend/common/test/unit-test/Makefile
+++ b/backend/common/test/unit-test/Makefile
@@ -8,4 +8,4 @@ all:	$(addprefix test-,$(TESTS))
 
 test-%:
 	@echo Running $*
-	@PYTHONPATH=../../.. python $*
+	@PYTHONPATH=$(PYTHONPATH):../../.. python $*
diff --git a/backend/server/test/unit-test/Makefile \
b/backend/server/test/unit-test/Makefile index c7b4764..97701ae 100644
--- a/backend/server/test/unit-test/Makefile
+++ b/backend/server/test/unit-test/Makefile
@@ -1,3 +1,4 @@
+
 TESTS       = \
         test_capabilities.py \
         test_misc_functions.py \
@@ -10,4 +11,4 @@ all:	$(addprefix test-,$(TESTS))
 
 test-%:
 	@echo Running $*
-	@PYTHONPATH=../../.. python $*
+	PYTHONPATH=$(PYTHONPATH):../../../ python $*
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index f4f3739..05483d4 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -295,7 +295,7 @@ rm -v \
$RPM_BUILD_ROOT/%{apacheconfd}/zz-spacewalk-server-python.conf  rm -rf \
$RPM_BUILD_ROOT  
 %check
-make -f Makefile.backend test
+make -f Makefile.backend PYTHONPATH=$RPM_BUILD_ROOT/%{python_sitelib} test
 
 %pre server
 OLD_SECRET_FILE=%{_var}/www/rhns/server/secret/rhnSecret.py


commit 51c5a18c3079a9dda872529c3d45c4ec63cb4940
Author: Michael Mraka <michael.mraka at redhat.com>
Date:   Mon Nov 29 09:47:15 2010 +0100

    run backend unit test in rpm build time

diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 03da5cf..f4f3739 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -294,6 +294,9 @@ rm -v \
$RPM_BUILD_ROOT/%{apacheconfd}/zz-spacewalk-server-python.conf  %clean
 rm -rf $RPM_BUILD_ROOT
 
+%check
+make -f Makefile.backend test
+
 %pre server
 OLD_SECRET_FILE=%{_var}/www/rhns/server/secret/rhnSecret.py
 if [ -f $OLD_SECRET_FILE ]; then


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic