Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OTPL-6466] Using PostgreSQLContainer as a back end with same API #164

Merged
merged 53 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
c456850
Using PostgreSQLContainer as a back end with same API
dkaukov Nov 1, 2021
b8c36cd
Fixed dep. issues
dkaukov Nov 1, 2021
cbf5b5b
Merge branch 'master' into testcontainers
dkaukov Dec 8, 2021
441dee2
WIP: Cleanup
dkaukov Dec 8, 2021
3daf23d
wip
dkaukov Dec 20, 2021
1d45966
WIP
dkaukov Dec 20, 2021
526965a
WIP
dkaukov Dec 20, 2021
0ce3351
WIP
dkaukov Dec 20, 2021
1efc7c0
WIP
dkaukov Dec 20, 2021
29341bc
WIP
dkaukov Dec 20, 2021
f64dd3a
WIP
dkaukov Dec 20, 2021
63c98a7
Refactoring
dkaukov Dec 20, 2021
e93f1e5
Refactoring
dkaukov Dec 20, 2021
39309cb
Remove commons-compress, xz from dependencies
mikebell90 Jan 10, 2022
453d25b
Update to PG 13, add CHANGELOG.md
mikebell90 Jan 10, 2022
7bc513a
PR feedback
dkaukov Jan 10, 2022
9fcec2d
Fill out the README, add configurable env variables and a test
mikebell90 Jan 11, 2022
03e6948
Fixed javadoc
mikebell90 Jan 11, 2022
fd452e4
Fix compatibility check
mikebell90 Jan 11, 2022
94dc8a3
Teamcity
mikebell90 Jan 11, 2022
7425f84
add note
mikebell90 Jan 11, 2022
3305374
add note
mikebell90 Jan 11, 2022
9071ce6
Allow databasename to be set and customized.
mikebell90 Jan 12, 2022
ca7118e
Add another test
mikebell90 Jan 12, 2022
85458c6
Remove unused mockito, objenesis
mikebell90 Jan 12, 2022
141495d
more docs
mikebell90 Jan 12, 2022
5350d3c
more docs
mikebell90 Jan 12, 2022
22d6803
Fixed error reportig
dkaukov Jan 13, 2022
e656f7c
Add note about flyway 8.41
mikebell90 Jan 13, 2022
c3d5d7c
Refactoring
dkaukov Jan 13, 2022
ba637ba
Refactoring (URIBuilder)
dkaukov Jan 14, 2022
4ba8f9e
[maven-release-plugin] prepare release otj-pg-embedded-1.0.0.RC1
dkaukov Jan 14, 2022
5ebb97d
[maven-release-plugin] prepare for next development iteration
dkaukov Jan 14, 2022
ca90295
[maven-release-plugin] rollback the release of otj-pg-embedded-1.0.0.RC1
dkaukov Jan 14, 2022
e7deb86
PR feedback
dkaukov Jan 14, 2022
4c14767
Cleanup
dkaukov Jan 14, 2022
78619e2
Cleanup
dkaukov Jan 14, 2022
a22cb57
[maven-release-plugin] prepare release otj-pg-embedded-1.0.0.RC1
dkaukov Jan 14, 2022
e62e5e3
[maven-release-plugin] prepare for next development iteration
dkaukov Jan 14, 2022
2f9a4b2
Add note that java 11 is required
mikebell90 Jan 18, 2022
c2e4b1a
Add note about docker in docker
mikebell90 Jan 18, 2022
33cf006
A few miscellaneous fixes:
mikebell90 Jan 19, 2022
6dc2182
Update CHANGELOG.md, testcontainers
mikebell90 Jan 19, 2022
6b204e7
[maven-release-plugin] prepare release otj-pg-embedded-1.0.0.RC2
mikebell90 Jan 19, 2022
17f5445
[maven-release-plugin] prepare for next development iteration
mikebell90 Jan 19, 2022
fd254ed
Fix snapshot version
mikebell90 Jan 19, 2022
fd65374
Add some javadoc comments
mikebell90 Jan 19, 2022
56bba3e
1.0.0 candidate fixes (#170)
mikebell90 Jan 27, 2022
9a07541
[maven-release-plugin] prepare release otj-pg-embedded-1.0.0.RC3
mikebell90 Jan 27, 2022
b1f6033
[maven-release-plugin] prepare for next development iteration
mikebell90 Jan 27, 2022
9d1c541
add note
mikebell90 Jan 27, 2022
0d83886
Add network alias support
mikebell90 Jan 27, 2022
d95b128
Add to readme, javadoc better, and add more general bindmount option
mikebell90 Jan 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@

1.0.0
-----
* A completely rewritten version of `otj-pg-embedded`. Uses "testcontainers" for docker, while preserving API compatibility.

Advantages
* multi arch (m1 etc) support
* Works the same way on every OS - Mac, Windows, Linux. Please note the maintainers only test on Mac Linux
* Easy to switch docker image tag to upgrade versions
* More maintainable and secure (you can pull docker images you trust, instead of trusting our tarballs)

A few Disadvantages

* Slower than running a tarball
* A few compatibility drops and options have probably disappeared. Feel free to submit PRs

No further PRs or tickets will be accepted for the pre 1.0.0 release. In addition, before filing tickets, please
test your docker environment etc.

0.13.4
------
* POM 287, Flyway 7
Expand Down
29 changes: 10 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,22 @@ independent databases gives you.

## Postgres version

The JAR file contains bundled version of Postgres. You can pass different Postgres version by implementing [`PgBinaryResolver`](src/main/java/com/opentable/db/postgres/embedded/PgBinaryResolver.java).
It is possible to change postgres version:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adapt some of my wording in CHANGELOG. In particular you should note what. no longer exists

  • Support for a local postgres (for now)
  • any other config options that changed.


Example:
```java
class ClasspathBinaryResolver implements PgBinaryResolver {
public InputStream getPgBinary(String system, String machineHardware) throws IOException {
ClassPathResource resource = new ClassPathResource(format("postgresql-%s-%s.txz", system, machineHardware));
return resource.getInputStream();
}
}

EmbeddedPostgreSQL
.builder()
.setPgBinaryResolver(new ClasspathBinaryResolver())
.start();

EmbeddedPostgres.builder()
.setTag("10")
.start();
```

## Windows
or use custom image:

If you experience difficulty running `otj-pg-embedded` tests on Windows, make sure
you've installed the appropriate MFC redistributables.
```java
EmbeddedPostgres.builder()
.setImage(DockerImageName.parse("docker.otenv.com/super-postgres"))
.start();
```

* [Microsoft Site](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads])
* [Github issue discussing this](https://github.com/opentable/otj-pg-embedded/issues/65)

## Using JUnit5

Expand Down
82 changes: 36 additions & 46 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>com.opentable</groupId>
<artifactId>otj-parent-spring</artifactId>
<version>287</version>
<version>308</version>
</parent>

<scm>
Expand All @@ -31,7 +31,7 @@

<groupId>com.opentable.components</groupId>
<artifactId>otj-pg-embedded</artifactId>
<version>0.13.5-SNAPSHOT</version>
<version>1.01.1-SNAPSHOT</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this isn't 1.0.0?

<description>Embedded PostgreSQL driver</description>

<properties>
Expand All @@ -51,27 +51,6 @@
</license>
</licenses>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>./repack-postgres.sh</executable>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -83,27 +62,6 @@
<artifactId>commons-lang3</artifactId>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
</dependency>

<dependency>
<groupId>org.tukaani</groupId>
<artifactId>xz</artifactId>
<version>1.5</version>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>

<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>

<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
Expand All @@ -120,9 +78,14 @@
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>

<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
</dependency>

<dependency>
Expand Down Expand Up @@ -157,4 +120,31 @@
<scope>test</scope>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>${dep.testcontainers.version}</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>${dep.testcontainers.version}</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dumb question, why did this need to be excluded? To make it optional which version I'm guessing?

<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
</project>
69 changes: 0 additions & 69 deletions repack-postgres.sh

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ public class ConnectionInfo {
private final String dbName;
private final int port;
private final String user;
private final String password;

public ConnectionInfo(final String dbName, final int port, final String user) {
public ConnectionInfo(final String dbName, final int port, final String user, final String password) {
this.dbName = dbName;
this.port = port;
this.user = user;
this.password = password;
}

public String getUser() {
Expand All @@ -35,4 +37,8 @@ public String getDbName() {
public int getPort() {
return port;
}

public String getPassword() {
return password;
}
}
Loading