예제 #1
0
    def test_generating_simple_init(self, mock_conf):
        mock_conf.yml_dir_path = RC_PATH
        yml_path = _render_yml(self.init_variables, "generic-init.yml.j2")
        with open(yml_path, 'r') as stream:
            generated_files = yaml.load_all(stream.read())
        with open("./fake_templates/simple-init.yml", 'r') as stream:
            expected_files = yaml.load_all(stream.read())
        try:
            # compare pod
            self.assertEqual(expected_files.next(), generated_files.next())

        except StopIteration:
            self.fail("Incorrect type of generated yml")
예제 #2
0
    def test_generating_without_ports(self, mock_conf):
        self.control_variables["ports"] = ['']
        mock_conf.yml_dir_path = RC_PATH
        yml_path = _render_yml(self.control_variables)
        with open(yml_path, 'r') as stream:
            generated_files = yaml.load_all(stream.read())
        with open("./fake_templates/no_ports.yml", 'r') as stream:
            expected_files = yaml.load_all(stream.read())
        try:
            # compare ReplicationController
            self.assertEqual(expected_files.next(), generated_files.next())

        except StopIteration:
            self.fail("Incorrect type of generated yml")
예제 #3
0
    def test_generating_with_emprtDir_path(self, mock_conf):
        self.control_variables["host_path"] = None
        self.control_variables["container_path"] = "/foo/bar/container"
        mock_conf.yml_dir_path = RC_PATH
        yml_path = _render_yml(self.control_variables)
        with open(yml_path, 'r') as stream:
            generated_files = yaml.load_all(stream.read())
        with open("./fake_templates/emptyDir.yml", 'r') as stream:
            expected_files = yaml.load_all(stream.read())
        try:
            # compare ReplicationController
            self.assertEqual(expected_files.next(), generated_files.next())

        except StopIteration:
            self.fail("Incorrect type of generated yml")