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
20693649
Commit
20693649
authored
Sep 17, 2002
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The test for a fallback client switching from a read-only to a
read-write server now works!!!
parent
f5365776
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
16 deletions
+14
-16
src/ZEO/tests/testZEO.py
src/ZEO/tests/testZEO.py
+14
-16
No files found.
src/ZEO/tests/testZEO.py
View file @
20693649
...
...
@@ -482,38 +482,36 @@ class ConnectionTests(StorageTestBase.StorageTestBase):
# Stores should now succeed
self
.
_dostore
()
def
NOcheckReadOnlyFallbackMultiple
(
self
):
#
XXX This test doesn't work yet
self
.
_newAddr
()
# We don't need the read-write server created by setUp()
zLOG
.
LOG
(
"testZEO"
,
zLOG
.
INFO
,
"shutdownServer"
)
def
checkReconnectSwitch
(
self
):
#
A fallback client initially connects to a read-only server,
# then discovers a read-write server and switches to that
# We don't want the read-write server created by setUp(
)
self
.
shutdownServer
()
self
.
_servers
=
[]
self
.
_pids
=
[]
# Allocate a second address (for the second server)
self
.
_newAddr
()
# Start a read-only server
zLOG
.
LOG
(
"testZEO"
,
zLOG
.
INFO
,
"startServer(read_only=1)"
)
self
.
_startServer
(
create
=
0
,
index
=
0
,
read_only
=
1
)
# Start a client
zLOG
.
LOG
(
"testZEO"
,
zLOG
.
INFO
,
"openClientStorage"
)
# Start a client in fallback mode
self
.
_storage
=
self
.
openClientStorage
(
wait
=
0
,
read_only_fallback
=
1
)
# Stores should fail here
zLOG
.
LOG
(
"testZEO"
,
zLOG
.
INFO
,
"stores should fail here"
)
self
.
assertRaises
(
ReadOnlyError
,
self
.
_dostore
)
# Start a read-write server
zLOG
.
LOG
(
"testZEO"
,
zLOG
.
INFO
,
"startServer(read_only=0)"
)
self
.
_startServer
(
index
=
1
,
read_only
=
0
)
# After a while, stores should work
for
i
in
range
(
30
):
for
i
in
range
(
30
0
):
# Try for 30 seconds
try
:
zLOG
.
LOG
(
"testZEO"
,
zLOG
.
INFO
,
"_dostore"
)
self
.
_dostore
()
zLOG
.
LOG
(
"testZEO"
,
zLOG
.
INFO
,
"done"
)
break
except
ReadOnlyError
:
zLOG
.
LOG
(
"testZEO"
,
zLOG
.
INFO
,
"sleep(1)"
)
time
.
sleep
(
1
)
time
.
sleep
(
0.1
)
else
:
self
.
fail
(
"
c
ouldn't store after starting a read-write server"
)
self
.
fail
(
"
C
ouldn't store after starting a read-write server"
)
def
checkDisconnectionError
(
self
):
# Make sure we get a Disconnected when we try to read an
...
...
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