diff --git a/README.md b/README.md index d89e235..6a1217d 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,7 @@ We will work with a Spring Boot application and explore how to: * [Step 2: Exploring the app](step-2-exploring-the-app.md) * [Step 3: Local Development Environment with Testcontainers](step-3-local-development-environment.md) * [Step 4: Connect to Services](step-4-connect-to-services.md) -* [Step 5: Use Reusable Containers](step-5-use-reusable-containers.md) -* [Step 6: Write Tests](step-6-write-tests.md) +* [Step 5: Write Tests](step-5-write-tests.md) ## License Summary diff --git a/step-3-local-development-environment.md b/step-3-local-development-environment.md index 68feb4a..2e7ad9a 100644 --- a/step-3-local-development-environment.md +++ b/step-3-local-development-environment.md @@ -367,7 +367,7 @@ You should get the following response with `"available":false` because we mocked } ``` -Now we have the working local development environment with PostgreSQL, Kafka, LocalStack, and WireMock. +Now we have a working local development environment with PostgreSQL, Kafka, LocalStack, and WireMock. ### [Next](step-4-connect-to-services.md) diff --git a/step-4-connect-to-services.md b/step-4-connect-to-services.md index 9a3324a..40ccddd 100644 --- a/step-4-connect-to-services.md +++ b/step-4-connect-to-services.md @@ -41,4 +41,4 @@ psql -h localhost -p 5432 -U test -d test Similarly, you can connect to any of your containers using the same approach by using the port-mapping feature of Testcontainers Desktop. ### -[Next](step-5-use-reusable-containers.md) +[Next](step-5-write-tests.md) diff --git a/step-5-use-reusable-containers.md b/step-5-use-reusable-containers.md deleted file mode 100644 index 8c94067..0000000 --- a/step-5-use-reusable-containers.md +++ /dev/null @@ -1,38 +0,0 @@ -# Step 5: Use reusable containers - -During the development, you will keep changing the code and verify the behavior either by running the tests -or running the application locally. Recreating the containers everytime you restart the application -might slow down your quick feedback cycle. - -One technique that you can apply to speed up testing and local development is using the **reusable containers** feature. - -Since you are using the Testcontainers Desktop, the `testcontainers.reuse.enable` flag is set automatically -for your dev environment. -You can enable or disable it by clicking on **Enable reusable containers** option under **Preferences**. - -Once the `reuse` feature is enabled, you need to configure which containers should be reused using the Testcontainers API. -With Testcontainers for Java API, you can achieve this using `.withReuse(true)` as follows: - -```java -@TestConfiguration(proxyBeanMethods = false) -public class ContainersConfig { - - @Bean - @ServiceConnection - PostgreSQLContainer postgresContainer() { - return new PostgreSQLContainer<>(parse("postgres:16-alpine")).withReuse(true); - } - - //Similarly add .withReuse(true) for other containers - -} -``` - -* When you first start the application, the containers will be created. -* When you stop the application, the containers will continue to run. -* When you restart the application again, the containers will be reused. - -If you no longer want to keep the containers running, then you can remove them by clicking on **Testcontainers Desktop → Terminate containers**. - -### -[Next](step-6-write-tests.md) diff --git a/step-6-write-tests.md b/step-5-write-tests.md similarity index 99% rename from step-6-write-tests.md rename to step-5-write-tests.md index eb2fc4f..826b9af 100644 --- a/step-6-write-tests.md +++ b/step-5-write-tests.md @@ -1,4 +1,4 @@ -# Step 6: Let's write tests +# Step 5: Let's write tests So far, we focused on being able to run the application locally without having to install or run any dependent services manually. But there is nothing more painful than working on a codebase without a comprehensive test suite.