deb-sahara/sahara/tests/unit/plugins/vanilla/hadoop2/test_plugin.py
Vitaly Gridnev a115322bc5 Deprecate Vanilla 2.6.0
This change deprecates vanilla 2.6.0 plugin. Vanilla 2.7.1 continues
to be supported.

Also, add default templates for vanilla 2.7.1.
All possible occurences replaced with 2.7.1 version of plugin.

Implements blueprint: deprecate-vanilla-2-6-0
Change-Id: I791417d76b7ef79227f99e7d2c85febdafef0f04
2015-08-27 15:26:00 +03:00

48 lines
1.6 KiB
Python

# Copyright (c) 2014 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from sahara import conductor as cond
from sahara import context
from sahara.plugins import base as pb
from sahara.tests.unit import base
from sahara.utils import edp
conductor = cond.API
class VanillaPluginTest(base.SaharaWithDbTestCase):
def setUp(self):
super(VanillaPluginTest, self).setUp()
pb.setup_plugins()
@mock.patch('sahara.service.edp.hdfs_helper.create_dir_hadoop2')
def test_edp_calls_hadoop2_create_dir(self, create_dir):
for version in ['2.7.1']:
cluster_dict = {
'name': 'cluster' + version.replace('.', '_'),
'plugin_name': 'vanilla',
'hadoop_version': version,
'default_image_id': 'image'}
cluster = conductor.cluster_create(context.ctx(), cluster_dict)
plugin = pb.PLUGINS.get_plugin(cluster.plugin_name)
create_dir.reset_mock()
plugin.get_edp_engine(cluster, edp.JOB_TYPE_PIG).create_hdfs_dir(
mock.Mock(), '/tmp')
self.assertEqual(1, create_dir.call_count)