<commit_before>"""Test Solr search using the synchronizer, i.e. as it would be used by an user
    """

import time
import unittest
import os
import sys
from setup_cluster import killMongoProc, startMongoProc, start_cluster
from pymongo import Connection
from os import path
from threading import Timer
from doc_manager import DocManager
from pysolr import Solr
from mongo_internal import Connector
from optparse import OptionParser
from util import retry_until_ok
from pymongo.errors import ConnectionFailure, OperationFailure, AutoReconnect


""" Global path variables
"""
PORTS_ONE = {"PRIMARY": "27117", "SECONDARY": "27118", "ARBITER": "27119",
             "CONFIG": "27220", "MONGOS": "27217"}
s = Solr('http://localhost:8080/solr')
conn = None
NUMBER_OF_DOCS = 100


class TestSynchronizer(unittest.TestCase):

    c = None  # used for the Connector

    def runTest(self):
        unittest.TestCase.__init__(self)

    def setUp(self):
        self.c = Connector('localhost:' + PORTS_ONE["MONGOS"], 'config.txt',
                           'http://localhost:8080/solr', ['test.test'], '_id',
                           None)
        self.c.start()
        while len(self.c.shard_set) == 0:
            time.sleep(1)

        conn['test']['test'].remove(safe=True)
        while (len(s.search('*:*')) != 0):
            time.sleep(1)

    def tearDown(self):
        self.c.doc_manager.auto_commit = False
        time.sleep(2)
        self.c.join()<commit_msg>fixed some stuff in solr test<commit_after>"""Test Solr search using the synchronizer, i.e. as it would be used by an user
    """

import time
import unittest
import os
import sys
from setup_cluster import killMongoProc, startMongoProc, start_cluster
from pymongo import Connection
from os import path
from threading import Timer
from doc_manager import DocManager
from pysolr import Solr
from mongo_internal import Connector
from optparse import OptionParser
from util import retry_until_ok
from pymongo.errors import ConnectionFailure, OperationFailure, AutoReconnect


""" Global path variables
"""
PORTS_ONE = {"PRIMARY": "27117", "SECONDARY": "27118", "ARBITER": "27119",
             "CONFIG": "27220", "MONGOS": "27217"}
s = Solr('http://localhost:8080/solr')
conn = None
NUMBER_OF_DOCS = 100


class TestSynchronizer(unittest.TestCase):

    c = None  # used for the Connector

    def runTest(self):
        unittest.TestCase.__init__(self)

    def setUp(self):
        self.c = Connector('localhost:' + PORTS_ONE["MONGOS"], 'config.txt',
                           'http://localhost:8080/solr', ['test.test'], '_id',
                           None)
        self.c.start()
        while len(self.c.shard_set) == 0:
            time.sleep(1)
        count = 0
        while (True):
            try:
                conn['test']['test'].remove(safe=True)
                break
            except (AutoReconnect, OperationFailure):
                time.sleep(1)
                count += 1
                if count > 60:
                    sys.exit(1)
        while (len(s.search('*:*')) != 0):
            time.sleep(1)

    def tearDown(self):
        self.c.doc_manager.auto_commit = False
        time.sleep(2)
        self.c.join()
{'fraction_non_alphanumeric': 0.11481020535158681, 'fraction_numerical': 0.027380211574362167, 'mean_word_length': 2.661731207289294, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1591334', 'n_tokens_mistral': 1029, 'n_tokens_neox': 953, 'n_words': 268}