コード例 #1
0
 def output(self):
     """ Use a test target with an own marker_index. """
     target = ElasticsearchTarget(
         host=self.host,
         port=self.port,
         index=self.index,
         doc_type=self.doc_type,
         update_id=self.update_id(),
         marker_index_hist_size=self.marker_index_hist_size)
     target.marker_index = marker_index
     target.marker_doc_type = marker_doc_type
     return target
コード例 #2
0
ファイル: _esindex_test.py プロジェクト: kutschkem/gluish
 def output(self):
     """ Use a test target with an own marker_index. """
     target = ElasticsearchTarget(
         host=self.host,
         port=self.port,
         index=self.index,
         doc_type=self.doc_type,
         update_id=self.update_id(),
         marker_index_hist_size=self.marker_index_hist_size
      )
     target.marker_index = marker_index
     target.marker_doc_type = marker_doc_type
     return target
コード例 #3
0
port = 9200
index = 'luigi_test'
doc_type = 'test_type'
marker_index = 'luigi_test_index_updates'
marker_doc_type = 'test_entry'


def _create_test_index():
    """ Create content index, if if does not exists. """
    es = elasticsearch.Elasticsearch([{'host': host, 'port': port}])
    if not es.indices.exists(index):
        es.indices.create(index)


_create_test_index()
target = ElasticsearchTarget(host, port, index, doc_type, 'update_id')
target.marker_index = marker_index
target.marker_doc_type = marker_doc_type


class ElasticsearchTargetTest(unittest.TestCase):
    """ Test touch and exists. """
    def test_touch_and_exists(self):
        """ Basic test. """
        delete()
        self.assertFalse(target.exists(),
                         'Target should not exist before touching it')
        target.touch()
        self.assertTrue(target.exists(),
                        'Target should exist after touching it')
        delete()
コード例 #4
0
ファイル: _esindex_test.py プロジェクト: kutschkem/gluish
port = 9200
index = 'luigi_test'
doc_type = 'test_type'
marker_index = 'luigi_test_index_updates'
marker_doc_type = 'test_entry'


def _create_test_index():
    """ Create content index, if if does not exists. """
    es = elasticsearch.Elasticsearch([{'host': host, 'port': port}])
    if not es.indices.exists(index):
        es.indices.create(index)


_create_test_index()
target = ElasticsearchTarget(host, port, index, doc_type, 'update_id')
target.marker_index = marker_index
target.marker_doc_type = marker_doc_type


class ElasticsearchTargetTest(unittest.TestCase):
    """ Test touch and exists. """
    def test_touch_and_exists(self):
        """ Basic test. """
        delete()
        self.assertFalse(target.exists(),
                         'Target should not exist before touching it')
        target.touch()
        self.assertTrue(target.exists(),
                        'Target should exist after touching it')
        delete()