コード例 #1
0
ファイル: test_crashstorage.py プロジェクト: heycam/socorro
    def test_bulk_index_crash(self):
        """Test indexing a crash document.
        """

        local_config = self.get_tuned_config(ESBulkCrashStorage, {
            "items_per_bulk_load": 10,
        })

        es_storage = ESBulkCrashStorage(config=local_config)

        for x in range(20):
            uuid = "%02d%s" % (x, a_processed_crash['uuid'][2:])
            new_processed_crash = deepcopy(a_processed_crash)
            new_processed_crash['uuid'] = uuid

            es_storage.save_raw_and_processed(
                raw_crash=a_raw_crash,
                dumps=None,
                processed_crash=new_processed_crash,
                crash_id=uuid)
        es_storage.close()

        for x in range(20):
            uuid = "%02d%s" % (x, a_processed_crash['uuid'][2:])
            # Ensure that the document was indexed by attempting to retreive it
            assert (self.es_client.get(
                index=local_config.elasticsearch.elasticsearch_index, id=uuid))
コード例 #2
0
ファイル: test_crashstorage.py プロジェクト: ahlfors/socorro
    def test_bulk_index_crash(self):
        """Test indexing a crash document.
        """

        local_config = self.get_tuned_config(
            ESBulkCrashStorage,
            {"items_per_bulk_load": 10, }
        )

        es_storage = ESBulkCrashStorage(config=local_config)

        for x in range(20):
            uuid = "%02d%s" % (
                x,
                a_processed_crash['uuid'][2:]
            )
            new_processed_crash = deepcopy(a_processed_crash)
            new_processed_crash['uuid'] = uuid

            es_storage.save_raw_and_processed(
                raw_crash=a_raw_crash,
                dumps=None,
                processed_crash=new_processed_crash,
                crash_id=uuid
            )
        es_storage.close()

        for x in range(20):
            uuid = "%02d%s" % (
                x,
                a_processed_crash['uuid'][2:]
            )
            # Ensure that the document was indexed by attempting to retreive it.
            ok_(
                self.es_client.get(
                    index=local_config.elasticsearch.elasticsearch_index,
                    id=uuid
                )
            )