{"id":102364,"date":"2020-02-28T13:00:57","date_gmt":"2020-02-28T11:00:57","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=102364"},"modified":"2020-02-28T12:21:25","modified_gmt":"2020-02-28T10:21:25","slug":"quarkus-tests-with-testcontainers-and-postgresql","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html","title":{"rendered":"Quarkus tests with Testcontainers and PostgreSQL"},"content":{"rendered":"<p><a href=\"https:\/\/www.testcontainers.org\" target=\"_blank\" rel=\"noopener noreferrer\">Testcontainers<\/a> is a Java library that allows integrating Docker containers in JUnit tests with ease. In a <em>Containerized World<\/em>, there is little sense to complicate the tests configuration with embedded databases and services. Instead, use run your services in Docker and let the Testcontainers manage this for you. So if you are need Redis, MongoDB or PostgreSQL in your tests &#8211; Testcontainers may become your good friend.<\/p>\n<p>In this blog post you will learn how to configure Testcontainers to manage PostgreSQL instance in Quarkus integration tests.<\/p>\n<h2 class=\"wp-block-heading\">Dependencies<\/h2>\n<p>In order to use Testcontainers with PostgreSQL you need to add the following dependencies to the <code>pom.xml<\/code>:<\/p>\n<pre class=\"wp-block-preformatted brush:xml\">&lt;dependency&gt;\n    &lt;groupId&gt;org.testcontainers&lt;\/groupId&gt;\n    &lt;artifactId&gt;testcontainers&lt;\/artifactId&gt;\n    &lt;version&gt;1.12.5&lt;\/version&gt;\n    &lt;scope&gt;test&lt;\/scope&gt;\n&lt;\/dependency&gt;\n&lt;dependency&gt;\n    &lt;groupId&gt;org.testcontainers&lt;\/groupId&gt;\n    &lt;artifactId&gt;postgresql&lt;\/artifactId&gt;\n    &lt;version&gt;1.12.5&lt;\/version&gt;\n    &lt;scope&gt;test&lt;\/scope&gt;\n&lt;\/dependency&gt;<\/pre>\n<p>Note: Testcontainers provides JUnit 5 plugin, but in the scenario presented in this article it is not needed.<\/p>\n<h2 class=\"wp-block-heading\">Test datasource configuration<\/h2>\n<p>The default PostgreSQL configuration in Quarkus application may look like below:<\/p>\n<pre class=\"wp-block-preformatted brush:java\">quarkus.datasource.url=jdbc:postgresql:\/\/localhost:5432\/some-db\nquarkus.datasource.driver=org.postgresql.Driver\nquarkus.datasource.username=user\nquarkus.datasource.password=password<\/pre>\n<p>By default, this configuration will be used in any active profile. The built-in profiles in Quarkus are: <code>dev<\/code>, <code>prod<\/code> and <code>test<\/code>. The <code>test<\/code> profile will be used every time you run the <code>@QuarkusTest<\/code>.<\/p>\n<p>You can adjust <code>test<\/code> profile by providing the <code>%test.<\/code> prefix to the configuration properties in <code>src\/main\/application.properties<\/code> file. This allows to configure (and launch) PostgreSQL database container via <strong>JDBC URL scheme<\/strong>. To achieve this make sure to:<\/p>\n<ul class=\"wp-block-list\">\n<li>set the driver to <code>org.testcontainers.jdbc.ContainerDatabaseDriver<\/code>. This <em>special<\/em> driver makes sure Docker container is created and run once we need a datasource in the application,<\/li>\n<li>set the dialect explicitly to <code>org.hibernate.dialect.PostgreSQL9Dialect<\/code> otherwise you get the exception while starting the application:<\/li>\n<\/ul>\n<pre class=\"wp-block-preformatted brush:java\">org.junit.jupiter.api.extension.TestInstantiationException: TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [pl.codeleak.samples.OwnerResourceTest]: io.quarkus.builder.BuildException: Build failure: Build failed due to errors\n <\/pre>\n<p>[error]<\/p>\n<p>: Build step io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor#build threw an exception: io.quarkus.deployment.configuration.ConfigurationError: Hibernate extension could not guess the dialect from the driver &#8216;org.testcontainers.jdbc.ContainerDatabaseDriver&#8217;. Add an explicit &#8216;quarkus.hibernate-orm.dialect&#8217; property.<br \/>\n at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.guessDialect(HibernateOrmProcessor.java:715)\n<\/p>\n<ul class=\"wp-block-list\">\n<li>set the JDBC URL to <code>jdbc:tc:postgresql:latest:\/\/\/dbname<\/code> so that Testcontainers knows which PostgreSQL version to use while running the container.<\/li>\n<\/ul>\n<p>The complete configuration:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"wp-block-preformatted brush:java\"># initializes container for driver initialization\n%test.quarkus.datasource.driver=org.testcontainers.jdbc.ContainerDatabaseDriver\n\n# dialect must be set explicitly\n%test.quarkus.hibernate-orm.dialect=org.hibernate.dialect.PostgreSQL9Dialect\n\n# Testcontainers JDBC URL\n%test.quarkus.datasource.url=jdbc:tc:postgresql:latest:\/\/\/dbname<\/pre>\n<p>With the configuration in place, you can run the tests and observe that the test container is created for the test:<\/p>\n<pre class=\"wp-block-preformatted brush:java\">$ .\/mvnw clean test\n\n[INFO] -------------------------------------------------------\n[INFO]  T E S T S\n[INFO] -------------------------------------------------------\n[INFO] Running pl.codeleak.samples.OwnerResourceTest\n2020-02-27 21:09:21,096 INFO  [io.qua.fly.FlywayProcessor] (build-8) Adding application migrations in path '\/Users\/rafal.borowiec\/Projects\/quarkus\/quarkus-postgres-sample\/target\/classes\/db\/migration' using protocol 'file'\n2020-02-27 21:09:23,084 INFO  [org.fly.cor.int.lic.VersionPrinter] (main) Flyway Community Edition 6.1.4 by Redgate\n2020-02-27 21:09:23,176 INFO  [org.tes.doc.DockerClientProviderStrategy] (Agroal_1012722761) Loaded org.testcontainers.dockerclient.UnixSocketClientProviderStrategy from ~\/.testcontainers.properties, will try it first\n2020-02-27 21:09:23,658 INFO  [org.tes.doc.UnixSocketClientProviderStrategy] (Agroal_1012722761) Accessing docker with local Unix socket\n2020-02-27 21:09:23,659 INFO  [org.tes.doc.DockerClientProviderStrategy] (Agroal_1012722761) Found Docker environment with local Unix socket (unix:\/\/\/var\/run\/docker.sock)\n2020-02-27 21:09:23,780 INFO  [org.tes.DockerClientFactory] (Agroal_1012722761) Docker host IP address is localhost\n2020-02-27 21:09:23,815 INFO  [org.tes.DockerClientFactory] (Agroal_1012722761) Connected to docker:\n  Server Version: 19.03.2\n  API Version: 1.40\n  Operating System: Docker Desktop\n  Total Memory: 1998 MB\n2020-02-27 21:09:23,957 INFO  [org.tes.uti.RegistryAuthLocator] (Agroal_1012722761) Credential helper\/store (docker-credential-desktop) does not have credentials for quay.io\n2020-02-27 21:09:24,857 INFO  [org.tes.DockerClientFactory] (Agroal_1012722761) Ryuk started - will monitor and terminate Testcontainers containers on JVM exit\n2020-02-27 21:09:24,857 INFO  [org.tes.DockerClientFactory] (Agroal_1012722761) Checking the system...\n2020-02-27 21:09:24,858 INFO  [org.tes.DockerClientFactory] (Agroal_1012722761) \u2714\ufe0e Docker server version should be at least 1.6.0\n2020-02-27 21:09:25,040 INFO  [org.tes.DockerClientFactory] (Agroal_1012722761) \u2714\ufe0e Docker environment should have more than 2GB free disk space\n2020-02-27 21:09:25,078 INFO  [\ud83d\udc33 [postgres:latest]] (Agroal_1012722761) Creating container for image: postgres:latest\n2020-02-27 21:09:25,135 INFO  [org.tes.uti.RegistryAuthLocator] (Agroal_1012722761) Credential helper\/store (docker-credential-desktop) does not have credentials for index.docker.io\n2020-02-27 21:09:25,247 INFO  [\ud83d\udc33 [postgres:latest]] (Agroal_1012722761) Starting container with ID: b436fdabccbe51ba3e6d778d4429505473995d4185a200aef35c4c30b2159369\n2020-02-27 21:09:25,779 INFO  [\ud83d\udc33 [postgres:latest]] (Agroal_1012722761) Container postgres:latest is starting: b436fdabccbe51ba3e6d778d4429505473995d4185a200aef35c4c30b2159369\n2020-02-27 21:09:26,896 INFO  [\ud83d\udc33 [postgres:latest]] (Agroal_1012722761) Container postgres:latest started in PT3.731519S\n2020-02-27 21:09:27,107 INFO  [org.fly.cor.int.dat.DatabaseFactory] (main) Database: jdbc:postgresql:\/\/localhost:32830\/test (PostgreSQL 12.2)\n2020-02-27 21:09:27,146 INFO  [org.fly.cor.int.sch.JdbcTableSchemaHistory] (main) Creating Schema History table \"public\".\"flyway_schema_history\" ...\n2020-02-27 21:09:27,188 INFO  [org.fly.cor.int.com.DbMigrate] (main) Current version of schema \"public\": &lt;&lt; Empty Schema &gt;&gt;\n2020-02-27 21:09:27,193 INFO  [org.fly.cor.int.com.DbMigrate] (main) Migrating schema \"public\" to version 1.0.0 - Init\n2020-02-27 21:09:27,201 INFO  [org.fly.cor.int.sql.DefaultSqlScriptExecutor] (main) DB: table \"owners\" does not exist, skipping\n2020-02-27 21:09:27,226 INFO  [org.fly.cor.int.com.DbMigrate] (main) Successfully applied 1 migration to schema \"public\" (execution time 00:00.050s)\n2020-02-27 21:09:27,726 INFO  [io.quarkus] (main) Quarkus 1.2.1.Final started in 5.761s. Listening on: http:\/\/0.0.0.0:8081\n2020-02-27 21:09:27,727 INFO  [io.quarkus] (main) Profile test activated.\n2020-02-27 21:09:27,727 INFO  [io.quarkus] (main) Installed features: [agroal, cdi, flyway, hibernate-orm, hibernate-orm-panache, hibernate-validator, jdbc-postgresql, narayana-jta, resteasy, resteasy-jackson]\n[INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 10.091 s - in pl.codeleak.samples.OwnerResourceTest\n2020-02-27 21:09:29,975 INFO  [io.quarkus] (main) Quarkus stopped in 0.689s\n[INFO]\n[INFO] Results:\n[INFO]\n[INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0\n[INFO]\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time:  15.375 s\n[INFO] Finished at: 2020-02-27T21:09:30+01:00\n[INFO] ------------------------------------------------------------------------<\/pre>\n<p>See more on database configuration in the official documentation here: <a href=\"https:\/\/www.testcontainers.org\/modules\/databases\/\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.testcontainers.org\/modules\/databases\/<\/a><\/p>\n<h2 class=\"wp-block-heading\">Initializing test database<\/h2>\n<p>You have several options to initialize the databse. You can initialize the database with <code>Flyway<\/code>, but you can also use Testcontainers to run the init script after database is started but before the connection is returned to the code.<\/p>\n<h3 class=\"wp-block-heading\">Using Flyway to initialize test database<\/h3>\n<p>With Flyway, the migration scripts can be adjusted only for the test profile the same way we adjusted the datasource &#8211; by adding the <code>%test.<\/code> prefix to the configuration properties. This way you can setup different migration files locations and\/or you can configure different prefix for the migration files:<\/p>\n<pre class=\"wp-block-preformatted brush:java\">%test.quarkus.flyway.locations=test_db\/migration\n%test.quarkus.flyway.sql-migration-prefix=test_<\/pre>\n<p>With the above configuration you may need to create <code>test\/src\/resources\/test_db\/migration<\/code> and put in it for example <code>test_1.0.0_schema.sql<\/code> file (the name pattern is <code>test_version_description.sql<\/code>).<\/p>\n<p>Tip: Don\u2019t forget to add Flyway Quarkus extension to the <code>pom.xml<\/code>.<\/p>\n<h3 class=\"wp-block-heading\">Using Testcontainers to initialize test database<\/h3>\n<p>If you don\u2019t want to use Flyway in tests, you may initialize the database with the script loaded by Testcontainers. The file can be loaded either directly from the classpath or from any location. The only thing to do is to change the JDBC URL:<\/p>\n<pre class=\"wp-block-preformatted brush:java\">%test.quarkus.datasource.url=jdbc:tc:postgresql:latest:\/\/\/dbname?TC_INITSCRIPT=file:src\/main\/resources\/init_pg.sql<\/pre>\n<p>or<\/p>\n<pre class=\"wp-block-preformatted brush:java\">%test.quarkus.datasource.url=jdbc:tc:postgresql:latest:\/\/\/dbname?TC_INITSCRIPT=classpath:init_pg.sql<\/pre>\n<h2 class=\"wp-block-heading\">Source code<\/h2>\n<p>The source code for this article can be found on Github: <a href=\"https:\/\/github.com\/kolorobot\/quarkus-postgres-sample\/tree\/testcontainers\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/kolorobot\/quarkus-postgres-sample<\/a> (<code>testcontainers<\/code> branch)<\/p>\n<h2 class=\"wp-block-heading\">Links<\/h2>\n<ul class=\"wp-block-list\">\n<li>Testcontainers &#8211; <a href=\"https:\/\/www.testcontainers.org\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/www.testcontainers.org<\/a><\/li>\n<li>PetClinic REST API with Quarkus &#8211; <a href=\"https:\/\/blog.codeleak.pl\/2020\/02\/getting-started-with-quarkus.html\" target=\"_blank\" rel=\"noopener noreferrer\">Getting started with Quarkus &#8211; build PetClinic REST API <\/a><\/li>\n<\/ul>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>\n<p>Published on Java Code Geeks with permission by Rafal Borowiec, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener noreferrer\">JCG program<\/a>. See the original article here: <a href=\"https:\/\/blog.codeleak.pl\/2020\/02\/testcontainers-with-quarkus-tests.html\" target=\"_blank\" rel=\"noopener noreferrer\">Quarkus tests with Testcontainers and PostgreSQL<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Testcontainers is a Java library that allows integrating Docker containers in JUnit tests with ease. In a Containerized World, there is little sense to complicate the tests configuration with embedded databases and services. Instead, use run your services in Docker and let the Testcontainers manage this for you. So if you are need Redis, MongoDB &hellip;<\/p>\n","protected":false},"author":516,"featured_media":24013,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[936,657],"class_list":["post-102364","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","tag-docker","tag-postgresql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Quarkus tests with Testcontainers and PostgreSQL - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn about Testcontainers? Check our article talking about Testcontainers a Java library that allows integrating Docker in JUnit tests.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Quarkus tests with Testcontainers and PostgreSQL - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about Testcontainers? Check our article talking about Testcontainers a Java library that allows integrating Docker in JUnit tests.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-28T11:00:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Rafal Borowiec\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/kolorobot\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rafal Borowiec\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/02\\\/quarkus-tests-with-testcontainers-and-postgresql.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/02\\\/quarkus-tests-with-testcontainers-and-postgresql.html\"},\"author\":{\"name\":\"Rafal Borowiec\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/b1a0b2657d5dd2459806446ac66d2d52\"},\"headline\":\"Quarkus tests with Testcontainers and PostgreSQL\",\"datePublished\":\"2020-02-28T11:00:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/02\\\/quarkus-tests-with-testcontainers-and-postgresql.html\"},\"wordCount\":602,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/02\\\/quarkus-tests-with-testcontainers-and-postgresql.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"keywords\":[\"Docker\",\"PostgreSQL\"],\"articleSection\":[\"DevOps\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/02\\\/quarkus-tests-with-testcontainers-and-postgresql.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/02\\\/quarkus-tests-with-testcontainers-and-postgresql.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/02\\\/quarkus-tests-with-testcontainers-and-postgresql.html\",\"name\":\"Quarkus tests with Testcontainers and PostgreSQL - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/02\\\/quarkus-tests-with-testcontainers-and-postgresql.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/02\\\/quarkus-tests-with-testcontainers-and-postgresql.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"datePublished\":\"2020-02-28T11:00:57+00:00\",\"description\":\"Interested to learn about Testcontainers? Check our article talking about Testcontainers a Java library that allows integrating Docker in JUnit tests.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/02\\\/quarkus-tests-with-testcontainers-and-postgresql.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/02\\\/quarkus-tests-with-testcontainers-and-postgresql.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/02\\\/quarkus-tests-with-testcontainers-and-postgresql.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/docker-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/02\\\/quarkus-tests-with-testcontainers-and-postgresql.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DevOps\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/devops\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Quarkus tests with Testcontainers and PostgreSQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/b1a0b2657d5dd2459806446ac66d2d52\",\"name\":\"Rafal Borowiec\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g\",\"caption\":\"Rafal Borowiec\"},\"description\":\"Software developer, Team Leader, Agile practitioner, occasional blogger, lecturer. Open Source enthusiast, quality oriented and open-minded.\",\"sameAs\":[\"http:\\\/\\\/blog.codeleak.pl\\\/\",\"http:\\\/\\\/pl.linkedin.com\\\/in\\\/borowiec\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/kolorobot\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/rafal-borowiec\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Quarkus tests with Testcontainers and PostgreSQL - Java Code Geeks","description":"Interested to learn about Testcontainers? Check our article talking about Testcontainers a Java library that allows integrating Docker in JUnit tests.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html","og_locale":"en_US","og_type":"article","og_title":"Quarkus tests with Testcontainers and PostgreSQL - Java Code Geeks","og_description":"Interested to learn about Testcontainers? Check our article talking about Testcontainers a Java library that allows integrating Docker in JUnit tests.","og_url":"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2020-02-28T11:00:57+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","type":"image\/jpeg"}],"author":"Rafal Borowiec","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/kolorobot","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Rafal Borowiec","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html"},"author":{"name":"Rafal Borowiec","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/b1a0b2657d5dd2459806446ac66d2d52"},"headline":"Quarkus tests with Testcontainers and PostgreSQL","datePublished":"2020-02-28T11:00:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html"},"wordCount":602,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","keywords":["Docker","PostgreSQL"],"articleSection":["DevOps"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html","url":"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html","name":"Quarkus tests with Testcontainers and PostgreSQL - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","datePublished":"2020-02-28T11:00:57+00:00","description":"Interested to learn about Testcontainers? Check our article talking about Testcontainers a Java library that allows integrating Docker in JUnit tests.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/04\/docker-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2020\/02\/quarkus-tests-with-testcontainers-and-postgresql.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"DevOps","item":"https:\/\/www.javacodegeeks.com\/category\/devops"},{"@type":"ListItem","position":3,"name":"Quarkus tests with Testcontainers and PostgreSQL"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/b1a0b2657d5dd2459806446ac66d2d52","name":"Rafal Borowiec","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e24680b2ba3dfc13759acf6c1f125e54356bc533e0befe953fea365cadcdaffb?s=96&d=mm&r=g","caption":"Rafal Borowiec"},"description":"Software developer, Team Leader, Agile practitioner, occasional blogger, lecturer. Open Source enthusiast, quality oriented and open-minded.","sameAs":["http:\/\/blog.codeleak.pl\/","http:\/\/pl.linkedin.com\/in\/borowiec\/","https:\/\/x.com\/https:\/\/twitter.com\/kolorobot"],"url":"https:\/\/www.javacodegeeks.com\/author\/rafal-borowiec"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/102364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/516"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=102364"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/102364\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/24013"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=102364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=102364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=102364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}