You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ test with a "real" Postgres without requiring end users to install and set up a
9
9
10
10
11
11
The release of 1.0 brings major changes to the innards of this library.
12
-
Previous pre 1.x versions used an embedded tarball. This was extemely fast (a major plus), but we switched to a docker based version
12
+
Previous pre 1.x versions used an embedded tarball. This was extremely fast (a major plus), but we switched to a docker based version
13
13
for these reasons:
14
14
15
15
Advantages
@@ -20,7 +20,7 @@ Advantages
20
20
* You need a tarball for every linux distribution as PG 10+ no longer ship a "universal binary" for linux. This means a lot of support and maintenance work.
21
21
* Easy to switch docker image tag to upgrade versions - no need for a whole new pg-embedded version.
22
22
* More maintainable and secure (you can pull docker images you trust, instead of trusting our tarballs running in your security context)
23
-
* Trivial to do a build oneself based on the official Postgres image adding extensions, setup scripts etc - see https://github.com/docker-library/docs/blob/master/postgres/README.md for details.
23
+
* Trivial to do a build oneself based on the official Postgres image adding extensions, setup scripts etc. - see https://github.com/docker-library/docs/blob/master/postgres/README.md for details.
24
24
25
25
Admittedly, a few disadvantages
26
26
---
@@ -53,7 +53,7 @@ public SingleInstancePostgresRule pg = EmbeddedPostgresRules.singleInstance();
53
53
54
54
This simply has JUnit manage an instance of EmbeddedPostgres (start, stop). You can then use this to get a DataSource with: `pg.getEmbeddedPostgres().getPostgresDatabase();`
55
55
56
-
Additionally you may use the [`EmbeddedPostgres`](src/main/java/com/opentable/db/postgres/embedded/EmbeddedPostgres.java) class directly by manually starting and stopping the instance; see [`EmbeddedPostgresTest`](src/test/java/com/opentable/db/postgres/embedded/EmbeddedPostgresTest.java) for an example.
56
+
Additionally, you may use the [`EmbeddedPostgres`](src/main/java/com/opentable/db/postgres/embedded/EmbeddedPostgres.java) class directly by manually starting and stopping the instance; see [`EmbeddedPostgresTest`](src/test/java/com/opentable/db/postgres/embedded/EmbeddedPostgresTest.java) for an example.
57
57
58
58
Default username/password is: postgres/postgres and the default database is 'postgres'
The default is to use the docker hub registry and pull a tag, hardcoded in `EmbeddedPostgres`. Currently this is "13-latest",
100
+
The default is to use the docker hub registry and pull a tag, hardcoded in `EmbeddedPostgres`. Currently, this is "13-latest",
101
101
as this fits the needs of OpenTable, however you can change this easily. This is super useful, both to use a newer version
102
102
of Postgres, or to build your own DockerFile with additional extensions.
103
103
@@ -132,7 +132,7 @@ the network.
132
132
133
133
## Using JUnit5
134
134
135
-
JUnit5 does not have `@Rule`. So below is an example for how to create tests using JUnit5 and embedded postgress, it creates a Spring context and uses JDBI:
135
+
JUnit5 does not have `@Rule`. So below is an example for how to create tests using JUnit5 and embedded postgres, it creates a Spring context and uses JDBI:
136
136
137
137
```java
138
138
@ExtendWith(SpringExtension.class)
@@ -158,7 +158,7 @@ class DaoTestUsingJunit5 {
158
158
}
159
159
160
160
/**
161
-
* This class is here as inner class for brevity
161
+
* This class is here as inner class for brevity,
162
162
* but it's better to have only one for all tests.
163
163
*/
164
164
@Configuration
@@ -232,14 +232,14 @@ But certainly there's no real reason you can't use TestContainers directly - the
232
232
233
233
* Why not _use a maven plugin approach like fabric8-docker-maven?
234
234
235
-
Honestly I suspect this is a better approach in that it doesn't try to maintain it's own version of the Docker API, and
236
-
runs outside the tests, reducing issues like forking and threading conflicts. However it would have been too major an overhaul
235
+
Honestly I suspect this is a better approach in that it doesn't try to maintain its own version of the Docker API, and
236
+
runs outside the tests, reducing issues like forking and threading conflicts. However, it would have been too major an overhaul
237
237
for our users.
238
238
239
239
* "I really prefer the old embedded postgres approach. It's faster."
240
240
* We recommend those who prefer the embedded tarball use https://github.com/zonkyio/embedded-postgres which was forked a couple
241
-
years ago from the embedded branch and is kept reasonably up to date.
242
-
* Another alternative is flapdoodle's embedded postgres.
241
+
of years ago from the embedded branch and is kept reasonably up to date.
242
+
* Another alternative is Flapdoodle's embedded postgres, but that is deprecated in favor of testcontainers too.
243
243
244
244
Both libraries suffer from many of the cons that bedeviled upkeep of this library for years, but they are certainly viable options
0 commit comments