def test_link_ordering_circular_1(self): containers = [BlockadeContainerConfig("c1", "image"), BlockadeContainerConfig("c2", "image", links=["c1"]), BlockadeContainerConfig("c3", "image", links=["c3"])] with self.assertRaisesRegexp(BlockadeConfigError, "circular"): dependency_sorted(containers)
def test_link_ordering_unknown_2(self): containers = [BlockadeContainerConfig("c1", "image"), BlockadeContainerConfig("c2", "image", links=["c6", "c7"]), BlockadeContainerConfig("c3", "image", links=["c1"])] with self.assertRaisesRegexp(BlockadeConfigError, "unknown"): dependency_sorted(containers)
def test_link_ordering_unknown_2(self): containers = [ BlockadeContainerConfig("c1", "image"), BlockadeContainerConfig("c2", "image", links=["c6", "c7"]), BlockadeContainerConfig("c3", "image", links=["c1"]) ] with self.assertRaisesRegexp(BlockadeConfigError, "unknown"): dependency_sorted(containers)
def test_link_ordering_circular_1(self): containers = [ BlockadeContainerConfig("c1", "image"), BlockadeContainerConfig("c2", "image", links=["c1"]), BlockadeContainerConfig("c3", "image", links=["c3"]) ] with self.assertRaisesRegexp(BlockadeConfigError, "circular"): dependency_sorted(containers)
def test_link_ordering_1(self): containers = [BlockadeContainerConfig("c1", "image"), BlockadeContainerConfig("c2", "image"), BlockadeContainerConfig("c3", "image")] ordered = dependency_sorted(containers) ordered_names = [c.name for c in ordered] self.assertDependencyLevels(ordered_names, ["c1", "c2", "c3"])
def test_link_ordering_3(self): containers = [ BlockadeContainerConfig("c1", "image"), BlockadeContainerConfig("c2", "image", links={"c1": "c1"}), BlockadeContainerConfig("c3", "image", links={"c1": "c1"}) ] ordered = dependency_sorted(containers) ordered_names = [c.name for c in ordered] self.assertDependencyLevels(ordered_names, ["c1"], ["c2", "c3"])