EOF Error with Unit Tests

I am getting this weird EOFError when running tests using rake

When running unit tests one by one (test file by test file), this error
does not pop up. Does anyone know what is happening?

Thanks!

Oh I forget to mention, obviously some tests include CRUD operations on
the object that has been indexed

in addition to using fixtures, I also have written some test helper
methods (add_post() for example)

Thanks.

Miguel wrote:

I am getting this weird EOFError when running tests using rake

When running unit tests one by one (test file by test file), this error
does not pop up. Does anyone know what is happening?

Thanks!

On 9/22/06, Miguel [email protected] wrote:

When running unit tests one by one (test file by test file), this error
does not pop up. Does anyone know what is happening?

Thanks!

Hi Miguel,

A couple of questions will help us answer this. Are you on Windows? Is
your application a Rails app? Are you using acts_as_ferret?

The first thing I’d check is that you are closing your Index,
IndexReader or IndexWriter when you are finished with it (ie in your
test methods . Not doing this can possibly cause and EOFError. Also,
on Windows, I had a lot of trouble making sure files get deleted
correctly, but I may have made a mistake somewhere.

I hope we can help you out,
Dave

Hello Dave,

Thanks for your reply. I am indeed using acts_as_ferret on ferret 0.9.6
on Windows. When i manually delete the test index, it sometimes work.
But only sometimes. I do not see a pattern. Please help! Thanks in
advance!

Miguel

p.s. I will also try the closing the index trick. If that work, i will
report here for documentation purposes. thanks.

David B. wrote:

On 9/22/06, Miguel [email protected] wrote:

When running unit tests one by one (test file by test file), this error
does not pop up. Does anyone know what is happening?

Thanks!

Hi Miguel,

A couple of questions will help us answer this. Are you on Windows? Is
your application a Rails app? Are you using acts_as_ferret?

The first thing I’d check is that you are closing your Index,
IndexReader or IndexWriter when you are finished with it (ie in your
test methods . Not doing this can possibly cause and EOFError. Also,
on Windows, I had a lot of trouble making sure files get deleted
correctly, but I may have made a mistake somewhere.

I hope we can help you out,
Dave

Hi David,

I tried calling index.close at the teardown method. But since i am
using acts_as_ferret, it looks like AAF closes the index after it’s done
updating it, so i am getting errors of “closing an already closed index”

  • am i doing anything wrong? Or should i just switch over the linux :slight_smile:

I tried upgrading to 0.10.x, the gems installed OK, but there is this
name error for the constant FIELD when i load up script/console.

Thanks again for your answers!!

Miguel

David B. wrote:

On 10/11/06, MIguel [email protected] wrote:

report here for documentation purposes. thanks.
I’d say your error is almost certainly caused by the fact that you
have left an IndexWriter or Index open somewhere. By the way, why are
you still using 0.9.6? It is definitely worth upgrading as you’d be
using the much slower pure ruby version on Windows.

Cheers,
Dave

On 10/11/06, MIguel [email protected] wrote:

report here for documentation purposes. thanks.
I’d say your error is almost certainly caused by the fact that you
have left an IndexWriter or Index open somewhere. By the way, why are
you still using 0.9.6? It is definitely worth upgrading as you’d be
using the much slower pure ruby version on Windows.

Cheers,
Dave

On 10/11/06, MIguel [email protected] wrote:

Thanks again for your answers!!

Miguel

The API changed between 0.9 and 0.10 so you’ll have to make some
changes. Check the tutorial at http://ferret.davebalmain.com/api, in
particular the section on adding Documents. Hopefully that will help
you fix the problem.

Cheers,
Dave