Ticket #1393 (assigned enhancement)

Opened 3 years ago

Last modified 3 years ago

Don't skip search tests

Reported by: dread Owned by: johnglover
Priority: minor Milestone: ckan-backlog
Component: ckan Keywords:
Cc: johnglover Repository: ckan
Theme: none

Description

Now we don't use postgres search, all the tests involving search now don't need to be skipped when running on sqlite. Should help coders spot earlier if these tests break.

Change History

comment:1 Changed 3 years ago by dread

  • Cc johnglover added

I changed this:

diff -r 47657581fc30 ckan/tests/__init__.py
--- a/ckan/tests/__init__.py	Wed Oct 12 17:58:19 2011 +0100
+++ b/ckan/tests/__init__.py	Thu Oct 13 12:29:54 2011 +0100
@@ -373,7 +373,7 @@
     plugins.load('synchronous_search')
 
 def is_search_supported():
-    supported_db = "sqlite" not in config.get('sqlalchemy.url')
+    supported_db = True
     return supported_db
 
 def is_regex_supported():

But there seems to be a problem finding the package when trying to index it:

======================================================================
ERROR: test suite for <class 'ckan.tests.functional.test_search.TestSearch'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/dread/hgroot/pyenv-ckan/lib/python2.6/site-packages/nose/suite.py", line 208, in run
    self.setUp()
  File "/home/dread/hgroot/pyenv-ckan/lib/python2.6/site-packages/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/home/dread/hgroot/pyenv-ckan/lib/python2.6/site-packages/nose/suite.py", line 314, in setupContext
    try_run(context, names)
  File "/home/dread/hgroot/pyenv-ckan/lib/python2.6/site-packages/nose/util.py", line 478, in try_run
    return func()
  File "/home/dread/hgroot/ckan/ckan/tests/functional/test_search.py", line 21, in setup_class
    CreateTestData.create_search_test_data()
  File "/home/dread/hgroot/ckan/ckan/lib/create_test_data.py", line 66, in create_search_test_data
    cls.create_arbitrary(search_items)
  File "/home/dread/hgroot/ckan/ckan/lib/create_test_data.py", line 197, in create_arbitrary
    model.repo.commit_and_remove()
  File "/home/dread/hgroot/pyenv-ckan/src/vdm/vdm/sqlalchemy/tools.py", line 110, in commit_and_remove
    self.commit()
  File "/home/dread/hgroot/pyenv-ckan/src/vdm/vdm/sqlalchemy/tools.py", line 100, in commit
    self.session.commit()
  File "/home/dread/hgroot/pyenv-ckan/lib/python2.6/site-packages/sqlalchemy/orm/scoping.py", line 139, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File "/home/dread/hgroot/pyenv-ckan/lib/python2.6/site-packages/sqlalchemy/orm/session.py", line 614, in commit
    self.transaction.commit()
  File "/home/dread/hgroot/pyenv-ckan/lib/python2.6/site-packages/sqlalchemy/orm/session.py", line 385, in commit
    self._prepare_impl()
  File "/home/dread/hgroot/pyenv-ckan/lib/python2.6/site-packages/sqlalchemy/orm/session.py", line 361, in _prepare_impl
    ext.before_commit(self.session)
  File "/home/dread/hgroot/ckan/ckan/model/extension.py", line 103, in before_commit
    methodcaller('before_commit', session)
  File "/home/dread/hgroot/ckan/ckan/model/extension.py", line 38, in notify_observers
    func(observer)
  File "/home/dread/hgroot/ckan/ckan/model/modification.py", line 45, in before_commit
    self.notify(obj, DomainObjectOperation.new)
  File "/home/dread/hgroot/ckan/ckan/model/modification.py", line 70, in notify
    observer.notify(entity, operation)
  File "/home/dread/hgroot/ckan/ckan/lib/search/__init__.py", line 93, in notify
    package_to_api1(entity, {'model': model}),
  File "/home/dread/hgroot/ckan/ckan/lib/dictization/model_dictize.py", line 231, in package_to_api1
    dictized = package_dictize(pkg, context)
  File "/home/dread/hgroot/ckan/ckan/lib/dictization/model_dictize.py", line 118, in package_dictize
    raise NotFound
NotFound

----------------------------------------------------------------------
Ran 1 test in 2.734s

FAILED (errors=1)

Any ideas John?

comment:2 Changed 3 years ago by johnglover

Yes, there are a few of these problems with SQLite which is why the tests are being skipped currently. I'm not exactly sure of the reason, it seems that it sometimes drops tables from memory, but we haven't found a solution. Myself and David Raznick were going to spend some time looking at it but haven't had a chance yet.

comment:3 Changed 3 years ago by dread

  • Owner changed from dread to johnglover
  • Status changed from new to assigned
  • Milestone changed from current-ckan-sprint-2011-11-07 to ckan-backlog

Thanks John, reassigning to you for the future.

Note: See TracTickets for help on using tickets.