LocalData / localdata-api

API/server for LocalData
http://localdata.com/
BSD 3-Clause "New" or "Revised" License
20 stars 14 forks source link

new dev: tests fail #98

Open bnchdrff opened 11 years ago

bnchdrff commented 11 years ago

What I did:

What I got:

... skip ...
  ✖ 10 of 83 tests failed:

  1) Email Send an email:
     AssertionError: expected [Error: Email failed: 400
<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
  <Error>
    <Type>Sender</Type>
    <Code>MessageRejected</Code>
    <Message>Email address is not verified.</Message>
  </Error>
  <RequestId>3f862dca-23f3-11e3-b1d5-61160a494759</RequestId>
</ErrorResponse>
] to not exist
   expected [Error: Email failed: 400
  <ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
    <Error>
      <Type>Sender</Type>
      <Code>MessageRejected</Code>
      <Message>Email address is not verified.</Message>
    </Error>
    <RequestId>3f862dca-23f3-11e3-b1d5-61160a494759</RequestId>
  </ErrorResponse>
  ] to not exist
      at /home/bc/Desktop/codez/localdata/localdata-api/test/email.js:21:18
      at /home/bc/Desktop/codez/localdata/localdata-api/lib/email.js:34:5
      at IncomingMessage.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/nodemailer/lib/engines/ses.js:130:17)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:883:14
      at process._tickCallback (node.js:415:13)

  2) Shapefile GET shapfile for a survey:
     AssertionError: expected 500 to equal 202
   expected 500 to equal 202
      at Object.Assertion.equal (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/should/lib/should.js:303:10)
      at Request._callback (/home/bc/Desktop/codez/localdata/localdata-api/test/export-shapefile.js:119:36)
      at Request.self.callback (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:148:22)
      at Request.EventEmitter.emit (events.js:98:17)
      at Request.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:876:14)
      at Request.EventEmitter.emit (events.js:117:20)
      at IncomingMessage.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:827:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:883:14
      at process._tickCallback (node.js:415:13)

  3) Parcels GET Get parcels inside a bounding box:
     AssertionError: expected 500 to equal 200
   expected 500 to equal 200
      at Object.Assertion.equal (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/should/lib/should.js:303:10)
      at Request._callback (/home/bc/Desktop/codez/localdata/localdata-api/test/parcels.js:80:36)
      at Request.self.callback (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:148:22)
      at Request.EventEmitter.emit (events.js:98:17)
      at Request.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:876:14)
      at Request.EventEmitter.emit (events.js:117:20)
      at IncomingMessage.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:827:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:883:14
      at process._tickCallback (node.js:415:13)

  4) Parcels GET Get GeoJSON parcels inside a bounding box:
     AssertionError: expected 500 to equal 200
   expected 500 to equal 200
      at Object.Assertion.equal (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/should/lib/should.js:303:10)
      at Request._callback (/home/bc/Desktop/codez/localdata/localdata-api/test/parcels.js:101:36)
      at Request.self.callback (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:148:22)
      at Request.EventEmitter.emit (events.js:98:17)
      at Request.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:876:14)
      at Request.EventEmitter.emit (events.js:117:20)
      at IncomingMessage.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:827:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:883:14
      at process._tickCallback (node.js:415:13)

  5) Parcels GET Get parcels at a point:
     AssertionError: expected 500 to equal 200
   expected 500 to equal 200
      at Object.Assertion.equal (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/should/lib/should.js:303:10)
      at Request._callback (/home/bc/Desktop/codez/localdata/localdata-api/test/parcels.js:143:36)
      at Request.self.callback (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:148:22)
      at Request.EventEmitter.emit (events.js:98:17)
      at Request.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:876:14)
      at Request.EventEmitter.emit (events.js:117:20)
      at IncomingMessage.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:827:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:883:14
      at process._tickCallback (node.js:415:13)

  6) Parcels GET Point query with no results:
     AssertionError: expected 500 to equal 200
   expected 500 to equal 200
      at Object.Assertion.equal (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/should/lib/should.js:303:10)
      at Request._callback (/home/bc/Desktop/codez/localdata/localdata-api/test/parcels.js:179:36)
      at Request.self.callback (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:148:22)
      at Request.EventEmitter.emit (events.js:98:17)
      at Request.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:876:14)
      at Request.EventEmitter.emit (events.js:117:20)
      at IncomingMessage.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:827:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:883:14
      at process._tickCallback (node.js:415:13)

  7) Parcels GET Bounding box query with no results:
     AssertionError: expected 500 to equal 200
   expected 500 to equal 200
      at Object.Assertion.equal (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/should/lib/should.js:303:10)
      at Request._callback (/home/bc/Desktop/codez/localdata/localdata-api/test/parcels.js:197:36)
      at Request.self.callback (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:148:22)
      at Request.EventEmitter.emit (events.js:98:17)
      at Request.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:876:14)
      at Request.EventEmitter.emit (events.js:117:20)
      at IncomingMessage.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:827:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:883:14
      at process._tickCallback (node.js:415:13)

  8) Parcels GET ETag and 304 response:
     AssertionError: expected 500 to equal 200
   expected 500 to equal 200
      at Object.Assertion.equal (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/should/lib/should.js:303:10)
      at Request._callback (/home/bc/Desktop/codez/localdata/localdata-api/test/parcels.js:217:36)
      at Request.self.callback (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:148:22)
      at Request.EventEmitter.emit (events.js:98:17)
      at Request.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:876:14)
      at Request.EventEmitter.emit (events.js:117:20)
      at IncomingMessage.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/node_modules/request/index.js:827:12)
      at IncomingMessage.EventEmitter.emit (events.js:117:20)
      at _stream_readable.js:883:14
      at process._tickCallback (node.js:415:13)

  9) Responses POST Posting a file to /surveys/123/responses:
     Error: Callback was already called.
      at /home/bc/Desktop/codez/localdata/localdata-api/node_modules/async/lib/async.js:22:31
      at ClientRequest.<anonymous> (/home/bc/Desktop/codez/localdata/localdata-api/lib/controllers/responses.js:675:13)
      at ClientRequest.EventEmitter.emit (events.js:117:20)
      at CleartextStream.socketErrorListener (http.js:1487:9)
      at CleartextStream.EventEmitter.emit (events.js:95:17)
      at Socket.onerror (tls.js:1355:17)
      at Socket.EventEmitter.emit (events.js:117:20)
      at onwriteError (_stream_writable.js:223:10)
      at onwrite (_stream_writable.js:241:5)
      at WritableState.onwrite (_stream_writable.js:92:5)
      at fireErrorCallbacks (net.js:423:13)
      at Socket._destroy (net.js:457:3)
      at Object.afterWrite (net.js:700:10)

  10) Static Mobile client "before all" hook:
     Error: connect ECONNREFUSED
      at errnoException (net.js:883:11)
      at Object.afterConnect [as oncomplete] (net.js:874:19)
hampelm commented 11 years ago

Thanks!

Failed test 1 is an AWS email error and expected if there isn't a valid AWS key or if Amazon SES isn't provisioned.

Tests 2-8 above will fail if you don't have any data in the database. We should ship a SQL file with sample data (see #97) to fix those errors.

9 is probably a bug in file uploading. We may not handle a situation where there is an invalid S3 key correctly.

As far as I know, these shouldn't prevent other core parts of the system (eg using the dashboard to create surveys) from working, or the server from starting.

bnchdrff commented 11 years ago

awesome... good deal. i added a TEST_EMAIL env var to setenv_local.sh and settings-test.sh so devs can specify whatever email they use with SES - pushing commit now

hampelm commented 11 years ago

For error 10 above, can you confirm that:

  1. You have the mobile site (localdata-mobile-web) accessible through a web server (probably localhost...)
  2. The REMOTE_MOBILE_PREFIX environment variable is set to that address?

The error is in tests/static.js, and my guess is that the mobile site is unreachable.

bnchdrff commented 11 years ago

i didn't have the mobile server running during tests, so 10 is an easy fix :grinning:

hampelm commented 11 years ago

Cool. You should be able to skip mobile for now if you'd like, especially if you're just developing on the API.

bnchdrff commented 11 years ago

Could the tests insert and delete the postgis data as a fixture?

hampelm commented 10 years ago

Requested in #109