0

So far the setup works very fine using the database with nodejs. I've put it all on circleci, the tests are run via mocha and outputs junit

Fresh database (meaning just created it and ran migrations, no tests yet), the tests pass with no problems. Then, after 2/3 or so deployments, it stop passing and I get stuck with 'unknown relation "xxx"...'

Deleting the db, re-running migrations, redeploying, the tests pass again.

So far it seems that running the tests 'deteriorate' the database after time and it required to make it fresh again. I just have no clue from where it can come from.

I do clean each tables (deleting all records) via a beforehook for each tests, but nothing that particular besides it

Experienced help apreciated

Best.

Ben
  • 5,030
  • 6
  • 53
  • 94

1 Answers1

1

Maybe you can try db.sync({ force: true }) after/before tests so it can drop tables before recreating them.

Syncing

  • Humm, what if you're in prod and this happens ? Not sure you'd force a sync. There might be a specific thing to make sure of – Ben Nov 01 '16 at 23:44
  • Use that only in tests not in production. – Ricardo Seromenho Nov 02 '16 at 00:01
  • Obviously. I meant by that that, if it happens during tests it could happen in production; sync-force won't help to make sure it won't – Ben Nov 02 '16 at 00:03