- ?csGdkZdkZdkZdkZdkZdkZdkZdkZdkZdk Z dkZdk Z dk l Z dk lZdklZ dklZ!dklZ#dklZ$dklZlZ%dklZlZ&d klZ'd kl Z (d kl!Z!l"Z")d kl#Z#l$Z$*d kl%Z%,de fdYZ&>dfdYZ'BdefdYZ(de(fdYZ)@de(fdYZ*de(fdYZ+>de(fdYZ,de i-fdYZ.dS(N(s ClientStorage(sClientDisconnected(s Marshaller(sDisconnectedError(sforker(sDB(sget_transactions Transaction(s ReadOnlyErrors ConflictError(sStorageTestBase(sMinPO(s zodb_pickles zodb_unpickle(shandle_all_serialssZERO(shandle_serialssTestClientStoragecs8,tZ.dZ0dZ4dZ8dZRS(Nics101ti|_2ti|||_dS(N(s threadingsEventsselfs end_verifys ClientStorages verify_cachesstubs verify_result(sselfsstub((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys verify_cache0scs'45ti|6|iidS(N(s ClientStorages endVerifysselfs end_verifysset(sself((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys endVerify4scs489z:ti||SWd;<d|_XdS(Ni(s ClientStoragestestConnectionsselfsconnstest_connection(sselfsconn((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pystestConnection8s(s__name__s __module__stest_connections verify_caches endVerifystestConnection(((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pysTestClientStorage,s    sDummyDBcs>tZ?dZRS(Ncs ?@dS(N((sselfsargsskwargs((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys invalidate?s(s__name__s __module__s invalidate(((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pysDummyDB>s sCommonSetupTearDownc sBtZdZCEeiZFeiZGdZHe Z Ie Z JdZ Ke ZMdZ_dZdZdZdZdZe dddde e e d Zd Zdddde d Zdd Zd e dZd dZRS(sCommon boilerplateicsMST|iUtidtid|iVti|_Wg|_ Xg|_ Yg|_ Zg|_ [g|_ \|i]|idS(sTest setup for connection tests. This starts only one server; a test may start more servers by calling self._newAddr() and then self.startServer(index=i) for i in 1, 2, ... stestZEOs setUp() %sN(sselfs!_CommonSetupTearDown__super_setUpszLOGsLOGsINFOsidstempfilesmktempsfilesaddrs_pidss_serverss conf_pathsscachess_newAddrs startServer(sself((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pyssetUpMs #      c sU_`atidtid|ibx$|iDb]}cti|q6Wdt |dt t j oae|i i ft |i do7gtidtid|i ii|i innjx8|iDj]*}k|t j olti|nqWmt tdo1ox'|iDo]}pti|dq.Wnqx|iDq]}rxddfDr]}sd ||f}yd}ztii|ok{d}|xXtd D|]G}}y~ti |Wnt!i"d nXd}PqWn|oti |nqxWq_W|i#d S( sTry to cause the tests to haltstestZEOs tearDown() %ss_storagescleanupscleanup storage %sswaitpidiis c1-%s-%d.zecif0.5N($szLOGsLOGsINFOsselfsids conf_pathsspsossremovesgetattrsNones_storagescloseshasattrsDEBUGs__name__scleanups_serverss adminaddrsforkersshutdown_zeo_servers_pidsspidswaitpidscachesscsispathsneed_to_deletesexistssrangesdummysunlinkstimessleeps$_CommonSetupTearDown__super_tearDown( sselfsdummyscsneed_to_deletesis adminaddrspidspspath((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pystearDown_sJ# #          cs |ii|idS(N(sselfsaddrsappends_getAddr(sself((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys_newAddrscs#dtidddfSdS(Ns localhostiai0ui(srandoms randrange(sself((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys_getAddrscstdS(N(sNotImplementedError(sselfspathscreates read_only((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys getConfigsii@ c s|tjo.t|ii}|iid7_n|ii|t|i d|d|d|ddd|d|d |d |d | } | itt| SdS( Nisclients cache_sizeswaitsmin_disconnect_pollf0.10000000000000001s read_onlysread_only_fallbacksusernamespasswordsrealm(scachesNonesstrsselfs __class__scache_idscachessappendsTestClientStoragesaddrs cache_sizeswaits read_onlysread_only_fallbacksusernamespasswordsrealmsstorages registerDBsDummyDB( sselfscaches cache_sizeswaits read_onlysread_only_fallbacksusernamespasswordsrealmsstorage((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pysopenClientStorages          csti|}|od|_n|ioddf|_n|i o|i |_ n|i o|i |_ n|SdS(Nisi( sforkers ZEOConfigsaddrszconfsro_svrs read_onlysselfsmonitorsmonitor_addresssinvqsinvalidation_queue_sizestimeoutstransaction_timeout(sselfsaddrsro_svrszconf((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pysgetServerConfigs    c s |i|} tidtid|||| fd|i|f} |i | ||}|i | |}|tjo|i}nti||| d|\} }} } |ii| |ii| |ii|dS(NstestZEOs3startServer(create=%d, index=%d, read_only=%d) @ %ss%s.%di(sselfsaddrsindexszLOGsLOGsINFOscreates read_onlysfilespaths getConfigssconfsgetServerConfigsro_svrszconfskeepsNonesforkersstart_zeo_serverszeoports adminaddrspids conf_pathssappends_pidss_servers( sselfscreatesindexs read_onlysro_svrskeepssconfszconfs adminaddrspidspathszeoportsaddr((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys startServers+csutidtid||i|f|i|}|tj o$ti |t|i||idS(Nsasbi f0.10000000000000001( sDBsselfsopenClientStoragesdb1sopensc1srootsr1sMinPOsget_transactionscommitsdb2sr2s assertEqualsvaluesrangesis_storagessyncs _invalidatedshas_keys_p_oidstimessleepsassert_ssetLocalTransactionsgetTransactionsregistersabortskeyss _p_serialsclose(sselfsr1sr2sisdb1sc1sdb2((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pyscheckCrossDBInvalidationss0    (s__name__s __module__s__doc__scheckMultipleAddressesscheckMultipleServersscheckReadOnlyClientscheckReadOnlyServerscheckReadOnlyFallbackWritables#checkReadOnlyFallbackReadOnlyServerscheckReconnectWritablescheckDisconnectionErrorscheckDisconnectedAbortscheckBasicPersistences checkRolloverscheckReconnectionscheckBadMessage1scheckBadMessage2s _bad_messagesNOcheckMultiStorageTransactionscheckCrossDBInvalidations(((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pysConnectionTestss$     #   (  s InvqTestscs,@tZAdZCdZ]dZRS(Nics4CD|idd}E|i|idG|i|_H|ii}K|i|iidN|i|}O|i||}Q|i |dR|i T|i||}V|idd}W|i|idY|i|i |dZ|ii |d[|i dS(Nscachestestsfull verificationssquick verification( sselfsopenClientStorages perstorages assertEquals verify_results_storagesnew_oidsoids_dostoresrevidsloadsclose(sselfsoidsrevids perstorage((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys"checkQuickVerificationWith2ClientsCs cs]^|idd}_|i|ida|i|_b|ii}e|i|iidh|i|}i|i||}k|i |dl|i ox,t dDo]}p|i||}qWr|idd}s|i|idttid}uxPu|ii o;v|iwti|jox|idnq(Wz|i|ii |dd|{|i|i |d||ii |d~|i dS( Nscachestestsfull verificationsiistimed out waiting for endVerifyi(sselfsopenClientStorages perstorages assertEquals verify_results_storagesnew_oidsoids_dostoresrevidsloadsclosesrangesistimests end_verifysisSetssyncsfail(sselfstsisoidsrevids perstorage((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys)checkVerificationWith2ClientsInvqOverflow]s0   &(s__name__s __module__sinvqs"checkQuickVerificationWith2Clientss)checkVerificationWith2ClientsInvqOverflow(((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys InvqTests@s   sReconnectionTestscs}tZdZdZdZdZdZdZdZdZ d Z d Z RS( Niic ss|ig|_|idddddddd|idd|_|it|idS(Nscreateisindexs read_onlyiskeep( sselfsshutdownServers_serverss startServersopenClientStorages_storages assertRaisess ReadOnlyErrors_dostore(sself((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pyscheckReadOnlyStorages   %c ss|ig|_|idddddddd|idd|_|it|idS(Nscreateisindexs read_onlyiskeepsread_only_fallback( sselfsshutdownServers_serverss startServersopenClientStorages_storages assertRaisess ReadOnlyErrors_dostore(sself((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys$checkReadOnlyFallbackReadOnlyStorages   %cs|idd|_|it|i|ig|_|i|it|i|i dddddd|i |it|idS(Ns read_onlyiscreateiskeep( sselfsopenClientStorages_storages assertRaisess ReadOnlyErrors_dostoresshutdownServers_serversspollDowns startServerspollUp(sself((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pyscheckReconnectReadOnlys    cs|idd|_|i|ig|_|i|it|i|i dddddd|i |it |idS(Nsread_only_fallbackiscreateis read_onlyskeep( sselfsopenClientStorages_storages_dostoresshutdownServers_serversspollDowns assertRaisessClientDisconnecteds startServerspollUps ReadOnlyError(sself((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pyscheckReconnectFallbacks     cs|ig|_|idddd|idd|_|it|i|ig|_|i |it |i|idddd|i |idS(Nscreateis read_onlyisread_only_fallbackskeep( sselfsshutdownServers_serverss startServersopenClientStorages_storages assertRaisess ReadOnlyErrors_dostorespollDownsClientDisconnectedspollUp(sself((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pyscheckReconnectUpgrades      c s|ig|_|i|idddddddd|idd|_|it|i |iddddddxnt dD]M}y|i PWn,t tfj o t id nXqW |id dS( Nscreateisindexs read_onlyiskeepsread_only_fallbacki,f0.10000000000000001s1Couldn't store after starting a read-write server(sselfsshutdownServers_serverss_newAddrs startServersopenClientStorages_storages assertRaisess ReadOnlyErrors_dostoresrangesisClientDisconnectedstimessleepsfail(sselfsi((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pyscheckReconnectSwitchs   %  cs|i|_|i|iid|i|i|it|i_|i dddd|i |i|iiddS(Nsfull verificationscreateiskeepsno verification( sselfsopenClientStorages_storages assertEquals verify_results_dostoresshutdownServerspollDownsNones startServerspollUp(sself((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys"checkNoVerificationOnServerRestarts    csz|idd} |i|id"|i|_#|ii}&|i|iid)|i|}*|i||,|i |d.|i 0|i 1t |i_2t |_3tidtid4|iddd d5|i6|id |9|i|iid :|i|id ;|i<|iidS( Nscachestestsfull verificationsstestZEOs2ALLBEEFscreateiskeepsstoragesno verification(sselfsopenClientStorages perstorages assertEquals verify_results_storagesnew_oidsoids_dostoresrevidsloadsshutdownServerspollDownsNoneszLOGsLOGsINFOs startServerspollUpsclose(sselfsoidsrevids perstorage((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys.checkNoVerificationOnServerRestartWith2Clientss(     ( s__name__s __module__skeepsinvqscheckReadOnlyStorages$checkReadOnlyFallbackReadOnlyStoragescheckReconnectReadOnlyscheckReconnectFallbackscheckReconnectUpgradescheckReconnectSwitchs"checkNoVerificationOnServerRestarts.checkNoVerificationOnServerRestartWith2Clients(((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pysReconnectionTestss       s TimeoutTestscsP>tZ?dZAdZJdZRdZYdZvdZRS(NicsxAB|i}Ct}D|i|E|i|FtidG|i t |i |H|i dS(Ni( sselfsopenClientStoragesstorages Transactionstxns tpc_beginstpc_votestimessleeps assertRaisessClientDisconnecteds tpc_finishsclose(sselfstxnsstorage((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys checkTimeoutAs cs_JK|i}Lt}M|i|N|i|O|i|P|idS(N( sselfsopenClientStoragesstorages Transactionstxns tpc_beginstpc_votes tpc_abortsclose(sselfstxnsstorage((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pyscheckTimeoutOnAbortJs  csORS|i}Tt}U|i|V|i|W|idS(N(sselfsopenClientStoragesstorages Transactionstxns tpc_begins tpc_abortsclose(sselfstxnsstorage((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pyscheckTimeoutOnAbortNoLockRs  c sXYZ|i}[|i}\|i|_}^||ii `|i }at d}bdd}dt}e|i|f|i||t|d|}g|i|itidj|ik||i l|im||io|t|i|q||ii t|t|i|ddS(Nisisi(sselfs assertRaisessraisess failUnlesssunlesssopenClientStorages_storagesstorages_caches_indexsnew_oidsoidsMinPOsobjsZEROs Transactionsts tpc_beginsstores zodb_picklesrevid1stpc_votestimessleepssyncs is_connecteds_waitsClientDisconnecteds tpc_finishsKeyErrorsload( sselfsunlesssoidsstoragesrevid1sZEROsraisessobjst((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pyscheckTimeoutAfterVoteYs&    $  csvw|i} x|i}y|i}z|i|_}|||i i ~|i }td} dd}t}|i||i||t| d|} |i|} t|| | }|i|d| _t}|i||i||t| d|}|i|}t|||}t i!d|i"||i# |i$||i#|t%|i|d| _t}|i||i||t| d||t&|i||i'||i|d| _t}|i||i||t| d||t&|i||i'||i|d| _t}|i||i||t| d|}|i|}t|||}|i||i(|d\} }| t+| td| ||dS( Nisisii i i (,sselfs assertEqualseqs assertRaisessraisess failUnlesssunlesssopenClientStorages_storagesstorages_caches_indexsnew_oidsoidsMinPOsobjsZEROs Transactionsts tpc_beginsstores zodb_picklesrevid1astpc_votesrevid1bshandle_serialssrevid1s tpc_finishsvaluesrevid2asrevid2bsrevid2stimessleepssyncs is_connecteds_waitsClientDisconnecteds ConflictErrors tpc_abortsloadsdatasrevids zodb_unpickle(sselfsunlesssstoragesoidsrevidsZEROsraisessrevid2asrevid2bseqsrevid1asrevid1bsobjsdatasrevid2srevid1st((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pyscheckTimeoutProvokingConflictsvsd     $  $    "  "  $(s__name__s __module__stimeouts checkTimeoutscheckTimeoutOnAbortscheckTimeoutOnAbortNoLockscheckTimeoutAfterVotescheckTimeoutProvokingConflicts(((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys TimeoutTests>s     s MSTThreadcs>tZeiiZdZdZdZRS(Ncs2|id|||_g|_dS(Nsname(sselfs_MSTThread__super_initsnamestestcasesclients(sselfstestcasesname((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys__init__s c s|i}|i}|i}x\tt|iD]B}|i d|i|}d||_ |i |qCWx2t|i D]}x)|D]}g|_h|_qWt}x!|D]}|i|qWxt|iD]}x|D]}|i} |ii | td||i ||f} t| } |i| t| d|}|iit| |q0WqWx?|D]4}|i|}|iitt |qWx!|D]}|i!|qWx|D]u}x0|iD]"} |i"|ii#| qZWx3|ii$D]} |i"| |ijqWqDWqWdS(NsaddrsC%ds %s.%s.t%d.o%ds(%sselfsgetNamestnamestestcasesclientssrangeslensaddrsisopenClientStoragescs_MSTThread__namesappendsntranss_MSTThread__oidss_MSTThread__serialss Transactionsts tpc_beginsnobjsjsnew_oidsoidsMinPOsdatas zodb_picklesstoresZEROsssupdateshandle_all_serialsstpc_votesNones tpc_finishs failUnlessshas_keyskeys( sselfscsisclientssssjstestcaseststnamesdatasoid((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pysrunsV          "$       csEx8|iD]*}y|iWn nXqWdS(N(sselfsclientsscsclose(sselfsc((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys closeclientss  (s__name__s __module__s threadingsThreads__init__s_MSTThread__super_initsruns closeclients(((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys MSTThreads   9(/sosssysstimesrandomsselectssocketsasyncorestempfilesthreads threadingszLOGsZEO.ClientStorages ClientStoragesZEO.ExceptionssClientDisconnectedsZEO.zrpc.marshals MarshallersZEO.zrpc.errorsDisconnectedErrors ZEO.testssforkersZODB.DBsDBsZODB.Transactionsget_transactions TransactionsZODB.POSExceptions ReadOnlyErrors ConflictErrorsZODB.tests.StorageTestBasesStorageTestBasesZODB.tests.MinPOsMinPOs zodb_pickles zodb_unpickleshandle_all_serialssZEROshandle_serialssTestClientStoragesDummyDBsCommonSetupTearDownsConnectionTestss InvqTestssReconnectionTestss TimeoutTestssThreads MSTThread($sConnectionTestss TransactionsasyncoresTestClientStorages TimeoutTestss MSTThreadsrandomsDBsforkerssyss ConflictErrorsget_transactionsStorageTestBaseshandle_all_serialssReconnectionTestssMinPOsDummyDBsselects ClientStoragessocketsthreads threadingstempfiles zodb_unpickles zodb_pickles InvqTestssZEROsCommonSetupTearDownsDisconnectedErrors Marshallershandle_serialssClientDisconnectedstimeszLOGsoss ReadOnlyError((sA/usr/pkg/lib/python2.2/site-packages/ZEO/tests/ConnectionTests.pys?sB           ^@|