Skip to content

End to End test for migrations? #541

Closed
@BorntraegerMarc

Description

@BorntraegerMarc

I'm submitting a...


[ ] Bug report  
[ ] Feature request
[X] Question

I was wondering if you @wzrdtales have an idea or a concept on how to make a e2e test for node-db-migrate migrations?

The problem
Multiple times when we wrote DB migrations for our production database we noticed that although the migrations were actually executed perfectly, we made logic mistakes in our migrations; So ether we missed an edge case or an unpredictable DB value appeared and our app crashed afterwards.

Of course we have a database with test data for our development environment. But (as it's usual in development) not 100% of the edge cases are covered in that database.

These cases would have been easily avoidable by having some kind of test framework that developers could adopt to actually test their database migrations.

Possible Solution
A possible solution would be a database e2e testing framework where developers could could configure:

  1. An in-memory database and how the model looks like before the migration is executed
  2. The node-db-migrate migration that needs to be executed
  3. A mocha.js (https://mochajs.org/) file which will execute the JS tests

So the testing framework would check multiple scenarios (with the defined in-memory database) and then check the results with the mocha.js tests.

This issue is more an open discussion than really a feature request. I'm interest in opinions if node-db-migrate should cover such a testing framework.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions