IMPALA-4639: Add pytest option and xfail markers for tests that only run locally.
As we're beginning to run Impala end-to-end tests on remote clusters, we're finding some tests that do not pass for infrastructure-related reasons (as opposed to product issues.) It would be useful to be able to xfail any tests that we know to be problematic within a given module, yet still run the others. This way, we can get passing test runs as we're ironing out those infrastructure issues. Change-Id: Id4d6e46dc1e64ad20c727ccb19af7a9f3daf917f Reviewed-on: http://gerrit.cloudera.org:8080/5446 Reviewed-by: Alex Behm <[email protected]> Tested-by: Internal 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/6c5f8e3f Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/6c5f8e3f Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/6c5f8e3f Branch: refs/heads/hadoop-next Commit: 6c5f8e3f5e3bdcb87f65d96b7af35aee8874cfb4 Parents: 246acba Author: David Knupp <[email protected]> Authored: Fri Dec 9 14:24:00 2016 -0800 Committer: Internal Jenkins <[email protected]> Committed: Thu Dec 15 02:45:50 2016 +0000 ---------------------------------------------------------------------- tests/conftest.py | 16 ++++++++++++++++ tests/metadata/test_compute_stats.py | 6 ++++++ tests/query_test/test_mt_dop.py | 2 ++ 3 files changed, 24 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6c5f8e3f/tests/conftest.py ---------------------------------------------------------------------- diff --git a/tests/conftest.py b/tests/conftest.py index 6bbbf78..56941c2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -105,6 +105,10 @@ def pytest_addoption(parser): parser.addoption("--skip_hbase", action="store_true", default=False, help="Skip HBase tests") + parser.addoption("--testing_remote_cluster", action="store_true", default=False, + help=("Indicates that tests are being run against a remote cluster. " + "Some tests may be marked to skip or xfail on remote clusters.")) + def pytest_assertrepr_compare(op, left, right): """ @@ -468,3 +472,15 @@ def impala_testinfra_cursor(): yield cursor finally: cursor.close() + + [email protected](autouse=True, scope='session') +def validate_pytest_config(): + """ + Validate that pytest command line options make sense. + """ + if pytest.config.option.testing_remote_cluster: + local_prefixes = ('localhost', '127.', '0.0.0.0') + if any(pytest.config.option.impalad.startswith(loc) for loc in local_prefixes): + logging.error("--testing_remote_cluster can not be used with a local impalad") + pytest.exit("Invalid pytest config option: --testing_remote_cluster") http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6c5f8e3f/tests/metadata/test_compute_stats.py ---------------------------------------------------------------------- diff --git a/tests/metadata/test_compute_stats.py b/tests/metadata/test_compute_stats.py index 9ecdcdf..8c71d35 100644 --- a/tests/metadata/test_compute_stats.py +++ b/tests/metadata/test_compute_stats.py @@ -131,9 +131,15 @@ class TestHbaseComputeStats(ImpalaTestSuite): cls.TestMatrix.add_constraint( lambda v: v.get_value('table_format').file_format == 'hbase') + @pytest.mark.xfail(pytest.config.option.testing_remote_cluster, + reason=("Setting up HBase tests currently assumes a local " + "mini-cluster. See IMPALA-4661.")) def test_hbase_compute_stats(self, vector, unique_database): self.run_test_case('QueryTest/hbase-compute-stats', vector, unique_database) + @pytest.mark.xfail(pytest.config.option.testing_remote_cluster, + reason=("Setting up HBase tests currently assumes a local " + "mini-cluster. See IMPALA-4661.")) def test_hbase_compute_stats_incremental(self, vector, unique_database): self.run_test_case('QueryTest/hbase-compute-stats-incremental', vector, unique_database) http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6c5f8e3f/tests/query_test/test_mt_dop.py ---------------------------------------------------------------------- diff --git a/tests/query_test/test_mt_dop.py b/tests/query_test/test_mt_dop.py index 1d522fd..237e039 100644 --- a/tests/query_test/test_mt_dop.py +++ b/tests/query_test/test_mt_dop.py @@ -92,6 +92,8 @@ class TestMtDopParquet(ImpalaTestSuite): vector.get_value('exec_option')['mt_dop'] = vector.get_value('mt_dop') self.run_test_case('QueryTest/mt-dop-parquet', vector) + @pytest.mark.xfail(pytest.config.option.testing_remote_cluster, + reason='IMPALA-4641') @SkipIfOldAggsJoins.nested_types def test_parquet_nested(self, vector): vector.get_value('exec_option')['mt_dop'] = vector.get_value('mt_dop')
