IMPALA-6023: Fix broken breakpad test

We have a test to make sure that hitting a DCHECK will write a minidump.
We used to pass "-beeswax_port=1" to the server to trigger a DCHECK. A
while ago, this DCHECK seems to have been removed, but we still called
abort() if the ImpalaServer failed to start. This masked the slightly
altered behavior and the test still succeeded.

However, the fix for IMPALA-4786 changed the behavior to call exit(1)
instead of abort() if the ImpalaServer failed to start.

To fix the test, we change it to pass an unresolvable hostname to
impalad, which will result in a call to abort().

This change also splits the breakpad tests into core and exhaustive sets
to make sure that tests which depend on other parts of Impala are
included in every core run.

Change-Id: Ifb5af3e72963280a6677a99aa6a0e5785443bb0c
Reviewed-on: http://gerrit.cloudera.org:8080/8240
Reviewed-by: Michael Brown <[email protected]>
Tested-by: Impala Public Jenkins


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

Branch: refs/heads/master
Commit: f03900a805dff636fa05cf430e15bf6fed70e80a
Parents: 8706563
Author: Lars Volker <[email protected]>
Authored: Mon Oct 9 14:45:30 2017 -0700
Committer: Impala Public Jenkins <[email protected]>
Committed: Tue Oct 10 23:08:44 2017 +0000

----------------------------------------------------------------------
 tests/custom_cluster/test_breakpad.py | 56 ++++++++++++++++++------------
 1 file changed, 33 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f03900a8/tests/custom_cluster/test_breakpad.py
----------------------------------------------------------------------
diff --git a/tests/custom_cluster/test_breakpad.py 
b/tests/custom_cluster/test_breakpad.py
index 87e3b51..b77fb59 100644
--- a/tests/custom_cluster/test_breakpad.py
+++ b/tests/custom_cluster/test_breakpad.py
@@ -32,18 +32,13 @@ from tests.common.skip import SkipIfBuildType
 DAEMONS = ['impalad', 'statestored', 'catalogd']
 DAEMON_ARGS = ['impalad_args', 'state_store_args', 'catalogd_args']
 
-class TestBreakpad(CustomClusterTestSuite):
-  """Check that breakpad integration into the daemons works as expected. This 
includes
-  writing minidump files on unhandled signals and rotating old minidumps on 
startup. The
-  tests kill the daemons by sending a SIGSEGV signal.
-  """
+class TestBreakpadBase(CustomClusterTestSuite):
+  """Base class with utility methods for all breakpad tests."""
   @classmethod
   def get_workload(cls):
     return 'functional-query'
 
   def setup_method(self, method):
-    if self.exploration_strategy() != 'exhaustive':
-      pytest.skip()
     # Override parent
     # The temporary directory gets removed in teardown_method() after each 
test.
     self.tmp_dir = tempfile.mkdtemp()
@@ -57,8 +52,6 @@ class TestBreakpad(CustomClusterTestSuite):
 
   @classmethod
   def setup_class(cls):
-    if cls.exploration_strategy() != 'exhaustive':
-      pytest.skip('breakpad tests only run in exhaustive')
     # Disable core dumps for this test
     setrlimit(RLIMIT_CORE, (0, RLIM_INFINITY))
 
@@ -148,6 +141,37 @@ class TestBreakpad(CustomClusterTestSuite):
     self.assert_impalad_log_contains('ERROR', 'Wrote minidump to ',
         expected_count=expected_count)
 
+class TestBreakpadCore(TestBreakpadBase):
+  """Core tests to check that the breakpad integration into the daemons works 
as
+  expected. This includes writing minidump when the daemons call abort(). Add 
tests here
+  that depend on functionality of Impala other than the breakpad integration 
itself.
+  """
+  @pytest.mark.execute_serially
+  def test_abort_writes_minidump(self):
+    """Check that abort() (e.g. hitting a DCHECK macro) writes a minidump."""
+    assert self.count_all_minidumps() == 0
+    failed_to_start = False
+    try:
+      # Calling with an unresolvable hostname will abort.
+      self.start_cluster_with_args(minidump_path=self.tmp_dir,
+          hostname="jhzvlthd")
+    except CalledProcessError:
+      failed_to_start = True
+    assert failed_to_start
+    assert self.count_minidumps('impalad') > 0
+
+
+class TestBreakpadExhaustive(TestBreakpadBase):
+  """Exhaustive tests to check that the breakpad integration into the daemons 
works as
+  expected. This includes writing minidump files on unhandled signals and 
rotating old
+  minidumps on startup.
+  """
+  @classmethod
+  def setup_class(cls):
+    if cls.exploration_strategy() != 'exhaustive':
+      pytest.skip('These breakpad tests only run in exhaustive')
+    super(TestBreakpadExhaustive, cls).setup_class()
+
   @pytest.mark.execute_serially
   def test_minidump_creation(self):
     """Check that when a daemon crashes, it writes a minidump file."""
@@ -305,17 +329,3 @@ class TestBreakpad(CustomClusterTestSuite):
     reduced_minidump_size = self.trigger_single_minidump_and_get_size()
     # Check that the minidump file size has been reduced.
     assert reduced_minidump_size < full_minidump_size
-
-  @SkipIfBuildType.not_dev_build
-  @pytest.mark.execute_serially
-  def test_dcheck_writes_minidump(self):
-    """Check that hitting a DCHECK macro writes a minidump."""
-    assert self.count_all_minidumps() == 0
-    failed_to_start = False
-    try:
-      self.start_cluster_with_args(minidump_path=self.tmp_dir,
-          beeswax_port=1)
-    except CalledProcessError:
-      failed_to_start = True
-    assert failed_to_start
-    assert self.count_minidumps('impalad') > 0

Reply via email to