Skip to content

Commit

Permalink
Switch to Postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosanchez committed Jan 22, 2024
1 parent f635ea5 commit 37c1afc
Show file tree
Hide file tree
Showing 38 changed files with 60 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:

- name: Eagerly pull Docker images
run: |
docker pull mysql:latest

This comment has been minimized.

Copy link
@radovanradic

radovanradic Jan 22, 2024

Contributor

Maybe you already realized, there is an issue with latest mysql docker image testcontainers/testcontainers-java#8131
I have switched to 8.2.0 in micronaut-data until this is resolved.

This comment has been minimized.

Copy link
@alvarosanchez

alvarosanchez Jan 22, 2024

Author Member

Woah, I was getting crazy about this! I wanted to switch to Postgres anyway sine it's a bit faster.

Thank you very much for the heads up!

docker pull postgres:latest
- name: Run tests
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand All @@ -108,11 +108,11 @@
<testResourcesDependencies>
<dependency>
<groupId>io.micronaut.testresources</groupId>
<artifactId>micronaut-test-resources-jdbc-mysql</artifactId>
<artifactId>micronaut-test-resources-jdbc-postgresql</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
</testResourcesDependencies>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import java.util.List;

@JdbcRepository(dialect = Dialect.MYSQL)
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface BookRepository extends CrudRepository<Book, Long> {
@Override
List<Book> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.List;

//@Repository("users")
@JdbcRepository(dialect = Dialect.MYSQL)
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface UserRepository extends CrudRepository<User, Long> {
@Override
List<User> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ netty:
max-order: 3
datasources:
default:
schema-generate: CREATE
dialect: MYSQL
# users:
# driverClassName: org.postgresql.Driver
# schema-generate: CREATE_DROP
# dialect: POSTGRES
driverClassName: org.postgresql.Driver
schema-generate: CREATE_DROP
dialect: POSTGRES
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void testCustomProperty() {
}
*/
@Test
@DisplayName("A MySQL test container is required to run this test")
@DisplayName("A POSTGRES test container is required to run this test")
void testItWorks() {
Book book = new Book();
book.setTitle("Yet Another Book " + UUID.randomUUID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ netty:
max-order: 3
datasources:
default:
driverClassName: org.postgresql.Driver
schema-generate: CREATE
dialect: MYSQL
# users:
# driverClassName: org.postgresql.Driver
# schema-generate: CREATE_DROP
# dialect: POSTGRES
dialect: POSTGRES
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import java.util.List;

@JdbcRepository(dialect = Dialect.MYSQL)
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface BookRepository extends CrudRepository<Book, Long> {
@Override
List<Book> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.List;

//@Repository("users")
@JdbcRepository(dialect = Dialect.MYSQL)
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface UserRepository extends CrudRepository<User, Long> {
@Override
List<User> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ netty:
datasources:
default:
schema-generate: CREATE
dialect: MYSQL
# users:
# driverClassName: org.postgresql.Driver
# schema-generate: CREATE_DROP
# dialect: POSTGRES
driverClassName: org.postgresql.Driver
dialect: POSTGRES
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DemoTest {
BookRepository bookRepository;

@Test
@DisplayName("A MySQL test container is required to run this test")
@DisplayName("A POSTGRES test container is required to run this test")
void testItWorks() {
Book book = new Book();
book.setTitle("Yet Another Book " + UUID.randomUUID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import java.util.List;

@JdbcRepository(dialect = Dialect.MYSQL)
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface BookRepository extends CrudRepository<Book, Long> {
@Override
List<Book> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.List;

//@Repository("users")
@JdbcRepository(dialect = Dialect.MYSQL)
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface UserRepository extends CrudRepository<User, Long> {
@Override
List<User> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ netty:
datasources:
default:
schema-generate: CREATE
dialect: MYSQL
# users:
# driverClassName: org.postgresql.Driver
# schema-generate: CREATE_DROP
# dialect: POSTGRES
driverClassName: org.postgresql.Driver
dialect: POSTGRES
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void testCustomProperty() {
}
*/
@Test
@DisplayName("A MySQL test container is required to run this test")
@DisplayName("A postgres test container is required to run this test")
void testItWorks() {
Book book = new Book();
book.setTitle("Yet Another Book " + UUID.randomUUID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ assert log.exists()
assert log.text.contains("BUILD SUCCESS") : "Build did not succeed"
assert log.text.contains("Starting Micronaut Test Resources service") : "Test Resources service was not started"
assert log.text.contains("Shutting down Micronaut Test Resources service") : "Test Resources service was not shutdown"
assert log.text.contains("Container mysql:latest started") : "mysql container was not started"
assert log.text.contains("Container postgres:latest started") : "postgres container was not started"
assert log.text.contains("Startup completed in") : "Startup was not completed"

String port = new File(basedir, "target/test-resources-port.txt").text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import java.util.List;

@JdbcRepository(dialect = Dialect.MYSQL)
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface BookRepository extends CrudRepository<Book, Long> {
@Override
List<Book> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.List;

//@Repository("users")
@JdbcRepository(dialect = Dialect.MYSQL)
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface UserRepository extends CrudRepository<User, Long> {
@Override
List<User> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ netty:
datasources:
default:
schema-generate: CREATE
dialect: MYSQL
# users:
# driverClassName: org.postgresql.Driver
# schema-generate: CREATE_DROP
# dialect: POSTGRES
driverClassName: org.postgresql.Driver
dialect: POSTGRES
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void testCustomProperty() {
}
*/
@Test
@DisplayName("A MySQL test container is required to run this test")
@DisplayName("A postgres test container is required to run this test")
void testItWorks() {
Book book = new Book();
book.setTitle("Yet Another Book " + UUID.randomUUID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import java.util.List;

@JdbcRepository(dialect = Dialect.MYSQL)
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface BookRepository extends CrudRepository<Book, Long> {
@Override
List<Book> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.List;

//@Repository("users")
@JdbcRepository(dialect = Dialect.MYSQL)
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface UserRepository extends CrudRepository<User, Long> {
@Override
List<User> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ netty:
datasources:
default:
schema-generate: CREATE
dialect: MYSQL
# users:
# driverClassName: org.postgresql.Driver
# schema-generate: CREATE_DROP
# dialect: POSTGRES
driverClassName: org.postgresql.Driver
dialect: POSTGRES
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void testCustomProperty() {
}
*/
@Test
@DisplayName("A MySQL test container is required to run this test")
@DisplayName("A postgres test container is required to run this test")
void testItWorks() {
Book book = new Book();
book.setTitle("Yet Another Book " + UUID.randomUUID());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import java.util.List;

@JdbcRepository(dialect = Dialect.MYSQL)
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface BookRepository extends CrudRepository<Book, Long> {
@Override
List<Book> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.List;

//@Repository("users")
@JdbcRepository(dialect = Dialect.MYSQL)
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface UserRepository extends CrudRepository<User, Long> {
@Override
List<User> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ netty:
datasources:
default:
schema-generate: CREATE
dialect: MYSQL
# users:
# driverClassName: org.postgresql.Driver
# schema-generate: CREATE_DROP
# dialect: POSTGRES
driverClassName: org.postgresql.Driver
dialect: POSTGRES
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import java.util.List;

@JdbcRepository(dialect = Dialect.MYSQL)
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface BookRepository extends CrudRepository<Book, Long> {
@Override
List<Book> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.List;

//@Repository("users")
@JdbcRepository(dialect = Dialect.MYSQL)
@JdbcRepository(dialect = Dialect.POSTGRES)
public interface UserRepository extends CrudRepository<User, Long> {
@Override
List<User> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ micronaut:
name: test-resources
datasources:
default:
driver-class-name: com.mysql.cj.jdbc.Driver
db-type: mysql
schema-generate: CREATE
dialect: MYSQL
driver-class-name: org.postgresql.Driver
db-type: postgres
schema-generate: CREATE_DROP
dialect: POSTGRES
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void testCustomProperty() {
}
*/
@Test
@DisplayName("A MySQL test container is required to run this test")
@DisplayName("A postgres test container is required to run this test")
void testItWorks() {
Book book = new Book();
book.setTitle("Yet Another Book " + UUID.randomUUID());
Expand Down

0 comments on commit 37c1afc

Please sign in to comment.