Ejemplo n.º 1
0
 def setup_class(cls):
   cls.db_name = get_db_prefix(name='hive')
   cls.cluster, shutdown = get_shared_beeswax_server(cls.db_name)
   cls.client = make_logged_in_client()
   # Weird redirection to avoid binding nonsense.
   cls.shutdown = [ shutdown ]
   cls.init_beeswax_db()
Ejemplo n.º 2
0
    def setup_class(cls):
        cls.finish = []

        if not is_live_cluster():
            raise SkipTest

        cls.client = make_logged_in_client()
        cls.user = User.objects.get(username='******')
        add_to_group('test')
        cls.db = dbms.get(cls.user, get_query_server_config(name='impala'))
        cls.DATABASE = get_db_prefix(name='impala')

        queries = [
            'DROP TABLE IF EXISTS %(db)s.tweets;' % {
                'db': cls.DATABASE
            },
            'DROP DATABASE IF EXISTS %(db)s CASCADE;' % {
                'db': cls.DATABASE
            },
            'CREATE DATABASE %(db)s;' % {
                'db': cls.DATABASE
            }
        ]

        for query in queries:
            resp = _make_query(cls.client,
                               query,
                               database='default',
                               local=False,
                               server_name='impala')
            resp = wait_for_query_to_finish(cls.client, resp, max=180.0)
            content = json.loads(resp.content)
            assert_true(content['status'] == 0, resp.content)

        queries = [
            """
      CREATE TABLE tweets (row_num INTEGER, id_str STRING, text STRING) STORED AS PARQUET;
    """, """
      INSERT INTO TABLE tweets VALUES (1, "531091827395682000", "My dad looks younger than costa");
    """, """
      INSERT INTO TABLE tweets VALUES (2, "531091827781550000", "There is a thin line between your partner being vengeful and you reaping the consequences of your bad actions towards your partner.");
    """, """
      INSERT INTO TABLE tweets VALUES (3, "531091827768979000", "@Mustang_Sally83 and they need to get into you :))))");
    """, """
      INSERT INTO TABLE tweets VALUES (4, "531091827114668000", "@RachelZJohnson thank you rach!xxx");
    """, """
      INSERT INTO TABLE tweets VALUES (5, "531091827949309000", "i think @WWERollins was robbed of the IC title match this week on RAW also i wonder if he will get a rematch i hope so @WWE");
    """
        ]

        for query in queries:
            resp = _make_query(cls.client,
                               query,
                               database=cls.DATABASE,
                               local=False,
                               server_name='impala')
            resp = wait_for_query_to_finish(cls.client, resp, max=180.0)
            content = json.loads(resp.content)
            assert_true(content['status'] == 0, resp.content)
Ejemplo n.º 3
0
 def setup_class(cls):
     cls.db_name = get_db_prefix(name='hive')
     cls.cluster, shutdown = get_shared_beeswax_server(cls.db_name)
     cls.client = make_logged_in_client(username='******', is_superuser=False)
     add_to_group('test')
     grant_access("test", "test", "beeswax")
     # Weird redirection to avoid binding nonsense.
     cls.shutdown = [shutdown]
     cls.init_beeswax_db()
Ejemplo n.º 4
0
 def setup_class(cls):
     cls.db_name = get_db_prefix(name="hive")
     cls.cluster, shutdown = get_shared_beeswax_server(cls.db_name)
     cls.client = make_logged_in_client(username="******", is_superuser=False)
     add_to_group("test")
     grant_access("test", "test", "beeswax")
     # Weird redirection to avoid binding nonsense.
     cls.shutdown = [shutdown]
     cls.init_beeswax_db()
Ejemplo n.º 5
0
  def test_create_and_delete_collection(self):
    name = get_db_prefix(name='solr') + 'test_create_collection'
    fields = [{'name': 'id', 'type': 'string'}, {'name': 'my_text', 'type': 'text_en'}]

    # We get exceptions if problems in both case there
    try:
      self.db.create_collection(name, fields, unique_key_field='id', df='my_text')
    finally:
      self.db.delete_collection(name, core=False)
Ejemplo n.º 6
0
  def test_create_and_delete_collection(self):
    name = get_db_prefix(name='solr') + 'test_create_collection'
    fields = [{'name': 'id', 'type': 'string'}, {'name': 'my_text', 'type': 'text_en'}]

    # We get exceptions if problems in both case there
    try:
      self.db.create_collection(name, fields, unique_key_field='id', df='my_text')
    finally:
      self.db.delete_collection(name, core=False)
Ejemplo n.º 7
0
 def setup_class(cls):
   cls.db_name = get_db_prefix(name='hive')
   cls.cluster, shutdown = get_shared_beeswax_server(cls.db_name)
   cls.client = make_logged_in_client(username='******', is_superuser=False)
   add_to_group('test', 'test')
   grant_access('test', 'test', 'beeswax')
   grant_access('test', 'test', 'metastore')
   # Weird redirection to avoid binding nonsense.
   cls.shutdown = [ shutdown ]
   cls.init_beeswax_db()
Ejemplo n.º 8
0
  def test_create_collection(self):
    db = CollectionManagerController(self.user)

    name = get_db_prefix(name='solr') + 'test_create_collection'
    fields = [{'name': 'my_test', 'type': 'text'}]

    try:
      db.create_collection(name, fields, unique_key_field='id', df='text')
    finally:
      db.delete_collection(name, core=False)
Ejemplo n.º 9
0
Archivo: tests.py Proyecto: hwl-py/hue
    def setup_class(cls):
        cls.finish = []

        # We need a real Impala cluster currently
        if (not 'impala' in sys.argv
                and not os.environ.get('TEST_IMPALAD_HOST')
            ) or not is_live_cluster():
            raise SkipTest

        if os.environ.get('TEST_IMPALAD_HOST'):
            cls.finish.append(
                SERVER_HOST.set_for_testing(
                    os.environ.get('TEST_IMPALAD_HOST')))

        cls.client = make_logged_in_client()
        cls.user = User.objects.get(username='******')
        add_to_group('test')
        cls.db = dbms.get(cls.user, get_query_server_config(name='impala'))
        cls.DATABASE = get_db_prefix(name='impala')

        hql = """
      USE default;
      DROP TABLE IF EXISTS %(db)s.tweets;
      DROP DATABASE IF EXISTS %(db)s;
      CREATE DATABASE %(db)s;

      USE %(db)s;
    """ % {
            'db': cls.DATABASE
        }

        resp = _make_query(cls.client,
                           hql,
                           database='default',
                           local=False,
                           server_name='impala')
        resp = wait_for_query_to_finish(cls.client, resp, max=30.0)

        hql = """
      CREATE TABLE tweets (row_num INTEGER, id_str STRING, text STRING) STORED AS PARQUET;

      INSERT INTO TABLE tweets VALUES (1, "531091827395682000", "My dad looks younger than costa");
      INSERT INTO TABLE tweets VALUES (2, "531091827781550000", "There is a thin line between your partner being vengeful and you reaping the consequences of your bad actions towards your partner.");
      INSERT INTO TABLE tweets VALUES (3, "531091827768979000", "@Mustang_Sally83 and they need to get into you :))))");
      INSERT INTO TABLE tweets VALUES (4, "531091827114668000", "@RachelZJohnson thank you rach!xxx");
      INSERT INTO TABLE tweets VALUES (5, "531091827949309000", "i think @WWERollins was robbed of the IC title match this week on RAW also i wonder if he will get a rematch i hope so @WWE");
    """

        resp = _make_query(cls.client,
                           hql,
                           database=cls.DATABASE,
                           local=False,
                           server_name='impala')
        resp = wait_for_query_to_finish(cls.client, resp, max=30.0)
Ejemplo n.º 10
0
    def test_create_collection(self):
        db = CollectionManagerController(self.user)

        name = get_db_prefix(name='solr') + 'test_create_collection'
        fields = [{'name': 'my_test', 'type': 'text'}]

        try:
            db.create_collection(name,
                                 fields,
                                 unique_key_field='id',
                                 df='text')
        finally:
            db.delete_collection(name, core=False)
Ejemplo n.º 11
0
  def setup_class(cls, load_data=True):
    cls.load_data = load_data

    cls.db_name = get_db_prefix(name='hive')
    cls.cluster, shutdown = get_shared_beeswax_server(cls.db_name)
    cls.set_execution_engine()

    cls.client = make_logged_in_client(username='******', is_superuser=False)
    add_to_group('test', 'test')
    grant_access('test', 'test', 'beeswax')
    grant_access('test', 'test', 'metastore')

    # Weird redirection to avoid binding nonsense.
    cls.shutdown = [ shutdown ]
    cls.init_beeswax_db()
Ejemplo n.º 12
0
Archivo: tests.py Proyecto: mapr/hue
  def setup_class(cls):
    cls.finish = []

    if not is_live_cluster():
      raise SkipTest

    cls.client = make_logged_in_client()
    cls.user = User.objects.get(username='******')
    add_to_group('test')
    cls.db = dbms.get(cls.user, get_query_server_config(name='impala'))
    cls.DATABASE = get_db_prefix(name='impala')

    queries = ["""
      DROP TABLE IF EXISTS %(db)s.tweets;
    """ % {'db': cls.DATABASE}, """
      DROP DATABASE IF EXISTS %(db)s CASCADE;
    """ % {'db': cls.DATABASE}, """
      CREATE DATABASE %(db)s;
    """ % {'db': cls.DATABASE}]

    for query in queries:
       resp = _make_query(cls.client, query, database='default', local=False, server_name='impala')
       resp = wait_for_query_to_finish(cls.client, resp, max=180.0)
       content = json.loads(resp.content)
       assert_true(content['status'] == 0, resp.content)

    queries = ["""
      CREATE TABLE tweets (row_num INTEGER, id_str STRING, text STRING) STORED AS PARQUET;
    """, """
      INSERT INTO TABLE tweets VALUES (1, "531091827395682000", "My dad looks younger than costa");
    """, """
      INSERT INTO TABLE tweets VALUES (2, "531091827781550000", "There is a thin line between your partner being vengeful and you reaping the consequences of your bad actions towards your partner.");
    """, """
      INSERT INTO TABLE tweets VALUES (3, "531091827768979000", "@Mustang_Sally83 and they need to get into you :))))");
    """, """
      INSERT INTO TABLE tweets VALUES (4, "531091827114668000", "@RachelZJohnson thank you rach!xxx");
    """, """
      INSERT INTO TABLE tweets VALUES (5, "531091827949309000", "i think @WWERollins was robbed of the IC title match this week on RAW also i wonder if he will get a rematch i hope so @WWE");
    """]

    for query in queries:
       resp = _make_query(cls.client, query, database=cls.DATABASE, local=False, server_name='impala')
       resp = wait_for_query_to_finish(cls.client, resp, max=180.0)
       content = json.loads(resp.content)
       assert_true(content['status'] == 0, resp.content)
Ejemplo n.º 13
0
Archivo: tests.py Proyecto: hwl-py/hue
  def setup_class(cls):
    cls.finish = []

    # We need a real Impala cluster currently
    if (not 'impala' in sys.argv and not os.environ.get('TEST_IMPALAD_HOST')) or not is_live_cluster():
      raise SkipTest

    if os.environ.get('TEST_IMPALAD_HOST'):
      cls.finish.append(SERVER_HOST.set_for_testing(os.environ.get('TEST_IMPALAD_HOST')))

    cls.client = make_logged_in_client()
    cls.user = User.objects.get(username='******')
    add_to_group('test')
    cls.db = dbms.get(cls.user, get_query_server_config(name='impala'))
    cls.DATABASE = get_db_prefix(name='impala')

    hql = """
      USE default;
      DROP TABLE IF EXISTS %(db)s.tweets;
      DROP DATABASE IF EXISTS %(db)s;
      CREATE DATABASE %(db)s;

      USE %(db)s;
    """ % {'db': cls.DATABASE}

    resp = _make_query(cls.client, hql, database='default', local=False, server_name='impala')
    resp = wait_for_query_to_finish(cls.client, resp, max=30.0)

    hql = """
      CREATE TABLE tweets (row_num INTEGER, id_str STRING, text STRING) STORED AS PARQUET;

      INSERT INTO TABLE tweets VALUES (1, "531091827395682000", "My dad looks younger than costa");
      INSERT INTO TABLE tweets VALUES (2, "531091827781550000", "There is a thin line between your partner being vengeful and you reaping the consequences of your bad actions towards your partner.");
      INSERT INTO TABLE tweets VALUES (3, "531091827768979000", "@Mustang_Sally83 and they need to get into you :))))");
      INSERT INTO TABLE tweets VALUES (4, "531091827114668000", "@RachelZJohnson thank you rach!xxx");
      INSERT INTO TABLE tweets VALUES (5, "531091827949309000", "i think @WWERollins was robbed of the IC title match this week on RAW also i wonder if he will get a rematch i hope so @WWE");
    """

    resp = _make_query(cls.client, hql, database=cls.DATABASE, local=False, server_name='impala')
    resp = wait_for_query_to_finish(cls.client, resp, max=30.0)