forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker: Allow publishing of ports with the same number but different …
…protocol (ansible#38412) * Don't deduplicate docker container ports with different protocols * Test _parse_exposed_ports
- Loading branch information
Showing
3 changed files
with
29 additions
and
3 deletions.
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
Empty file.
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,19 @@ | ||
import unittest | ||
|
||
from ansible.modules.cloud.docker.docker_container import TaskParameters | ||
|
||
|
||
class TestTaskParameters(unittest.TestCase): | ||
"""Unit tests for TaskParameters.""" | ||
|
||
def test_parse_exposed_ports_tcp_udp(self): | ||
""" | ||
Ensure _parse_exposed_ports does not cancel ports with the same | ||
number but different protocol. | ||
""" | ||
task_params = TaskParameters.__new__(TaskParameters) | ||
task_params.exposed_ports = None | ||
result = task_params._parse_exposed_ports([80, '443', '443/udp']) | ||
self.assertTrue((80, 'tcp') in result) | ||
self.assertTrue((443, 'tcp') in result) | ||
self.assertTrue((443, 'udp') in result) |