コード例 #1
0
def run_test():
    '''
    Tests Waldo's ability to detect a network failure between two endpoints
    mid-sequence, thrown a NetworkException, and catch that exception using
    a try-catch.
    
    Returns true if the exception is caught and handled, and false otherwise.
    '''
    Waldo.set_default_heartbeat_period(1)
    Waldo.set_default_partner_timeout(3)
    acceptor_process.start()
    time.sleep(SLEEP_TIME)
    connector = Waldo.tcp_connect(Ping,HOST,PORT,signal_func)
    return connector.testNetworkException()
コード例 #2
0
def run_test():
    '''
    Tests Waldo's ability to detect a network failure between two endpoints
    mid-sequence, thrown a NetworkException, and catch that exception using
    a try-catch.
    
    Returns true if the exception is caught and handled, and false otherwise.
    '''
    Waldo.set_default_heartbeat_period(1)
    Waldo.set_default_partner_timeout(3)
    acceptor_process.start()
    time.sleep(SLEEP_TIME)
    connector = Waldo.tcp_connect(Ping, HOST, PORT, signal_func)
    return connector.testNetworkException()
コード例 #3
0
def run_test():
    '''
    Tests that Waldo can detect a network exception mid-sequence and propagate
    that exception back through an endpoint call.

    Returns true if the test passes and false otherwise.
    '''
    Waldo.set_default_heartbeat_period(1)
    Waldo.set_default_partner_timeout(2)
    acceptor_process.start()
    time.sleep(SLEEP_TIME)
    endpt = Waldo.tcp_connect(Ping, HOST, PORT)
    endpt.addTerminationFunction(signal_func)
    catcher = Waldo.no_partner_create(Catcher)
    catcher.addEndpoint(endpt)
    return catcher.testPropagateNetworkExceptionOnEndpointCall()
コード例 #4
0
def run_test():
    '''
    Tests that Waldo can detect a network exception mid-sequence and propagate
    that exception back through an endpoint call.

    Returns true if the test passes and false otherwise.
    '''
    Waldo.set_default_heartbeat_period(1)
    Waldo.set_default_partner_timeout(2)
    acceptor_process.start()
    time.sleep(SLEEP_TIME)
    endpt = Waldo.tcp_connect(Ping, HOST, PORT)
    endpt.addTerminationFunction(signal_func)
    catcher = Waldo.no_partner_create(Catcher)
    catcher.addEndpoint(endpt)
    return catcher.testPropagateNetworkExceptionOnEndpointCall()
コード例 #5
0
def run_test():
    '''
    Tests Waldo's ability to detect a network failure between two endpoints
    mid-sequence, thrown a NetworkException, and catch that exception using
    a try-catch.
    
    Returns true if the exception is caught and handled, and false otherwise.
    '''
    acceptor_process = Process(target=spawn_acceptor,args=())
    Waldo.set_default_heartbeat_period(1)
    Waldo.set_default_partner_timeout(3)
    acceptor_process.start()
    time.sleep(KILL_WAIT_TIME)
    connector = Waldo.tcp_connect(Ping,HOST,PORT)
    time.sleep(KILL_WAIT_TIME)
    acceptor_process.terminate()
    time.sleep(TIMEOUT_DETECT_TIME)
    return connector.testNetworkException()
コード例 #6
0
def run_test():
    '''
    Tests Waldo's capability of propagating a network exception back through
    a sequence. Here we have two pairs of endpoints: (a,b), (c,d). Endpoint a 
    begins a sequence with b, which makes and endpoint call to c, which 
    initiates a sequence with d. Endpoint d is in a separate process which is
    manually terminated mid-sequence, thus a network exception should be
    detected by c and propagated back to a.

    Returns true if the exception is propagated back to the root of the
    event and handled and false otherwise.
    '''
    global acceptor_proc
    Waldo.set_default_heartbeat_period(1)
    Waldo.set_default_partner_timeout(2)
    acceptor_proc.start()
    time.sleep(SLEEP_TIME) # make sure process is ready for tcp_connect
    inner_ping = Waldo.tcp_connect(InnerPing, HOST, PORT_INNER)
    Waldo.tcp_accept(OuterPong, HOST, PORT_OUTER, inner_ping)
    outer_ping = Waldo.tcp_connect(OuterPing, HOST, PORT_OUTER)
    result = outer_ping.testNestedSequencePropagation()
    acceptor_proc.terminate()
    return result
コード例 #7
0
def run_test():
    '''
    Tests Waldo's capability of propagating a network exception back through
    a sequence. Here we have two pairs of endpoints: (a,b), (c,d). Endpoint a 
    begins a sequence with b, which makes and endpoint call to c, which 
    initiates a sequence with d. Endpoint d is in a separate process which is
    manually terminated mid-sequence, thus a network exception should be
    detected by c and propagated back to a.

    Returns true if the exception is propagated back to the root of the
    event and handled and false otherwise.
    '''
    global acceptor_proc
    Waldo.set_default_heartbeat_period(1)
    Waldo.set_default_partner_timeout(2)
    acceptor_proc.start()
    time.sleep(SLEEP_TIME)  # make sure process is ready for tcp_connect
    inner_ping = Waldo.tcp_connect(InnerPing, HOST, PORT_INNER)
    Waldo.tcp_accept(OuterPong, HOST, PORT_OUTER, inner_ping)
    outer_ping = Waldo.tcp_connect(OuterPing, HOST, PORT_OUTER)
    result = outer_ping.testNestedSequencePropagation()
    acceptor_proc.terminate()
    return result