Skip to content

Commit

Permalink
fix: fix testcontainers issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yingtingxu committed Jun 7, 2024
1 parent e78cca6 commit 1b0acc5
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
19 changes: 10 additions & 9 deletions mall-catalog/src/main/resources/schema.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
DROP TABLE IF EXISTS book
CREATE TABLE book (
id BIGSERIAL PRIMARY KEY NOT NULL,
isbn varchar(255) UNIQUE NOT NULL,
title varchar(255) NOT NULL,
author varchar(255) NOT NULL,
price float8 NOT NULL,
created_at timestamp NOT NULL,
last_modified_at timestamp NOT NULL,
version integer NOT NULL
CREATE TABLE book
(
id BIGSERIAL PRIMARY KEY NOT NULL,
isbn varchar(255) UNIQUE NOT NULL,
title varchar(255) NOT NULL,
author varchar(255) NOT NULL,
price float8 NOT NULL,
created_at timestamp NOT NULL,
last_modified_at timestamp NOT NULL,
version integer NOT NULL
);
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
)
//@ActiveProfiles("integration")
@ActiveProfiles("integration")
class ApplicationTests {
@Autowired
private WebTestClient webTestClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@DataJdbcTest
@Import(DatabaseAuditing.class)
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
//@ActiveProfiles("integration")
@ActiveProfiles("integration")
class BookRepositoryJdbcTests {
@Autowired
private BookRepository bookRepository;
Expand Down
4 changes: 4 additions & 0 deletions mall-catalog/src/test/resources/application-integration.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
sql:
init:
mode: always

spring:
datasource:
url: jdbc:tc:postgresql:14.10:///
12 changes: 12 additions & 0 deletions mall-catalog/src/test/resources/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
DROP TABLE IF EXISTS book
CREATE TABLE book
(
id BIGSERIAL PRIMARY KEY NOT NULL,
isbn varchar(255) UNIQUE NOT NULL,
title varchar(255) NOT NULL,
author varchar(255) NOT NULL,
price float8 NOT NULL,
created_at timestamp NOT NULL,
last_modified_at timestamp NOT NULL,
version integer NOT NULL
);

0 comments on commit 1b0acc5

Please sign in to comment.