Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid test method execution order #32

Closed
tzolov opened this issue Apr 14, 2013 · 1 comment
Closed

Invalid test method execution order #32

tzolov opened this issue Apr 14, 2013 · 1 comment

Comments

@tzolov
Copy link

tzolov commented Apr 14, 2013

CascadingLocalTest and CascadingHadoopTest require a particular execution order for the tests to work: They run the testWriteToES() first to create the index and then run the testReadFromES() to ready that index.

The JUnit assumes that all tests can be performed in an arbitrary order and often it runs the testReadFromES() before the testWriteToES().

Note: To reproduce the issue when an external ES is used make sure to delete the old indexes:

curl -XDELETE 'http://localhost:9200/billboard'
curl -XDELETE 'http://localhost:9200/top'
./gradlew -x clean test build

Solutions:

  • Call the testWriteToES() and testReadToES() in a single test method to enforce the execution order. I've tried this in the upstreammaster branch: bd389e3
  • Upgrade to JUnit 4.11 and use the @FixMethodOrder(MethodSorters.NAME_ASCENDING) class annotation. Rename the methods so that read test comes second. Have not tested this option
  • Build a custom JUnit ordered class runner. Haven't tested this option.

Related issues: #27 and #30

@costin
Copy link
Member

costin commented Apr 18, 2013

Fixed in master. Part of a bigger refactoring to the test infrastructure.
The tests are now grouped in unit and integration (following the ES layout), the latter being grouped per package into mr/cascading/hive/pig. To cope with ordering, since JUnit doesn't offer many options, I've settled for using Suite - this way ES can be started/stopped for a set of tests (not per test which is way too granular and doesn't preserve state between them which is needed) and the order of the tests (not their methods but that's not relevant) can also be specified.

Fixes #27 and #30

This was referenced Apr 18, 2013
@costin costin closed this as completed Apr 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants