Exemplo n.º 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"), [])
Exemplo n.º 2
0
    def test_client_Client_manuallyConnect_and_manuallyDisconnect_many_times_in_a_row(
            self):
        testResults = TestResults(30)
        testResults.initializeList("id")

        for i in xrange(testResults.total()):
            clientConnectionId = self.client.manuallyConnect(
                ARGS.demo_server_uri, self.sessionSettings0)
            self.assertEqual(
                self.client.sessionInformation(
                    clientConnectionId).clientConnectionId, clientConnectionId)
            self.client.manuallyDisconnect(clientConnectionId)
Exemplo n.º 3
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)
Exemplo n.º 4
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())
Exemplo n.º 5
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)