Switch from an in-memory HSQLDB to MariaDB during integration tests #57

Merged
ansv7779 merged 9 commits from testcontainers into develop 2024-12-16 13:55:34 +01:00
Owner

Currently our integration tests run against an in-memory HSQLDB whose schema is created by Hibernate based on our JPA annotations. This has differences from the MariaDB schema created by our Flyway migrations. It is also a completely different database engine so who knows what other differences there are.

This proposal changes this so that it will instead use Testcontainers to spin up a MariaDB Docker container that then has the Flyway migrations ran before being used in tests.

Pros:

  • Same database engine in tests as production
  • Flyway migrations are tested
  • Database schema is the same in tests as production (NOT NULL constraints, foreign keys, and so on)

Cons:

  • Much slower test executions and they will get slower over time as more migrations are added
Currently our integration tests run against an in-memory HSQLDB whose schema is created by Hibernate based on our JPA annotations. This has differences from the MariaDB schema created by our Flyway migrations. It is also a completely different database engine so who knows what other differences there are. This proposal changes this so that it will instead use [Testcontainers](https://testcontainers.com/) to spin up a MariaDB Docker container that then has the Flyway migrations ran before being used in tests. Pros: * Same database engine in tests as production * Flyway migrations are tested * Database schema is the same in tests as production (`NOT NULL` constraints, foreign keys, and so on) Cons: * *Much* slower test executions and they will get slower over time as more migrations are added
ansv7779 added 8 commits 2024-12-05 09:49:04 +01:00
Utilizes Testcontainers to start a MariaDB Docker container to use in tests. The empty database is then migrated using Flyway which means migrations are implicitly tested as well.
It previously did not populate all the required attributes that were checked using NOT NULL constraints in the migration scripts but were not present in the Hibernate generated DDL for HSQLDB.
It previously did not populate all the required attributes that were checked using NOT NULL constraints in the migration scripts but were not present in the Hibernate generated DDL for HSQLDB.
It previously did not populate all the required attributes that were checked using NOT NULL constraints in the migration scripts but were not present in the Hibernate generated DDL for HSQLDB.
It previously did not populate all the required attributes that were checked using NOT NULL constraints in the migration scripts but were not present in the Hibernate generated DDL for HSQLDB.
It previously did not populate all the required attributes that were checked using NOT NULL constraints in the migration scripts but were not present in the Hibernate generated DDL for HSQLDB.
It previously did not populate all the required attributes that were checked using NOT NULL constraints in the migration scripts but were not present in the Hibernate generated DDL for HSQLDB.
Fix FinalSeminarSchedulingTest
All checks were successful
Build and test / build-and-test (push) Successful in 17m46s
2c819985c0
It previously did not populate all the required attributes that were checked using NOT NULL constraints in the migration scripts but were not present in the Hibernate generated DDL for HSQLDB.
niat8586 added 1 commit 2024-12-16 13:27:02 +01:00
Merge branch 'develop' into testcontainers
All checks were successful
Build and test / build-and-test (push) Successful in 16m32s
17bf8a794c
niat8586 approved these changes 2024-12-16 13:46:20 +01:00
niat8586 left a comment
Owner

It's okay that it takes longer to test with testcontainers.
👍

It's okay that it takes longer to test with testcontainers. 👍
ansv7779 merged commit 5fbf4ec0c0 into develop 2024-12-16 13:55:34 +01:00
ansv7779 deleted branch testcontainers 2024-12-16 13:55:34 +01:00
Sign in to join this conversation.
No description provided.