Repository: 7mind/izumi
Pull request #1070 (2020-05-20 22:12:42)

distage-framework-docker: rename DockerContainerModule to DockerSupportModule
DockerContainerModule is misnamed - the module adds the infrastructure required to launch docker containers, not adds a specific container

codecov-commenter: # [Codecov](https://codecov.io/gh/7mind/izumi/pull/1070?src=pr&el=h1) Report
> Merging [#1070](https://codecov.io/gh/7mind/izumi/pull/1070?src=pr&el=desc) into [develop](https://codecov.io/gh/7mind/izumi/commit/f8bfc125816eaecd91c91c0d8d7e89a80e2ed1aa&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `0.00%`.


```diff
@@             Coverage Diff             @@
##           develop    #1070      +/-   ##
===========================================
- Coverage    55.68%   55.66%   -0.02%     
===========================================
  Files          380      380              
  Lines         6909     6909              
  Branches       357      364       +7     
===========================================
- Hits          3847     3846       -1     
- Misses        3062     3063       +1     
```


Patch:
diff --git a/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/CassandraDocker.scala b/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/CassandraDocker.scala
index 2a13a4616..9bc067c2d 100644
--- a/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/CassandraDocker.scala
+++ b/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/CassandraDocker.scala
@@ -21,3 +21,7 @@ class CassandraDockerModule[F[_]: TagK] extends ModuleDef {
     CassandraDocker.make[F]
   }
 }
+
+object CassandraDockerModule {
+  def apply[F[_]: TagK]: CassandraDockerModule[F] = new CassandraDockerModule[F]
+}
diff --git a/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/DynamoDocker.scala b/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/DynamoDocker.scala
index 8bdd51bef..666aaa883 100644
--- a/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/DynamoDocker.scala
+++ b/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/DynamoDocker.scala
@@ -20,3 +20,7 @@ class DynamoDockerModule[F[_]: TagK] extends ModuleDef {
     DynamoDocker.make[F]
   }
 }
+
+object DynamoDockerModule {
+  def apply[F[_]: TagK]: DynamoDockerModule[F] = new DynamoDockerModule[F]
+}
diff --git a/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/KafkaDocker.scala b/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/KafkaDocker.scala
index ea9291f66..f3bdcb3b5 100644
--- a/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/KafkaDocker.scala
+++ b/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/KafkaDocker.scala
@@ -29,3 +29,7 @@ class KafkaDockerModule[F[_]: TagK] extends ModuleDef {
       }
   }
 }
+
+object KafkaDockerModule {
+  def apply[F[_]: TagK]: KafkaDockerModule[F] = new KafkaDockerModule[F]
+}
diff --git a/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/PostgresDocker.scala b/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/PostgresDocker.scala
index 16c9ff712..1ed828a04 100644
--- a/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/PostgresDocker.scala
+++ b/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/PostgresDocker.scala
@@ -22,3 +22,7 @@ class PostgresDockerModule[F[_]: TagK] extends ModuleDef {
     PostgresDocker.make[F]
   }
 }
+
+object PostgresDockerModule {
+  def apply[F[_]: TagK]: PostgresDockerModule[F] = new PostgresDockerModule[F]
+}
diff --git a/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/ZookkeeperDocker.scala b/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/ZookkeeperDocker.scala
index a48c64372..8e91b43a9 100644
--- a/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/ZookkeeperDocker.scala
+++ b/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/examples/ZookkeeperDocker.scala
@@ -23,3 +23,7 @@ class ZookeeperDockerModule[F[_]: TagK] extends ModuleDef {
       .connectToNetwork(KafkaZookeeperNetwork)
   }
 }
+
+object ZookeeperDockerModule {
+  def apply[F[_]: TagK]: ZookeeperDockerModule[F] = new ZookeeperDockerModule[F]
+}
diff --git a/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/modules/DockerContainerModule.scala b/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/modules/DockerSupportModule.scala
similarity index 72%
rename from distage/distage-framework-docker/src/main/scala/izumi/distage/docker/modules/DockerContainerModule.scala
rename to distage/distage-framework-docker/src/main/scala/izumi/distage/docker/modules/DockerSupportModule.scala
index 9fa063150..cae83f373 100644
--- a/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/modules/DockerContainerModule.scala
+++ b/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/modules/DockerSupportModule.scala
@@ -6,15 +6,15 @@ import izumi.distage.config.ConfigModuleDef
 import izumi.distage.model.definition.ModuleDef
 import izumi.distage.docker.{Docker, DockerClientWrapper, DockerCmdExecFactoryResource}
 
-class DockerContainerModule[F[_]: TagK] extends ModuleDef {
+class DockerSupportModule[F[_]: TagK] extends ModuleDef {
   make[DockerClientWrapper[F]].fromResource[DockerClientWrapper.Resource[F]]
   make[DockerCmdExecFactory].fromResource[DockerCmdExecFactoryResource[F]]
 
-  include(DockerContainerModule.config)
+  include(DockerSupportModule.config)
 }
 
-object DockerContainerModule {
-  def apply[F[_]: TagK]: DockerContainerModule[F] = new DockerContainerModule[F]
+object DockerSupportModule {
+  def apply[F[_]: TagK]: DockerSupportModule[F] = new DockerContainerModule[F]
 
   final val config = new ConfigModuleDef {
     makeConfig[Docker.ClientConfig]("docker")
diff --git a/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/modules/package.scala b/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/modules/package.scala
new file mode 100644
index 000000000..14a5c85bc
--- /dev/null
+++ b/distage/distage-framework-docker/src/main/scala/izumi/distage/docker/modules/package.scala
@@ -0,0 +1,8 @@
+package izumi.distage.docker
+
+package object modules {
+  @deprecated("DockerContainerModule has been renamed to `DockerSupportModule`", "old name will be deleted in 0.11.1")
+  type DockerContainerModule[F[_]] = DockerSupportModule[F]
+  @deprecated("DockerContainerModule has been renamed to `DockerSupportModule`", "old name will be deleted in 0.11.1")
+  lazy val DockerContainerModule: DockerSupportModule.type = DockerSupportModule
+}
diff --git a/fundamentals/fundamentals-platform/src/main/scala/izumi/fundamentals/platform/integration/PortCheck.scala b/fundamentals/fundamentals-platform/src/main/scala/izumi/fundamentals/platform/integration/PortCheck.scala
index 59596fba8..2ccbe6432 100644
--- a/fundamentals/fundamentals-platform/src/main/scala/izumi/fundamentals/platform/integration/PortCheck.scala
+++ b/fundamentals/fundamentals-platform/src/main/scala/izumi/fundamentals/platform/integration/PortCheck.scala
@@ -7,8 +7,10 @@ import java.net.{InetSocketAddress, Socket, URI, URL}
   * into each resource which needs a port availability check.
   *
   * The timeout is intended to be defined just once per app.
+  *
+  * @param timeoutMillis port check timeout in milliseconds
   */
-class PortCheck(timeout: Int) {
+class PortCheck(timeoutMillis: Int) {
   def checkUrl(uri: URL, clue: String, defaultPort: Int): ResourceCheck = {
     checkUrl(uri, Some(clue), Some(defaultPort))
   }
@@ -39,7 +41,7 @@ class PortCheck(timeout: Int) {
     try {
       val socket = new Socket()
       try {
-        socket.connect(new InetSocketAddress(host, port), timeout)
+        socket.connect(new InetSocketAddress(host, port), timeoutMillis)
         ResourceCheck.Success()
       } finally {
         socket.close()
@@ -48,9 +50,9 @@ class PortCheck(timeout: Int) {
       case t: Throwable =>
         val message = clue match {
           case Some(_) =>
-            s"$clue: port check failed on $host:$port, timeout: $timeout ms"
+            s"$clue: port check failed on $host:$port, timeout: $timeoutMillis ms"
           case None =>
-            s"Port check failed on $host:$port, timeout: $timeout ms"
+            s"Port check failed on $host:$port, timeout: $timeoutMillis ms"
         }
 
         ResourceCheck.ResourceUnavailable(message, Some(t))
diff --git a/project/Versions.scala b/project/Versions.scala
index f7db74178..76dfd3222 100644
--- a/project/Versions.scala
+++ b/project/Versions.scala
@@ -17,12 +17,12 @@ object V {
 
   val circe = "0.13.0"
   val circe_generic_extras = "0.13.0"
-  val circe_derivation = "0.13.0-M2"
+  val circe_derivation = "0.13.0-M4"
   val pureconfig = "0.12.3"
   val magnolia = "0.16.0"
   val jawn = "1.0.0"
 
-  val http4s = "0.21.1"
+  val http4s = "0.21.4"
 
   // good to drop - scala
   val scala_java_time = "2.0.0-RC5"


Test patch:
diff --git a/distage/distage-framework-docker/src/test/scala/izumi/distage/testkit/docker/fixtures/DockerPlugin.scala b/distage/distage-framework-docker/src/test/scala/izumi/distage/testkit/docker/fixtures/DockerPlugin.scala
index 14c9b38b9..1f81f77e6 100644
--- a/distage/distage-framework-docker/src/test/scala/izumi/distage/testkit/docker/fixtures/DockerPlugin.scala
+++ b/distage/distage-framework-docker/src/test/scala/izumi/distage/testkit/docker/fixtures/DockerPlugin.scala
@@ -3,7 +3,7 @@ package izumi.distage.testkit.docker.fixtures
 import distage.config.ConfigModuleDef
 import izumi.distage.docker.Docker.AvailablePort
 import izumi.distage.docker.examples._
-import izumi.distage.docker.modules.DockerContainerModule
+import izumi.distage.docker.modules.DockerSupportModule
 import izumi.distage.effect.modules.{CatsDIEffectModule, ZIODIEffectModule}
 import izumi.distage.framework.model.IntegrationCheck
 import izumi.distage.model.definition.Id
@@ -25,7 +25,8 @@ class PgSvcExample(
 
 object MonadPlugin extends PluginDef with CatsDIEffectModule with ZIODIEffectModule
 
-object DockerPlugin extends DockerContainerModule[Task] with PluginDef {
+object DockerPlugin extends PluginDef {
+  include(DockerSupportModule[Task])
   make[DynamoDocker.Container].fromResource {
     DynamoDocker.make[Task]
   }