Skip to content

Commit 184847c

Browse files
authored
task: add extra_hosts feature (#48)
1 parent f4cb46f commit 184847c

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

docs/tasks.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ omitting these keys works only if the volume is defined in the scenario
116116
(see [Scenario](config/scenario.md#volumes) for more details); if the
117117
volume is defined outside of the scenario, it should be declared as a dictionary
118118
with the `bind` and `mode` keys, otherwise an exception is raised.
119+
* `extra_hosts`: a dictionary of additional hosts that should be added to the
120+
container's `/etc/hosts` file; the keys are the hostnames, and the values
121+
are the IP addresses;
119122

120123
You can find the specific settings for each task type in their corresponding
121124
file in the [tasks](tasks) directory.

sipssert/task.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __init__(self, test_dir, configuration):
5757
self.resolve_networks()
5858
self.healthcheck = self.config.get("healthcheck", {"test": []})
5959
self.checklogs = self.get_checklogs()
60+
self.extra_hosts = self.config.get("extra_hosts", {})
6061
self.deps = dependencies.parse_dependencies(self.config.get("require"))
6162
# keep this for backwards compatibility
6263
self.delay_start = self.config.get("delay_start", 0)
@@ -167,7 +168,8 @@ def create(self, controller, prefix=None):
167168
'name': self.container_name,
168169
'environment': env,
169170
'stop_signal': self.stop_signal,
170-
'network_mode': self.host_network
171+
'network_mode': self.host_network,
172+
'extra_hosts': self.extra_hosts
171173
}
172174

173175
self.log.info("container {} prepared".format(self.container_name))

0 commit comments

Comments
 (0)