コード例 #1
0
    def test_no_dashes_on_end(self):
        assert (docker_wrapper.generate_hostname_task_id(
            "beep", "foobar-") == "beep-foobar")

        hostname = docker_wrapper.generate_hostname_task_id(
            "reallllllllllllllylooooooooooooooong",
            "reallyreallylongid0123--abc")
        assert hostname == "reallllllllllllllylooooooooooooooong-reallyreallylongid0123"
        assert len(hostname) == 59
コード例 #2
0
 def test_truncate(self):
     hostname = docker_wrapper.generate_hostname_task_id(
         "reallllllllllllllylooooooooooooooong",
         "reallyreallylongidsssssssssssssssssssssssss",
     )
     assert (hostname ==
             "reallllllllllllllylooooooooooooooong-reallyreallylongidsssss")
     assert len(hostname) == 60
コード例 #3
0
 def test_symbols(self):
     hostname = docker_wrapper.generate_hostname_task_id(
         "first", "anything:can_do!s0me weird-stuff")
     assert hostname == "first-anything-can-do-s0me-weird-stuff"
コード例 #4
0
 def test_simple(self):
     hostname = docker_wrapper.generate_hostname_task_id(
         "first", "what.only.matters.is.lastpart")
     assert hostname == "first-lastpart"