You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vb...@apache.org on 2015/09/24 16:24:41 UTC

ambari git commit: AMBARI-13226. Second ambari-server silent-mode setup does not switch DB - add unit tests.(vbrodetskyi)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 1232df18b -> c1afe793c


AMBARI-13226. Second ambari-server silent-mode setup does not switch DB - add unit tests.(vbrodetskyi)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c1afe793
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c1afe793
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c1afe793

Branch: refs/heads/branch-2.1
Commit: c1afe793c153ab15ba4e70f272a65bc550c4a7ce
Parents: 1232df1
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Thu Sep 24 17:24:32 2015 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Thu Sep 24 17:24:32 2015 +0300

----------------------------------------------------------------------
 .../src/test/python/TestAmbariServer.py         | 34 ++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c1afe793/ambari-server/src/test/python/TestAmbariServer.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestAmbariServer.py b/ambari-server/src/test/python/TestAmbariServer.py
index 718e547..e4b27a8 100644
--- a/ambari-server/src/test/python/TestAmbariServer.py
+++ b/ambari-server/src/test/python/TestAmbariServer.py
@@ -424,6 +424,40 @@ class TestAmbariServer(TestCase):
 
   @patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value))
   @patch.object(_ambari_server_, "setup")
+  @patch("optparse.OptionParser")
+  def test_main_with_preset_dbms(self, optionParserMock, setup_method):
+    opm = optionParserMock.return_value
+    options = MagicMock()
+    args = ["setup"]
+    opm.parse_args.return_value = (options, args)
+
+    options.dbms = "sqlanywhere"
+    options.sid_or_sname = "sname"
+    _ambari_server_.mainBody()
+
+    self.assertTrue(setup_method.called)
+    self.assertEquals(options.database_index, 5)
+    pass
+
+  @patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value))
+  @patch.object(_ambari_server_, "setup")
+  @patch.object(_ambari_server_, "fix_database_options")
+  @patch("optparse.OptionParser")
+  def test_fix_database_options_called(self, optionParserMock, fixDBOptionsMock, setup_method):
+    opm = optionParserMock.return_value
+    options = MagicMock()
+    args = ["setup"]
+    opm.parse_args.return_value = (options, args)
+
+    _ambari_server_.mainBody()
+
+    self.assertTrue(setup_method.called)
+    self.assertTrue(fixDBOptionsMock.called)
+    set_silent(False)
+    pass
+
+  @patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value))
+  @patch.object(_ambari_server_, "setup")
   @patch.object(_ambari_server_, "start")
   @patch.object(_ambari_server_, "stop")
   @patch.object(_ambari_server_, "reset")