Add environment ip/port injection of other Containers to Composition
There is reason to want dockertest to run two or more containers, which would like to communicate with each other. For now, it is assumed that all containers run in the same network, but this might change in the future. The containers can now route to eachother through port and ip. The ip will NOT be known beforehand, and must be injected as part of a dependency graph on startup. The port WILL be known beforehand (when the containers run on the same network), but introducing a consistent API for defining/documenting them is desirable. This also leaves the possibility that they will be mapped differently in the future.
So the following APIs are proposed:
Composition.inject_ip_env(handle: &str)
Composition.inject_port_env(handle: &str, name: &str, container_port: u16)
This will entail resolving a DAG of all Compositions and starting them while respecting StartPolicy as well. This is partially an unanswered question.
It will also mean changing the validation of handles to include usage of inject_*
.