Commit 3f5b154d by Diana Huang

Merge pull request #8025 from edx/diana/fix-flaky-bok-choy-test

Catch BSON errors as well as PyMongo errors when emitting MongoDB events.
parents b328a2e8 362c632a
...@@ -7,6 +7,7 @@ import logging ...@@ -7,6 +7,7 @@ import logging
import pymongo import pymongo
from pymongo import MongoClient from pymongo import MongoClient
from pymongo.errors import PyMongoError from pymongo.errors import PyMongoError
from bson.errors import BSONError
from track.backends import BaseBackend from track.backends import BaseBackend
...@@ -89,8 +90,9 @@ class MongoBackend(BaseBackend): ...@@ -89,8 +90,9 @@ class MongoBackend(BaseBackend):
"""Insert the event in to the Mongo collection""" """Insert the event in to the Mongo collection"""
try: try:
self.collection.insert(event, manipulate=False) self.collection.insert(event, manipulate=False)
except PyMongoError: except (PyMongoError, BSONError):
# The event will be lost in case of a connection error. # 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 # pymongo will re-connect/re-authenticate automatically
# during the next event. # during the next event.
msg = 'Error inserting to MongoDB event tracker backend' msg = 'Error inserting to MongoDB event tracker backend'
......
...@@ -1044,7 +1044,6 @@ class GroupConfigurationsTest(ContainerBase, SplitTestMixin): ...@@ -1044,7 +1044,6 @@ class GroupConfigurationsTest(ContainerBase, SplitTestMixin):
rendered_group_names = self.get_select_options(page=courseware_page, selector=".split-test-select") rendered_group_names = self.get_select_options(page=courseware_page, selector=".split-test-select")
self.assertListEqual(group_names, rendered_group_names) self.assertListEqual(group_names, rendered_group_names)
@skip # TODO fix this, see TNL-2035
def test_split_test_LMS_staff_view(self): def test_split_test_LMS_staff_view(self):
""" """
Scenario: Ensure that split test is correctly rendered in LMS staff mode as it is Scenario: Ensure that split test is correctly rendered in LMS staff mode as it is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment