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
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
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()