Exemple #1
0
    def test_index_crash_with_bad_keys(self):
        a_raw_crash_with_bad_keys = {
            'foo': 'alpha',
            '': 'bad key 1',
            '.': 'bad key 2',
            u'na\xefve': 'bad key 3',
        }

        es_storage = ESCrashStorage(config=self.config)

        es_storage.save_raw_and_processed(
            raw_crash=deepcopy(a_raw_crash_with_bad_keys),
            dumps=None,
            processed_crash=deepcopy(a_processed_crash),
            crash_id=a_processed_crash['uuid']
        )

        # Ensure that the document was indexed by attempting to retreive it.
        doc = self.es_client.get(
            index=self.config.elasticsearch.elasticsearch_index,
            id=a_processed_crash['uuid']
        )
        # Make sure the invalid keys aren't in the crash.
        raw_crash = doc['_source']['raw_crash']
        assert raw_crash == {'foo': 'alpha'}
        es_storage.close()
    def test_index_crash_with_bad_keys(self):
        a_raw_crash_with_bad_keys = {
            "foo": "alpha",
            "": "bad key 1",
            ".": "bad key 2",
            "na\xefve": "bad key 3",
        }

        es_storage = ESCrashStorage(config=self.config)

        es_storage.save_raw_and_processed(
            raw_crash=deepcopy(a_raw_crash_with_bad_keys),
            dumps=None,
            processed_crash=deepcopy(a_processed_crash),
            crash_id=a_processed_crash["uuid"],
        )

        # Ensure that the document was indexed by attempting to retreive it.
        doc = self.es_client.get(
            index=self.config.elasticsearch.elasticsearch_index,
            id=a_processed_crash["uuid"],
        )
        # Make sure the invalid keys aren't in the crash.
        raw_crash = doc["_source"]["raw_crash"]
        assert raw_crash == {"foo": "alpha"}
        es_storage.close()
Exemple #3
0
    def test_index_crash_with_bad_keys(self):
        a_raw_crash_with_bad_keys = {
            'foo': 'alpha',
            '': 'bad key 1',
            '.': 'bad key 2',
            u'na\xefve': 'bad key 3',
        }

        es_storage = ESCrashStorage(config=self.config)

        es_storage.save_raw_and_processed(
            raw_crash=deepcopy(a_raw_crash_with_bad_keys),
            dumps=None,
            processed_crash=deepcopy(a_processed_crash),
            crash_id=a_processed_crash['uuid']
        )

        # Ensure that the document was indexed by attempting to retreive it.
        doc = self.es_client.get(
            index=self.config.elasticsearch.elasticsearch_index,
            id=a_processed_crash['uuid']
        )
        # Make sure the invalid keys aren't in the crash.
        raw_crash = doc['_source']['raw_crash']
        assert raw_crash == {'foo': 'alpha'}
        es_storage.close()
    def test_index_crash(self):
        """Test indexing a crash document."""
        es_storage = ESCrashStorage(config=self.config)

        es_storage.save_processed_crash(
            raw_crash=deepcopy(a_raw_crash),
            processed_crash=deepcopy(a_processed_crash),
        )

        # Ensure that the document was indexed by attempting to retreive it.
        assert self.es_client.get(
            index=es_storage.es_context.get_index_template(),
            id=a_processed_crash["uuid"],
        )
        es_storage.close()
Exemple #5
0
    def test_index_crash(self):
        """Test indexing a crash document"""
        es_storage = ESCrashStorage(config=self.config)

        es_storage.save_raw_and_processed(
            raw_crash=deepcopy(a_raw_crash),
            dumps=None,
            processed_crash=deepcopy(a_processed_crash),
            crash_id=a_processed_crash['uuid'])

        # Ensure that the document was indexed by attempting to retreive it.
        assert (self.es_client.get(
            index=self.config.elasticsearch.elasticsearch_index,
            id=a_processed_crash['uuid']))
        es_storage.close()
Exemple #6
0
    def test_index_crash(self):
        """Test indexing a crash document."""
        es_storage = ESCrashStorage(config=self.config)

        raw_crash = deepcopy(SAMPLE_RAW_CRASH)
        processed_crash = deepcopy(SAMPLE_PROCESSED_CRASH)
        processed_crash["date_processed"] = date_to_string(utc_now())

        es_storage.save_processed_crash(
            raw_crash=raw_crash,
            processed_crash=processed_crash,
        )

        # Ensure that the document was indexed by attempting to retreive it.
        assert self.conn.get(
            index=self.es_context.get_index_for_date(utc_now()),
            id=SAMPLE_PROCESSED_CRASH["uuid"],
        )
        es_storage.close()
Exemple #7
0
    def test_index_crash(self):
        """Test indexing a crash document."""
        es_storage = ESCrashStorage(config=self.config)

        es_storage.save_raw_and_processed(
            raw_crash=deepcopy(a_raw_crash),
            dumps=None,
            processed_crash=deepcopy(a_processed_crash),
            crash_id=a_processed_crash['uuid']
        )

        # Ensure that the document was indexed by attempting to retreive it.
        assert (
            self.es_client.get(
                index=es_storage.es_context.get_index_template(),
                id=a_processed_crash['uuid']
            )
        )
        es_storage.close()
Exemple #8
0
    def test_index_crash(self):
        """Test indexing a crash document.
        """

        es_storage = ESCrashStorage(config=self.config)

        es_storage.save_raw_and_processed(
            raw_crash=a_raw_crash,
            dumps=None,
            processed_crash=a_processed_crash,
            crash_id=a_processed_crash['uuid']
        )

        # Ensure that the document was indexed by attempting to retreive it.
        ok_(
            self.es_client.get(
                index=self.config.elasticsearch.elasticsearch_index,
                id=a_processed_crash['uuid']
            )
        )
        es_storage.close()