Skip to content

Commit 6d3a0b5

Browse files
committed
Explain that Docker Desktop is required
1 parent bf75f3b commit 6d3a0b5

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

aws-s3/aws-sdk-v2/src/test/scala/com/gu/etagcaching/aws/sdkv2/s3/S3ObjectFetchingTest.scala

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import com.gu.etagcaching.aws.sdkv2.s3.ExampleParser.parseFruit
88
import com.gu.etagcaching.aws.sdkv2.s3.S3ClientForS3Mock.createS3clientFor
99
import com.gu.etagcaching.aws.sdkv2.s3.TestS3Objects.bucket
1010
import com.gu.etagcaching.aws.sdkv2.s3.response.Transformer.Bytes
11-
import org.scalatest.{BeforeAndAfter, BeforeAndAfterAll, OptionValues}
1211
import org.scalatest.concurrent.{IntegrationPatience, ScalaFutures}
1312
import org.scalatest.flatspec.AnyFlatSpec
1413
import org.scalatest.matchers.should.Matchers
14+
import org.scalatest.{BeforeAndAfterAll, OptionValues}
15+
import org.testcontainers.DockerClientFactory
1516
import software.amazon.awssdk.services.s3.S3AsyncClient
1617
import software.amazon.awssdk.services.s3.model.PutObjectRequest
1718

@@ -31,9 +32,26 @@ case class TestS3Objects(id: Int) {
3132
val example: ObjectId = ObjectId(bucket, s"$id/path")
3233
val nonExistent: ObjectId = ObjectId(bucket, s"$id/nothing-should-be-here")
3334
}
34-
3535
class S3ObjectFetchingTest extends AnyFlatSpec with Matchers with ScalaFutures with OptionValues with IntegrationPatience with BeforeAndAfterAll {
3636

37+
require(DockerClientFactory.instance().isDockerAvailable,
38+
"""This test uses S3Mock/testcontainers/Docker, and requires Docker Engine to be running on the machine.
39+
|
40+
|In GitHub Actions, Docker Engine will be provided by Docker Server, already running:
41+
|- https://github.com/actions/runner-images/blob/13c1652ebc00463d77a4a8acef1a508bc6a606a1/images/ubuntu/Ubuntu2404-Readme.md?plain=1#L75C3-L75C16
42+
|
43+
|On Developer Laptops, Docker Engine will be provided by Docker Desktop, which must be started.
44+
|- Guardian Devs: We have licenses for Docker Desktop, see https://docs.google.com/document/d/1mYVMUM3XIZGQ8LzcwSeufu5k8hxnIzadipg6sOMXi3g/edit?usp=sharing
45+
|
46+
|Without Docker Desktop, alternatives like Colima can be explored, but note that unfortunately:
47+
|- https://github.com/testcontainers/testcontainers-java/issues/5837 - Testcontainers does not currently support different Docker contexts
48+
|- https://www.atamanroman.dev/colima-restcontainers-intellij-setup-on-macos/ - describes a substantial recipe for getting this working
49+
|- https://github.com/testcontainers/testcontainers-java/issues/5034
50+
|
51+
|""".stripMargin
52+
)
53+
54+
3755
val s3Mock: S3MockContainer = new S3MockContainer("latest").withInitialBuckets(TestS3Objects.bucket)
3856
override def beforeAll(): Unit = s3Mock.start()
3957
override def afterAll(): Unit = s3Mock.stop()

0 commit comments

Comments
 (0)