Skip to content

Commit

Permalink
v2 / Tests: work around Neo4j 2.3 disabling index hint errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
aseemk committed Mar 28, 2016
1 parent 9b84583 commit ab07639
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions test-new/indexes._coffee
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ describe 'Indexes', ->
TEST_NODE_A.properties[TEST_PROP] = TEST_VALUE
TEST_NODE_B.properties[TEST_PROP] = TEST_VALUE

# HACK: Only needed because a test that uses it below isn't Streamline.
it '(query db version)', (_) ->
fixtures.queryDbVersion _


describe '(before index created)', ->

Expand All @@ -105,8 +109,22 @@ describe 'Indexes', ->

it '(verify index doesn’t exist yet)', (done) ->
DB.cypher TEST_CYPHER, (err, results) ->
expect(err).to.exist()
expect(results).to.not.exist()
# NOTE: Our test Cypher uses `USING INDEX` to test index usage,
# but Neo4j 2.3+ no longer errors by default on invalid hints:
# http://neo4j.com/docs/stable/configuration-settings.html#config_dbms.cypher.hints.error
# So we explicitly guard against that, and just continue then.
# TODO: Would be nice to test the index another way...
try
expect(err).to.exist()
expect(results).to.not.exist()
catch assertionErr
# HACK: Because this test isn't a Streamline function,
# relying on `fixtures.queryDbVersion` having been called
# already, as part of the suite's setup.
if fixtures.DB_VERSION_NUM >= 2.3
return done()
else
throw assertionErr

# NOTE: At some point, Neo4j regressed and improperly returned
# DatabaseError for this case, rather than ClientError.
Expand Down

0 comments on commit ab07639

Please sign in to comment.