<s> from unittest import main <EOL> from swiftclient import client <EOL> from swift . common import direct_client <EOL> from swift . common . manager import Manager <EOL> from test . probe . common import kill_nonprimary_server , kill_server , ReplProbeTest , start_server <EOL> class TestAccountFailures ( ReplProbeTest ) : <EOL> def test_main ( self ) : <EOL> container1 = '<STR_LIT>' <EOL> client . put_container ( self . url , self . token , container1 ) <EOL> container2 = '<STR_LIT>' <EOL> client . put_container ( self . url , self . token , container2 ) <EOL> headers , containers = client . get_account ( self . url , self . token ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:2>' ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:0>' ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:0>' ) <EOL> found1 = False <EOL> found2 = False <EOL> for container in containers : <EOL> if container [ '<STR_LIT:name>' ] == container1 : <EOL> found1 = True <EOL> self . assertEqual ( container [ '<STR_LIT:count>' ] , <NUM_LIT:0> ) <EOL> self . assertEqual ( container [ '<STR_LIT>' ] , <NUM_LIT:0> ) <EOL> elif container [ '<STR_LIT:name>' ] == container2 : <EOL> found2 = True <EOL> self . assertEqual ( container [ '<STR_LIT:count>' ] , <NUM_LIT:0> ) <EOL> self . assertEqual ( container [ '<STR_LIT>' ] , <NUM_LIT:0> ) <EOL> self . assertTrue ( found1 ) <EOL> self . assertTrue ( found2 ) <EOL> client . put_object ( self . url , self . token , container2 , '<STR_LIT>' , '<STR_LIT>' ) <EOL> headers , containers = client . get_account ( self . url , self . token ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:2>' ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:0>' ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:0>' ) <EOL> found1 = False <EOL> found2 = False <EOL> for container in containers : <EOL> if container [ '<STR_LIT:name>' ] == container1 : <EOL> found1 = True <EOL> self . assertEqual ( container [ '<STR_LIT:count>' ] , <NUM_LIT:0> ) <EOL> self . assertEqual ( container [ '<STR_LIT>' ] , <NUM_LIT:0> ) <EOL> elif container [ '<STR_LIT:name>' ] == container2 : <EOL> found2 = True <EOL> self . assertEqual ( container [ '<STR_LIT:count>' ] , <NUM_LIT:0> ) <EOL> self . assertEqual ( container [ '<STR_LIT>' ] , <NUM_LIT:0> ) <EOL> self . assertTrue ( found1 ) <EOL> self . assertTrue ( found2 ) <EOL> self . get_to_final_state ( ) <EOL> headers , containers = client . get_account ( self . url , self . token ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:2>' ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:1>' ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:4>' ) <EOL> found1 = False <EOL> found2 = False <EOL> for container in containers : <EOL> if container [ '<STR_LIT:name>' ] == container1 : <EOL> found1 = True <EOL> self . assertEqual ( container [ '<STR_LIT:count>' ] , <NUM_LIT:0> ) <EOL> self . assertEqual ( container [ '<STR_LIT>' ] , <NUM_LIT:0> ) <EOL> elif container [ '<STR_LIT:name>' ] == container2 : <EOL> found2 = True <EOL> self . assertEqual ( container [ '<STR_LIT:count>' ] , <NUM_LIT:1> ) <EOL> self . assertEqual ( container [ '<STR_LIT>' ] , <NUM_LIT:4> ) <EOL> self . assertTrue ( found1 ) <EOL> self . assertTrue ( found2 ) <EOL> apart , anodes = self . account_ring . get_nodes ( self . account ) <EOL> kill_nonprimary_server ( anodes , self . ipport2server , self . pids ) <EOL> kill_server ( ( anodes [ <NUM_LIT:0> ] [ '<STR_LIT>' ] , anodes [ <NUM_LIT:0> ] [ '<STR_LIT:port>' ] ) , <EOL> self . ipport2server , self . pids ) <EOL> client . delete_container ( self . url , self . token , container1 ) <EOL> client . put_object ( self . url , self . token , container2 , '<STR_LIT>' , '<STR_LIT>' ) <EOL> headers , containers = client . get_account ( self . url , self . token ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:1>' ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:1>' ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:4>' ) <EOL> found1 = False <EOL> found2 = False <EOL> for container in containers : <EOL> if container [ '<STR_LIT:name>' ] == container1 : <EOL> found1 = True <EOL> elif container [ '<STR_LIT:name>' ] == container2 : <EOL> found2 = True <EOL> self . assertEqual ( container [ '<STR_LIT:count>' ] , <NUM_LIT:1> ) <EOL> self . assertEqual ( container [ '<STR_LIT>' ] , <NUM_LIT:4> ) <EOL> self . assertFalse ( found1 ) <EOL> self . assertTrue ( found2 ) <EOL> Manager ( [ '<STR_LIT>' ] ) . once ( ) <EOL> headers , containers = client . get_account ( self . url , self . token ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:1>' ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:2>' ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> found1 = False <EOL> found2 = False <EOL> for container in containers : <EOL> if container [ '<STR_LIT:name>' ] == container1 : <EOL> found1 = True <EOL> elif container [ '<STR_LIT:name>' ] == container2 : <EOL> found2 = True <EOL> self . assertEqual ( container [ '<STR_LIT:count>' ] , <NUM_LIT:2> ) <EOL> self . assertEqual ( container [ '<STR_LIT>' ] , <NUM_LIT:9> ) <EOL> self . assertFalse ( found1 ) <EOL> self . assertTrue ( found2 ) <EOL> start_server ( ( anodes [ <NUM_LIT:0> ] [ '<STR_LIT>' ] , anodes [ <NUM_LIT:0> ] [ '<STR_LIT:port>' ] ) , <EOL> self . ipport2server , self . pids ) <EOL> headers , containers = direct_client . direct_get_account ( anodes [ <NUM_LIT:0> ] , apart , self . account ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:2>' ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:1>' ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:4>' ) <EOL> found1 = False <EOL> found2 = False <EOL> for container in containers : <EOL> if container [ '<STR_LIT:name>' ] == container1 : <EOL> found1 = True <EOL> elif container [ '<STR_LIT:name>' ] == container2 : <EOL> found2 = True <EOL> self . assertEqual ( container [ '<STR_LIT:count>' ] , <NUM_LIT:1> ) <EOL> self . assertEqual ( container [ '<STR_LIT>' ] , <NUM_LIT:4> ) <EOL> self . assertTrue ( found1 ) <EOL> self . assertTrue ( found2 ) <EOL> self . get_to_final_state ( ) <EOL> headers , containers = direct_client . direct_get_account ( anodes [ <NUM_LIT:0> ] , apart , self . account ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:1>' ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT:2>' ) <EOL> self . assertEqual ( headers [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> found1 = False <EOL> found2 = False <EOL> for container in containers : <EOL> if container [ '<STR_LIT:name>' ] == container1 : <EOL> found1 = True <EOL> elif container [ '<STR_LIT:name>' ] == container2 : <EOL> found2 = True <EOL> self . assertEqual ( container [ '<STR_LIT:count>' ] , <NUM_LIT:2> ) <EOL> self . assertEqual ( container [ '<STR_LIT>' ] , <NUM_LIT:9> ) <EOL> self . assertEqual ( container [ '<STR_LIT>' ] , <NUM_LIT:9> ) <EOL> self . assertFalse ( found1 ) <EOL> self . assertTrue ( found2 ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
