Merge "Fix issue with job types in Ambari plugin"

This commit is contained in:
Jenkins 2015-10-18 13:00:00 +00:00 committed by Gerrit Code Review
commit 24049e52cb
2 changed files with 46 additions and 2 deletions

View File

@ -179,8 +179,13 @@ class AmbariPluginProvider(p.ProvisioningPluginBase):
return edp_engine.EDPOozieEngine(cluster)
return None
def get_edp_job_types(self, versions=None):
return edp_engine.EDPOozieEngine.get_supported_job_types()
def get_edp_job_types(self, versions=[]):
res = {}
for version in self.get_versions():
if not versions or version in versions:
oozie_engine = edp_engine.EDPOozieEngine
res[version] = oozie_engine.get_supported_job_types()
return res
def get_edp_config_hints(self, job_type, version):
if job_type in edp_engine.EDPOozieEngine.get_supported_job_types():

View File

@ -0,0 +1,39 @@
# Copyright (c) 2015 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.
from sahara.plugins.ambari import plugin
from sahara.tests.unit import base as test_base
class TestPlugin(test_base.SaharaTestCase):
def setUp(self):
self.plugin = plugin.AmbariPluginProvider()
super(TestPlugin, self).setUp()
def test_job_types(self):
self.assertEqual({
'2.2': [
'Hive', 'Java', 'MapReduce', 'MapReduce.Streaming',
'Pig', 'Shell'],
'2.3': [
'Hive', 'Java', 'MapReduce', 'MapReduce.Streaming',
'Pig', 'Shell']
}, self.plugin.get_edp_job_types())
self.assertEqual({
'2.3': [
'Hive', 'Java', 'MapReduce', 'MapReduce.Streaming',
'Pig', 'Shell'],
}, self.plugin.get_edp_job_types(versions=['2.3']))