Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
ZODB
Commits
e24e1b42
Commit
e24e1b42
authored
Jun 16, 2003
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deal more sensibly with keep flag for tests that restart servers.
parent
fa0327cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
src/ZEO/tests/ConnectionTests.py
src/ZEO/tests/ConnectionTests.py
+17
-12
No files found.
src/ZEO/tests/ConnectionTests.py
View file @
e24e1b42
...
@@ -168,7 +168,7 @@ class CommonSetupTearDown(StorageTestBase):
...
@@ -168,7 +168,7 @@ class CommonSetupTearDown(StorageTestBase):
zconf
.
transaction_timeout
=
self
.
timeout
zconf
.
transaction_timeout
=
self
.
timeout
return
zconf
return
zconf
def
startServer
(
self
,
create
=
1
,
index
=
0
,
read_only
=
0
,
ro_svr
=
0
):
def
startServer
(
self
,
create
=
1
,
index
=
0
,
read_only
=
0
,
ro_svr
=
0
,
keep
=
None
):
addr
=
self
.
addr
[
index
]
addr
=
self
.
addr
[
index
]
zLOG
.
LOG
(
"testZEO"
,
zLOG
.
INFO
,
zLOG
.
LOG
(
"testZEO"
,
zLOG
.
INFO
,
"startServer(create=%d, index=%d, read_only=%d) @ %s"
%
"startServer(create=%d, index=%d, read_only=%d) @ %s"
%
...
@@ -176,9 +176,10 @@ class CommonSetupTearDown(StorageTestBase):
...
@@ -176,9 +176,10 @@ class CommonSetupTearDown(StorageTestBase):
path
=
"%s.%d"
%
(
self
.
file
,
index
)
path
=
"%s.%d"
%
(
self
.
file
,
index
)
sconf
=
self
.
getConfig
(
path
,
create
,
read_only
)
sconf
=
self
.
getConfig
(
path
,
create
,
read_only
)
zconf
=
self
.
getServerConfig
(
addr
,
ro_svr
)
zconf
=
self
.
getServerConfig
(
addr
,
ro_svr
)
zeoport
,
adminaddr
,
pid
,
path
=
forker
.
start_zeo_server
(
sconf
,
zconf
,
if
keep
is
None
:
addr
[
1
],
keep
=
self
.
keep
self
.
keep
)
zeoport
,
adminaddr
,
pid
,
path
=
forker
.
start_zeo_server
(
sconf
,
zconf
,
addr
[
1
],
keep
)
self
.
conf_paths
.
append
(
path
)
self
.
conf_paths
.
append
(
path
)
self
.
_pids
.
append
(
pid
)
self
.
_pids
.
append
(
pid
)
self
.
_servers
.
append
(
adminaddr
)
self
.
_servers
.
append
(
adminaddr
)
...
@@ -564,6 +565,10 @@ class ConnectionTests(CommonSetupTearDown):
...
@@ -564,6 +565,10 @@ class ConnectionTests(CommonSetupTearDown):
db1
.
close
()
db1
.
close
()
class
ReconnectionTests
(
CommonSetupTearDown
):
class
ReconnectionTests
(
CommonSetupTearDown
):
# The setUp() starts a server automatically. In order for its
# state to persist, we set the class variable keep to 1. In
# order for its state to be cleaned up, the last startServer()
# call in the test must pass keep=0.
keep
=
1
keep
=
1
invq
=
2
invq
=
2
...
@@ -574,7 +579,7 @@ class ReconnectionTests(CommonSetupTearDown):
...
@@ -574,7 +579,7 @@ class ReconnectionTests(CommonSetupTearDown):
self
.
shutdownServer
()
self
.
shutdownServer
()
self
.
_servers
=
[]
self
.
_servers
=
[]
# Start a read-only server
# Start a read-only server
self
.
startServer
(
create
=
0
,
index
=
0
,
read_only
=
1
)
self
.
startServer
(
create
=
0
,
index
=
0
,
read_only
=
1
,
keep
=
0
)
# Start a read-only client
# Start a read-only client
self
.
_storage
=
self
.
openClientStorage
(
read_only
=
1
)
self
.
_storage
=
self
.
openClientStorage
(
read_only
=
1
)
# Stores should fail here
# Stores should fail here
...
@@ -587,7 +592,7 @@ class ReconnectionTests(CommonSetupTearDown):
...
@@ -587,7 +592,7 @@ class ReconnectionTests(CommonSetupTearDown):
self
.
shutdownServer
()
self
.
shutdownServer
()
self
.
_servers
=
[]
self
.
_servers
=
[]
# Start a read-only server
# Start a read-only server
self
.
startServer
(
create
=
0
,
index
=
0
,
read_only
=
1
)
self
.
startServer
(
create
=
0
,
index
=
0
,
read_only
=
1
,
keep
=
0
)
# Start a read-only-fallback client
# Start a read-only-fallback client
self
.
_storage
=
self
.
openClientStorage
(
read_only_fallback
=
1
)
self
.
_storage
=
self
.
openClientStorage
(
read_only_fallback
=
1
)
# Stores should fail here
# Stores should fail here
...
@@ -611,7 +616,7 @@ class ReconnectionTests(CommonSetupTearDown):
...
@@ -611,7 +616,7 @@ class ReconnectionTests(CommonSetupTearDown):
self
.
assertRaises
(
ReadOnlyError
,
self
.
_dostore
)
self
.
assertRaises
(
ReadOnlyError
,
self
.
_dostore
)
# Restart the server
# Restart the server
self
.
startServer
(
create
=
0
,
read_only
=
1
)
self
.
startServer
(
create
=
0
,
read_only
=
1
,
keep
=
0
)
# Poll until the client connects
# Poll until the client connects
self
.
pollUp
()
self
.
pollUp
()
# Stores should still fail
# Stores should still fail
...
@@ -635,7 +640,7 @@ class ReconnectionTests(CommonSetupTearDown):
...
@@ -635,7 +640,7 @@ class ReconnectionTests(CommonSetupTearDown):
self
.
assertRaises
(
ClientDisconnected
,
self
.
_dostore
)
self
.
assertRaises
(
ClientDisconnected
,
self
.
_dostore
)
# Restart the server
# Restart the server
self
.
startServer
(
create
=
0
,
read_only
=
1
)
self
.
startServer
(
create
=
0
,
read_only
=
1
,
keep
=
0
)
# Poll until the client connects
# Poll until the client connects
self
.
pollUp
()
self
.
pollUp
()
# Stores should fail here
# Stores should fail here
...
@@ -664,7 +669,7 @@ class ReconnectionTests(CommonSetupTearDown):
...
@@ -664,7 +669,7 @@ class ReconnectionTests(CommonSetupTearDown):
self
.
assertRaises
(
ClientDisconnected
,
self
.
_dostore
)
self
.
assertRaises
(
ClientDisconnected
,
self
.
_dostore
)
# Restart the server, this time read-write
# Restart the server, this time read-write
self
.
startServer
(
create
=
0
)
self
.
startServer
(
create
=
0
,
keep
=
0
)
# Poll until the client sconnects
# Poll until the client sconnects
self
.
pollUp
()
self
.
pollUp
()
# Stores should now succeed
# Stores should now succeed
...
@@ -688,7 +693,7 @@ class ReconnectionTests(CommonSetupTearDown):
...
@@ -688,7 +693,7 @@ class ReconnectionTests(CommonSetupTearDown):
self
.
assertRaises
(
ReadOnlyError
,
self
.
_dostore
)
self
.
assertRaises
(
ReadOnlyError
,
self
.
_dostore
)
# Start a read-write server
# Start a read-write server
self
.
startServer
(
index
=
1
,
read_only
=
0
)
self
.
startServer
(
index
=
1
,
read_only
=
0
,
keep
=
0
)
# After a while, stores should work
# After a while, stores should work
for
i
in
range
(
300
):
# Try for 30 seconds
for
i
in
range
(
300
):
# Try for 30 seconds
try
:
try
:
...
@@ -711,7 +716,7 @@ class ReconnectionTests(CommonSetupTearDown):
...
@@ -711,7 +716,7 @@ class ReconnectionTests(CommonSetupTearDown):
self
.
shutdownServer
()
self
.
shutdownServer
()
self
.
pollDown
()
self
.
pollDown
()
self
.
_storage
.
verify_result
=
None
self
.
_storage
.
verify_result
=
None
self
.
startServer
(
create
=
0
)
self
.
startServer
(
create
=
0
,
keep
=
0
)
self
.
pollUp
()
self
.
pollUp
()
# There were no transactions committed, so no verification
# There were no transactions committed, so no verification
# should be needed.
# should be needed.
...
@@ -739,7 +744,7 @@ class ReconnectionTests(CommonSetupTearDown):
...
@@ -739,7 +744,7 @@ class ReconnectionTests(CommonSetupTearDown):
self
.
_storage
.
verify_result
=
None
self
.
_storage
.
verify_result
=
None
perstorage
.
verify_result
=
None
perstorage
.
verify_result
=
None
zLOG
.
LOG
(
"testZEO"
,
zLOG
.
INFO
,
'2ALLBEEF'
)
zLOG
.
LOG
(
"testZEO"
,
zLOG
.
INFO
,
'2ALLBEEF'
)
self
.
startServer
(
create
=
0
)
self
.
startServer
(
create
=
0
,
keep
=
0
)
self
.
pollUp
()
self
.
pollUp
()
self
.
pollUp
(
storage
=
perstorage
)
self
.
pollUp
(
storage
=
perstorage
)
# There were no transactions committed, so no verification
# There were no transactions committed, so no verification
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment