No results in cucumber scenarios

30 views
Skip to first unread message

SimonC

unread,
Nov 20, 2011, 7:28:19 AM11/20/11
to thinkin...@googlegroups.com
Hi,

I'm having trouble getting TS to return results within my Cucumber scenarios. I've followed the latest docs and have:

1) Disabled transactional fixtures globally,
2) Enabled DatabaseCleaner, using truncation for tests tagged '@search' and transactions otherwise, and
3) Implemented the indexing steps as suggested.

The main config and sample output is shown here: https://gist.github.com/1380180 . As the output shows, I'm getting no results returned.

In the example feature I've confirmed that the Product entries are in the database by dropping into a debugger session after the call to the indexer; Product.all returns three products, but Product.search("") returns nothing. I've tried much longer sleep statements after the TS::Test.index calls to no effect, so I'm pretty sure the problem isn't that the searchd daemon is being a bit slow to catch up; I can also see the index rotation reporting success in searchd.log at the appropriate times.

All in all, I'm a bit stumped. Can anyone see if I'm doing something stupid? Any and all suggestions very gratefully received... :-)

Cheers,
Simon

SimonC

unread,
Nov 20, 2011, 8:06:54 AM11/20/11
to thinkin...@googlegroups.com
Sorry, I completely forgot to provide any versions. Here's the main ones:

thinking_sphinx 2.0.10
sphinx 0.9.9 via homebrew
cucumber-rails 1.2.0
cucumber 1.1.2
rails 3.0.11

Simon

Pat Allan

unread,
Nov 21, 2011, 7:16:03 AM11/21/11
to thinkin...@googlegroups.com
Hi Simon

Can't spot anything obviously wrong at the moment… can you add :verbose => true to the index calls in the steps - that'll show us the index task output, which perhaps could hold a clue.

Cheers

--
Pat

> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/kCSEe269O8YJ.
> To post to this group, send email to thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.

SimonC

unread,
Nov 21, 2011, 9:57:27 AM11/21/11
to thinkin...@googlegroups.com
Hi Pat,

Thanks for responding. Here's the verbose output - not very illuminating unfortunately: https://gist.github.com/f2caeade4072adb8df37

However, I think this may be more of a DatabaseCleaner oddity than anything to do with TS, as I've managed to get it working, but in a way that makes little sense. If I add the following line to features/support/env.rb:

DatabaseCleaner.strategy = :truncation

then it all works - scenarios tagged '@search' run using truncation and sphinx results are returned, while scenarios not tagged '@search' appear to run in transactions, and sphinx sees nothing as expected. However, if I change the line to:

DatabaseCleaner.strategy = :transaction

then I'm back to square one, and every scenario seems to run in a transaction, no matter what tag it has. I don't really understand how a global setting that's being overwritten at the start of every scenario should be able to have this effect, but it certainly seems as if the issue is nothing to do with Thinking Sphinx.

Thanks very much for taking a look, I really appreciate it - when I work out exactly what's going on I'll report back with a definitive set of config.

Cheers,
Simon

Pat Allan

unread,
Nov 21, 2011, 10:04:33 AM11/21/11
to thinkin...@googlegroups.com
Good to know you've found a way forward, even if DatabaseCleaner isn't behaving as expected.

--
Pat

> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.

> To view this discussion on the web visit https://groups.google.com/d/msg/thinking-sphinx/-/xWRGUGZ5ZoQJ.

Reply all
Reply to author
Forward
0 new messages