Exemplo n.º 1
0
 def _await_V3_poll_agreement( self ):
     # Expect to see a top level content poll called by all peers
     log.info( 'Waiting for a V3 poll by all simulated caches' )
     for client in self.clients:
         log.debug( 'Checking client %s' % client.port);
         self.assert_( client.waitForV3Poller( self.AU ), 'Never called V3 poll' )
         log.info( 'Client on port %s called V3 poll...' % client.port )
     # Expect each client to have won a top-level v3 poll
     log.info( 'Waiting for all peers to win their polls' )
     for client in self.clients:
         self.assert_( client.waitForWonV3Poll( self.AU, self.timeout ), 'Client on port %s did not win V3 poll' % client.port )
         log.info( 'Client on port %s won V3 poll...' % client.port )
Exemplo n.º 2
0
    def _verify_voter_agreements( self ):
        poll_key = self.victim.getV3PollKey( self.AU )
        for client in self.clients:
            if client != self.victim:
                repairer_info = client.getAuRepairerInfo( self.AU, 'LastPercentAgreement' )
                repairer_count = len( repairer_info)
                for ( box, agreement ) in repairer_info.iteritems():
                    self.assertEqual(self.expected_voter_agreement,
                                     agreement,
                                     'Client %s wrong agreement %s with box %s' % ( client, agreement, box))
                    if self.symmetric == True:
                        log.info( 'Symmetric client %s repairers OK' % client )
                    else:
                        log.info( 'Asymmetric client %s repairers OK' % client )

        repairer_info = self.victim.getAuRepairerInfo( self.AU, 'LastPercentAgreement' )
        self.assertEqual( len( self.clients ) - 1, len( repairer_info ) )
        for ( box, agreement ) in repairer_info.iteritems():
            log.debug( "Client %s box %s agree %s" % ( self.victim, box, agreement ) )
            self.assertEqual( agreement, self.expected_agreement, 
                       'Voter %s had actual agreement: %s expected: %s' % ( box, agreement, self.expected_agreement ) )
Exemplo n.º 3
0
    def _setup_AU( self ):
        self.client_without_AU = self.clients[ -1 ]
        self.clients.remove( self.client_without_AU )
        log.debug( 'Peer without AU: %s' % self.client_without_AU )
        
        V3TestCases._setup_AU( self )
        self.framework.appendExtraConfig( { 'org.lockss.poll.v3.enableV3Poller': True } )
        self.framework.reloadAllConfiguration()

        # Agreement is required from all peers before continuing
        self._await_V3_poll_agreement()

        self.victim_first_poll_key = self.victim.getV3PollKey( self.AU )
        log.debug( "Victim's first poll key: " + self.victim_first_poll_key )
        invitees = self.victim.getV3PollInvitedPeers( self.victim_first_poll_key )
        log.debug( 'invitedPeers: %s' % invitees )
        self.assertFalse( self.victim.getV3Identity() in invitees, 'Victim invited itself' )
        self.assert_( self.client_without_AU.getV3Identity() in invitees, 'Peer without AU not invited in first poll' )

        log.debug( 'victim.getNoAuPeers( self.AU ): %s' % self.victim.getNoAuPeers( self.AU ) )
        self.assertEqual( self.victim.getNoAuPeers( self.AU ), [ self.client_without_AU.getV3Identity() ], 'Peer without AU not recorded' )
Exemplo n.º 4
0
    def _verify_damage( self, nodes ):
        V3TestCases._verify_damage( self, nodes )
        
        log.debug( 'victim.getNoAuPeers( self.AU ): %s' % self.victim.getNoAuPeers( self.AU ) )
        self.assertEqual( self.victim.getNoAuPeers( self.AU ), [ self.client_without_AU.getV3Identity() ], 'Peer without AU disappeared!' )

        log.info( 'Waiting for a V3 poll to be called...' )
        # Ignores first victim poll
        self.assert_( self.victim.waitForV3Poller( self.AU, [ self.victim_first_poll_key ] ), 'Timed out while waiting for V3 poll' )
        log.info( 'Successfully called a V3 poll' )

        victim_second_poll_key = self.victim.getV3PollKey( self.AU, self.victim_first_poll_key )
        log.debug( "Victim's second poll key: " + victim_second_poll_key )
        invitees = self.victim.getV3PollInvitedPeers( victim_second_poll_key )
        log.debug( 'invitedPeers: %s' % invitees )
        self.assertFalse( self.client_without_AU.getV3Identity() in invitees, 'Peer without AU invited in 2nd poll' )
Exemplo n.º 5
0
    def _damage_AU( self ):

        node = self.victim.getRandomContentNode( self.AU )
        url = node.url
        self.victim.damageNode( node )
        log.debug( 'damaged: ' + node.url )
        node2 = self.victim2.getAuNode( self.AU, url )
        self.victim2.damageNode( node2 )
        log.debug( 'damaged: ' + node2.url )
        node3 = self.victim3.getAuNode( self.AU, url )
        self.victim3.damageNode( node3 )
        log.debug( 'damaged: ' + node3.url )

        nodes = [ node ]
        self._set_expected_agreement_from_damaged( nodes )
        return nodes