From 580b9277ed4949a66850381d6958f657012a7045 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 5 Nov 2025 06:58:17 -0500 Subject: [PATCH 01/11] spelling: an inference Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- module-6/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-6/README.md b/module-6/README.md index 20dfc92..bada72c 100644 --- a/module-6/README.md +++ b/module-6/README.md @@ -20,7 +20,7 @@ try ( ``` 3. By default, the Ollama Docker images don't have any models inside. -So if we want to actually use it to run any inference we need to download the model into the container. +So if we want to actually use it to run an inference we need to download the model into the container. Create another test method and download a model into the Ollama container. ```java From 49b21238a4673ce1f2e73628e904dd24832ae329 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 5 Nov 2025 06:57:17 -0500 Subject: [PATCH 02/11] spelling: code Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- module-6/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-6/README.md b/module-6/README.md index bada72c..89981cb 100644 --- a/module-6/README.md +++ b/module-6/README.md @@ -4,7 +4,7 @@ We're going to create tests that use an Ollama module and enhance its lifecycle so the modified images are cached. -2. Here's an example of a code that starts the Ollama module, and accesses its API to ensure it's up and running. +2. Here's an example of code that starts the Ollama module, and accesses its API to ensure it's up and running. Put it into the `OllamaContainerTest` class and make it a test. (Note how containers are `AutoCloseable` so you can spin use `try-with-resources` with them). From bf5f78fc29258264ebe22d8a57b4d16721a8bc01 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 5 Nov 2025 06:34:16 -0500 Subject: [PATCH 03/11] spelling: for a container like Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- module-6/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-6/README.md b/module-6/README.md index 89981cb..9247310 100644 --- a/module-6/README.md +++ b/module-6/README.md @@ -116,7 +116,7 @@ if (runtimes != null && runtimes.containsKey("nvidia")) { } ``` -10. You can also limit the resources a container has access to like CPU and memory. Here's an example of a test that checks the GC a Java process selects in constrained environments: +10. You can also limit the resources for a container like CPU and memory. Here's an example of a test that checks the GC a Java process selects in constrained environments: Add it to your test class, run the test, explore the results. ```java From 17e8831ba8d44f5be235ac1a5b5abaa3fd3330a4 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Sun, 2 Nov 2025 16:45:45 -0500 Subject: [PATCH 04/11] spelling: macos Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 24ebe13..d45a611 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,14 @@ Before getting started, let's make sure you have everything you need for this wo You'll need Java 17 or newer for this workshop. Testcontainers libraries are compatible with Java 8+, but this workshop uses a Spring Boot 3.x application which requires Java 17 or newer. -We would recommend using [SDKMAN](https://sdkman.io/) to install Java on your machine if you are using MacOS, Linux or Windows WSL. +We would recommend using [SDKMAN](https://sdkman.io/) to install Java on your machine if you are using macOS, Linux or Windows WSL. ### Install Docker You need to have a Docker environment to use Testcontainers. * You can use Docker Desktop on your machine. * You can use [Testcontainers Cloud](https://testcontainers.com/cloud). If you are going to use Testcontainers Cloud, then you need to install [Testcontainers Desktop](https://testcontainers.com/desktop/) app. -* If you are using MacOS, you can use Testcontainers Desktop Embedded Runtime. +* If you are using macOS, you can use Testcontainers Desktop Embedded Runtime. * If you are using a local Docker, check by running: From 8acd5c02eea211b23ac8bb506b7d815a072a09b9 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Sun, 2 Nov 2025 16:45:57 -0500 Subject: [PATCH 05/11] spelling: set up Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- module-5/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-5/README.md b/module-5/README.md index 049e34a..11dcf0c 100644 --- a/module-5/README.md +++ b/module-5/README.md @@ -65,7 +65,7 @@ public void reset() { 6. Add the call to `snapshot` as the last action to the `containerIsStarted` method. -7. Let's test how it works now. Setup the test `PostgresWithTemplatesTest` by creating the `PostgresWithTemplates` container, wiring the `JDBCTemplate`, and configuring the context to use our container: +7. Let's test how it works now. Set up the test `PostgresWithTemplatesTest` by creating the `PostgresWithTemplates` container, wiring the `JDBCTemplate`, and configuring the context to use our container: ```java static PostgresWithTemplates pg = new PostgresWithTemplates(); From 3f068324118a57bf4b20db7f1227f89b68d0193a Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 5 Nov 2025 09:09:20 -0500 Subject: [PATCH 06/11] spelling: several Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- module-6/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-6/README.md b/module-6/README.md index 9247310..518773a 100644 --- a/module-6/README.md +++ b/module-6/README.md @@ -101,7 +101,7 @@ try ( } ``` -8. Modify the custom image name (to get a clean stat) and run the test a few time to compare the execution time on the first run and the next ones. +8. Modify the custom image name (to get a clean stat) and run the test several time to compare the execution time on the first run and the next ones. 9. A nice detail of the `OllamaContainer` module is how it can automatically determine and enable the GPU support on runtimes that support it. This is code from the OllamaContainer class that does this. Learn how you can use Docker Client API and the `withCreateContainerCmdModifier` method to enable it. From b238ffb2f3af2e3b8c51a5d88792ca1ce37d018e Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Sun, 2 Nov 2025 16:45:28 -0500 Subject: [PATCH 07/11] spelling: testcontainers Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- module-3/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-3/README.md b/module-3/README.md index c30bb89..9ddde3e 100644 --- a/module-3/README.md +++ b/module-3/README.md @@ -6,7 +6,7 @@ messages from it. 1. Annotate `KafkaCatTest` with `@Testcontainers` > [!NOTE] -> `@Tescontainers` will manage lifecycle of containers annotated with `@Container` +> `@Testcontainers` will manage lifecycle of containers annotated with `@Container` 2. Create a network to connect both containers From 4cf4eb560086ffdbc20df1319d7944200ba83cdc Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Sun, 2 Nov 2025 16:46:19 -0500 Subject: [PATCH 08/11] spelling: times Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- module-6/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-6/README.md b/module-6/README.md index 518773a..f246172 100644 --- a/module-6/README.md +++ b/module-6/README.md @@ -101,7 +101,7 @@ try ( } ``` -8. Modify the custom image name (to get a clean stat) and run the test several time to compare the execution time on the first run and the next ones. +8. Modify the custom image name (to get a clean stat) and run the test several times to compare the execution time on the first run and the next ones. 9. A nice detail of the `OllamaContainer` module is how it can automatically determine and enable the GPU support on runtimes that support it. This is code from the OllamaContainer class that does this. Learn how you can use Docker Client API and the `withCreateContainerCmdModifier` method to enable it. From 73993efcc7d6a52ff4f0eba89d64d8bdd77f9e32 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 5 Nov 2025 06:57:56 -0500 Subject: [PATCH 09/11] spelling: use Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- module-6/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-6/README.md b/module-6/README.md index f246172..1dda28d 100644 --- a/module-6/README.md +++ b/module-6/README.md @@ -6,7 +6,7 @@ We're going to create tests that use an Ollama module and enhance its lifecycle 2. Here's an example of code that starts the Ollama module, and accesses its API to ensure it's up and running. Put it into the `OllamaContainerTest` class and make it a test. -(Note how containers are `AutoCloseable` so you can spin use `try-with-resources` with them). +(Note how containers are `AutoCloseable` so you can use `try-with-resources` with them). ```java try ( From 4d0c990d0727f49f34c8623f91ae8d861dff9046 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Sun, 2 Nov 2025 18:39:59 -0500 Subject: [PATCH 10/11] spelling: value Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- module-8/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-8/README.md b/module-8/README.md index a0d18c7..54582d0 100644 --- a/module-8/README.md +++ b/module-8/README.md @@ -71,7 +71,7 @@ helloworld.start(); ``` 10. Now we have the application to point our tunnel to, instantiate the `CloudflaredContainer` and point it to the `helloworld.getFirstMappedPort()`; -11. Assuming you have a valus in the `String url = cloudflare.getPublicUrl();` use the following method to try consuming the url (and ignoring the exceptions if the tunnel is declared, but Cloudflare didn't yet provision it). +11. Assuming you have a value in the `String url = cloudflare.getPublicUrl();` use the following method to try consuming the url (and ignoring the exceptions if the tunnel is declared, but Cloudflare didn't yet provision it). Note that we disable the DNS caching, because the domain might not be available during the first attempt, but we want to ignore it and try without cached DNS later. ```java From 5e096553feb8a673427af2590ad0d2e523ae1411 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 5 Nov 2025 06:59:07 -0500 Subject: [PATCH 11/11] spelling: when..., Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- module-6/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-6/README.md b/module-6/README.md index 1dda28d..a84e0ce 100644 --- a/module-6/README.md +++ b/module-6/README.md @@ -36,7 +36,7 @@ try (OllamaContainer ollama = new OllamaContainer("ollama/ollama:0.1.26")) { assertThat(modelName).contains("all-minilm"); } ``` -4. When you run this test the model is being pulled, and when we rerun the test, it will be pulled again, and again. +4. When you run this test, the model is being pulled, and when we rerun the test, it will be pulled again, and again. This is not ideal, so we can use the `commitToImage` method from the `OllamaContainer` to persist the model in a new Docker image. See how you can use the lower level Docker Client API to work with the images: