This repository has been archived by the owner on Jul 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Update to Izumi 0.9.16, use distage-testkit docker support instead of docker-compose #2
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package livecode | ||
|
||
import distage.ModuleDef | ||
import izumi.distage.testkit.integration.docker.Docker | ||
import izumi.distage.testkit.integration.docker.Docker.DockerPort | ||
import izumi.distage.testkit.integration.docker.examples.PostgresDocker | ||
import izumi.distage.testkit.integration.docker.modules.DockerContainerModule | ||
import livecode.code.Postgres.PostgresPortCfg | ||
import zio.Task | ||
|
||
object PostgresDockerModule extends ModuleDef { | ||
// launch postgres docker for tests | ||
make[PostgresDocker.Container] | ||
.fromResource(PostgresDocker.make[Task]) | ||
|
||
// spawned docker container port is dynamic | ||
// to prevent conflicts. Make PostgresPortCfg | ||
// point to the new port. This will also | ||
// cause the container to start before | ||
// integration check is performed | ||
make[PostgresPortCfg].from { | ||
docker: PostgresDocker.Container => | ||
println(docker) | ||
PostgresPortCfg(docker.availablePorts(DockerPort.TCP(5432)).head.port) | ||
} | ||
|
||
// add docker dependencies and override default configuration | ||
include(new DockerContainerModule[Task] overridenBy new ModuleDef { | ||
make[Docker.ClientConfig].from { | ||
Docker.ClientConfig( | ||
readTimeoutMs = 500, | ||
connectTimeoutMs = 500, | ||
allowReuse = true, | ||
useRemote = false, | ||
useRegistry = true, | ||
remote = None, | ||
registry = None, | ||
) | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI not every environment has "localhost" as the host where ports are exposed.
This is why in Testcontainers we have this:
https://www.testcontainers.org/features/networking/#getting-the-container-ip-address
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, btw, if you would use Testcontainers, you could launch containers just by specifying a JDBC URL 😊
https://www.testcontainers.org/modules/databases/#database-containers-launched-via-jdbc-url-scheme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bsideup Ah, that's covered too, I just forgot to add it in the PR - d15721b