1
# Copyright (c) 2014 Mirantis Inc.
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
7
# http://www.apache.org/licenses/LICENSE-2.0
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
16
from sahara.plugins.vanilla.hadoop2 import config as c
17
from sahara.tests.unit import base
20
class VanillaTwoConfigTestCase(base.SaharaTestCase):
21
def test_get_hadoop_dirs(self):
22
ng = FakeNG(storage_paths=['/vol1', '/vol2'])
23
dirs = c._get_hadoop_dirs(ng)
25
'hadoop_name_dirs': ['/vol1/hdfs/namenode',
26
'/vol2/hdfs/namenode'],
27
'hadoop_data_dirs': ['/vol1/hdfs/datanode',
28
'/vol2/hdfs/datanode'],
29
'hadoop_log_dir': '/vol1/hadoop/logs',
30
'hadoop_secure_dn_log_dir': '/vol1/hadoop/logs/secure',
31
'yarn_log_dir': '/vol1/yarn/logs'
33
self.assertEqual(dirs, expected)
35
def test_merge_configs(self):
52
res = c._merge_configs(a, b)
63
self.assertEqual(res, expected)
67
def __init__(self, storage_paths=None):
68
self.paths = storage_paths
70
def storage_paths(self):