Catch BSON errors as well as PyMongo errors when emitting
MongoDB events. TNL-2035
This commit is contained in:
@@ -7,6 +7,7 @@ import logging
|
||||
import pymongo
|
||||
from pymongo import MongoClient
|
||||
from pymongo.errors import PyMongoError
|
||||
from bson.errors import BSONError
|
||||
|
||||
from track.backends import BaseBackend
|
||||
|
||||
@@ -89,8 +90,9 @@ class MongoBackend(BaseBackend):
|
||||
"""Insert the event in to the Mongo collection"""
|
||||
try:
|
||||
self.collection.insert(event, manipulate=False)
|
||||
except PyMongoError:
|
||||
# The event will be lost in case of a connection error.
|
||||
except (PyMongoError, BSONError):
|
||||
# The event will be lost in case of a connection error or any error
|
||||
# that occurs when trying to insert the event into Mongo.
|
||||
# pymongo will re-connect/re-authenticate automatically
|
||||
# during the next event.
|
||||
msg = 'Error inserting to MongoDB event tracker backend'
|
||||
|
||||
@@ -1044,7 +1044,6 @@ class GroupConfigurationsTest(ContainerBase, SplitTestMixin):
|
||||
rendered_group_names = self.get_select_options(page=courseware_page, selector=".split-test-select")
|
||||
self.assertListEqual(group_names, rendered_group_names)
|
||||
|
||||
@skip # TODO fix this, see TNL-2035
|
||||
def test_split_test_LMS_staff_view(self):
|
||||
"""
|
||||
Scenario: Ensure that split test is correctly rendered in LMS staff mode as it is
|
||||
|
||||
Reference in New Issue
Block a user