Beispiel #1
0
    def test_dicts(self, chartConfigMock):
        chart = Chart(self.chart_object, None)
        chartConfig = chartConfigMock()
        chartConfig.course_base_directory = '.'
        chartConfig.dryrun = False
        chart.values_strings = {
            "levelone": {
                "leveltwo": "valuetwo",
            }
        }

        chart.build_set_string_arguments()
        self.assertEqual(chart.args,
                         ["--set-string", "levelone.leveltwo=valuetwo"])

        chart.args = []
        chart.values_strings = {
            "levelone": {
                "leveltwo": {
                    "levelthree": {
                        "levelfour": "value four",
                    }
                }
            }
        }
        chart.build_set_string_arguments()
        self.assertEqual(chart.args, [
            "--set-string", "levelone.leveltwo.levelthree.levelfour=value four"
        ])
Beispiel #2
0
    def test_interpolation_of_env_vars_kube_deploy_spec(self, environMock):
        chart = Chart({'name': {'values': {}}}, None)
        chart.config.dryrun = False

        chart.args = ['thing=$(environVar)']
        environMock.environ = {}

        chart._check_env_vars()
        self.assertEqual(chart.args[0], 'thing=$(environVar)')
Beispiel #3
0
    def test_interpolation_of_missing_env_vars(self, environMock):
        chart = Chart({'name': {'values': {}}}, None)
        chart.config.dryrun = False

        chart.args = ['thing=${environVar}']
        environMock.environ = {}

        with self.assertRaises(Exception):
            chart._check_env_vars()
Beispiel #4
0
    def test_interpolation_of_env_vars(self, environMock):
        chart = Chart({'name': {'values': {}}}, None)
        chart.config.dryrun = False

        chart.args = ['thing=${environVar}', 'another=$environVar']
        environMock.environ = {'environVar': 'asdf'}

        chart._check_env_vars()
        self.assertEqual(chart.args[0], 'thing=asdf')
        self.assertEqual(chart.args[1], 'another=asdf')
Beispiel #5
0
    def test_interpolation_of_env_vars_raises(self, environMock,
                                              chartConfigMock):
        chart = Chart({'name': {'values': {}}}, None)
        chartConfig = chartConfigMock()
        chartConfig.course_base_directory = '.'
        chartConfig.dryrun = False
        chartConfig.debug = False
        chart.args = ['thing=$(environVar)']
        environMock.environ = {}

        with self.assertRaises((ReckonerException)):
            chart._check_env_vars()
Beispiel #6
0
    def test_interpolation_of_missing_env_vars(self, environMock,
                                               chartConfigMock):
        chart = Chart({'name': {'values': {}}}, None)
        chartConfig = chartConfigMock()
        chartConfig.course_base_directory = '.'
        chartConfig.dryrun = False

        chart.args = ['thing=${environVar}']
        environMock.environ = {}

        with self.assertRaises(Exception) as error:
            self.assertTrue(str(error).contains("Invalid placeholder"))
            chart._check_env_vars()
Beispiel #7
0
    def test_dicts(self):
        chart = Chart(self.chart_object, None)
        chart.values_strings = {
            "levelone": {
                "leveltwo": "valuetwo",
            }
        }

        chart.build_set_string_arguments()
        self.assertEqual(chart.args, ["--set-string", "levelone.leveltwo=valuetwo"])

        chart.args = []
        chart.values_strings = {
            "levelone": {
                "leveltwo": {
                    "levelthree": {
                        "levelfour": "value four",
                    }
                }
            }
        }
        chart.build_set_string_arguments()
        self.assertEqual(chart.args, ["--set-string", "levelone.leveltwo.levelthree.levelfour=value four"])