Files
impala/tests/query_test/test_ddl.py
2014-01-08 10:48:55 -08:00

40 lines
1.4 KiB
Python

#!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
# Impala tests for DDL statements
import logging
import pytest
from tests.common.test_vector import *
from tests.common.test_dimensions import ALL_NODES_ONLY
from tests.common.impala_test_suite import *
# Validates DDL statements (create, drop)
class TestDdlStatements(ImpalaTestSuite):
@classmethod
def get_workload(self):
return 'functional-query'
@classmethod
def add_test_dimensions(cls):
super(TestDdlStatements, cls).add_test_dimensions()
# There is no reason to run these tests using all dimensions.
cls.TestMatrix.add_constraint(lambda v:\
v.get_value('table_format').file_format == 'text' and\
v.get_value('table_format').compression_codec == 'none')
def setup_method(self, method):
self.cleanup_db('ddl_test_db')
def teardown_method(self, method):
self.cleanup_db('ddl_test_db')
def cleanup_db(cls, db_name):
# To drop a db, we need to first drop all the tables in that db
if db_name in cls.hive_client.get_all_databases():
for table_name in cls.hive_client.get_all_tables(db_name):
cls.hive_client.drop_table(db_name, table_name, True)
cls.hive_client.drop_database(db_name, True, False)
@pytest.mark.execute_serially
def test_create_tables(self, vector):
self.run_test_case('QueryTest/create', vector)