Пример #1
0
 def test_client_Client_manuallyDisconnect_many_times_in_parallel_unique(self):
     testResults = TestResults(30)
     testResults.initializeList("id")
     
     self.help_createManySessions(testResults)
     
     # make sure testResults.finished() is reset (i.e. 0 again)
     testResults.clear()
     
     idsCopy = testResults.getListCopy("id")
     
     for id in idsCopy:
         thread.start_new_thread(disconnect, (self.client, id, testResults))
     
     t_timeout = time.time() + 10.0
     while time.time() < t_timeout and testResults.finished() < testResults.total():
         time.sleep(0.01)
     
     # check if no error occurred during the connection
     self.assertEqual( testResults.failed() , 0 )
     
     # check if we now have 0 sessions
     self.assertEqual( len(self.client.allSessionInformations()) , 0 )
     
     
     # the ids list should also be empty:
     self.assertEqual( testResults.getListCopy("id") , [] )
Пример #2
0
    def test_client_Client_manuallyDisconnect_many_times_in_parallel_unique(
            self):
        testResults = TestResults(30)
        testResults.initializeList("id")

        self.help_createManySessions(testResults)

        # make sure testResults.finished() is reset (i.e. 0 again)
        testResults.clear()

        idsCopy = testResults.getListCopy("id")

        for id in idsCopy:
            thread.start_new_thread(disconnect, (self.client, id, testResults))

        t_timeout = time.time() + 10.0
        while time.time() < t_timeout and testResults.finished(
        ) < testResults.total():
            time.sleep(0.01)

        # check if no error occurred during the connection
        self.assertEqual(testResults.failed(), 0)

        # check if we now have 0 sessions
        self.assertEqual(len(self.client.allSessionInformations()), 0)

        # the ids list should also be empty:
        self.assertEqual(testResults.getListCopy("id"), [])
Пример #3
0
 def test_client_Client_findServersNow_100_times_in_parallel(self):
     testResults = TestResults(100)
     
     for i in range(testResults.total()):
         thread.start_new_thread(testParallel, (self.client, testResults))
         
     # wait until all tests have finished
     t_timeout = time.time() + 5.0
     while time.time() < t_timeout and testResults.finished() < testResults.total():
         time.sleep(0.1)
         
     self.assertEqual( testResults.failed() , 0 )
Пример #4
0
    def test_client_Client_findServersNow_100_times_in_parallel(self):
        testResults = TestResults(100)

        for i in xrange(testResults.total()):
            thread.start_new_thread(testParallel, (self.client, testResults))

        # wait until all tests have finished
        t_timeout = time.time() + 5.0
        while time.time() < t_timeout and testResults.finished(
        ) < testResults.total():
            time.sleep(0.1)

        self.assertEqual(testResults.failed(), 0)
Пример #5
0
 def test_client_Client_manuallyConnect_many_times_in_parallel_unique(self):
     testResults = TestResults(30)
     testResults.initializeList("id")
     
     self.help_createManySessions(testResults)
     
     # check if no error occurred during the connection
     self.assertEqual( testResults.failed() , 0 )
     
     # check if we now have sufficient unique sessions
     self.assertEqual( len(self.client.allSessionInformations()) , testResults.total() )
     
     # check if the ids list has the correct number of ids
     self.assertEqual( len(testResults.getListCopy("id")) , testResults.total() )
Пример #6
0
    def test_client_Client_manuallyConnect_many_times_in_parallel_unique(self):
        testResults = TestResults(30)
        testResults.initializeList("id")

        self.help_createManySessions(testResults)

        # check if no error occurred during the connection
        self.assertEqual(testResults.failed(), 0)

        # check if we now have sufficient unique sessions
        self.assertEqual(len(self.client.allSessionInformations()),
                         testResults.total())

        # check if the ids list has the correct number of ids
        self.assertEqual(len(testResults.getListCopy("id")),
                         testResults.total())
Пример #7
0
 def test_client_Client_manuallyConnect_many_times_in_parallel_non_unique(self):
     testResults = TestResults(30)
     testResults.initializeList("id")
     
     for i in range(testResults.total()):
         thread.start_new_thread(connect, (self.client, ARGS.demo_server_uri, i, False, testResults))
     
     t_timeout = time.time() + 10.0
     while time.time() < t_timeout and testResults.finished() < testResults.total():
         time.sleep(0.01)
     
     # check if no error occurred during the connection
     self.assertEqual( testResults.failed() , 0 )
     
     # check if we now have 1 session
     self.assertEqual( len(self.client.allSessionInformations()) , 1 )
Пример #8
0
    def test_client_Client_manuallyConnect_many_times_in_parallel_non_unique(
            self):
        testResults = TestResults(30)
        testResults.initializeList("id")

        for i in xrange(testResults.total()):
            thread.start_new_thread(
                connect,
                (self.client, ARGS.demo_server_uri, i, False, testResults))

        t_timeout = time.time() + 10.0
        while time.time() < t_timeout and testResults.finished(
        ) < testResults.total():
            time.sleep(0.01)

        # check if no error occurred during the connection
        self.assertEqual(testResults.failed(), 0)

        # check if we now have 1 session
        self.assertEqual(len(self.client.allSessionInformations()), 1)