Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
ZKAPAuthorizer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Administrator
ZKAPAuthorizer
Commits
00f85d15
Commit
00f85d15
authored
3 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
pass the whole clock to StorageServer, as Tahoe-LAFS wants
parent
0db734c0
No related branches found
No related tags found
1 merge request
!275
Depend on/Compatibility with Tahoe-LAFS 1.17.0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/_zkapauthorizer/tests/fixtures.py
+3
-12
3 additions, 12 deletions
src/_zkapauthorizer/tests/fixtures.py
src/_zkapauthorizer/tests/test_storage_protocol.py
+32
-55
32 additions, 55 deletions
src/_zkapauthorizer/tests/test_storage_protocol.py
with
35 additions
and
67 deletions
src/_zkapauthorizer/tests/fixtures.py
+
3
−
12
View file @
00f85d15
...
@@ -21,7 +21,6 @@ from __future__ import absolute_import
...
@@ -21,7 +21,6 @@ from __future__ import absolute_import
from
base64
import
b64encode
from
base64
import
b64encode
import
attr
import
attr
from
allmydata
import
__version__
as
allmydata_version
from
allmydata.storage.server
import
StorageServer
from
allmydata.storage.server
import
StorageServer
from
fixtures
import
Fixture
,
TempDir
from
fixtures
import
Fixture
,
TempDir
from
twisted.internet.task
import
Clock
from
twisted.internet.task
import
Clock
...
@@ -51,18 +50,10 @@ class AnonymousStorageServer(Fixture):
...
@@ -51,18 +50,10 @@ class AnonymousStorageServer(Fixture):
def
_setUp
(
self
):
def
_setUp
(
self
):
self
.
tempdir
=
FilePath
(
self
.
useFixture
(
TempDir
()).
join
(
b
"
storage
"
))
self
.
tempdir
=
FilePath
(
self
.
useFixture
(
TempDir
()).
join
(
b
"
storage
"
))
if
allmydata_version
>=
"
1.16.
"
:
# This version of Tahoe adds a new StorageServer argument for
# controlling time.
timeargs
=
{
"
get_current_time
"
:
self
.
clock
.
seconds
}
else
:
# Older versions just use time.time() and there's not much we can
# do _here_. Code somewhere else will have to monkey-patch that
# to control things.
timeargs
=
{}
self
.
storage_server
=
StorageServer
(
self
.
storage_server
=
StorageServer
(
self
.
tempdir
.
asBytesMode
().
path
,
b
"
x
"
*
20
,
**
timeargs
self
.
tempdir
.
asBytesMode
().
path
,
b
"
x
"
*
20
,
clock
=
self
.
clock
,
)
)
...
...
This diff is collapsed.
Click to expand it.
src/_zkapauthorizer/tests/test_storage_protocol.py
+
32
−
55
View file @
00f85d15
...
@@ -21,7 +21,6 @@ from __future__ import absolute_import
...
@@ -21,7 +21,6 @@ from __future__ import absolute_import
from
allmydata.storage.common
import
storage_index_to_dir
from
allmydata.storage.common
import
storage_index_to_dir
from
allmydata.storage.shares
import
get_share_file
from
allmydata.storage.shares
import
get_share_file
from
challenge_bypass_ristretto
import
PublicKey
,
random_signing_key
from
challenge_bypass_ristretto
import
PublicKey
,
random_signing_key
from
fixtures
import
MonkeyPatch
from
foolscap.referenceable
import
LocalReferenceable
from
foolscap.referenceable
import
LocalReferenceable
from
hypothesis
import
assume
,
given
from
hypothesis
import
assume
,
given
from
hypothesis.strategies
import
data
as
data_strategy
from
hypothesis.strategies
import
data
as
data_strategy
...
@@ -540,15 +539,6 @@ class ShareTests(TestCase):
...
@@ -540,15 +539,6 @@ class ShareTests(TestCase):
self
.
clock
.
advance
(
when
)
self
.
clock
.
advance
(
when
)
# anonymous_storage_server uses time.time() before Tahoe-LAFS 1.16,
# unfortunately. For Tahoe-LAFS 1.16, AnonymousStorageServer will
# glue self.clock in for us. For older versions we still need this
# monkey-patching.
#
# And useFixture does not interact very well with Hypothesis.
patch
=
MonkeyPatch
(
"
time.time
"
,
self
.
clock
.
seconds
)
try
:
patch
.
setUp
()
# Create a share we can toy with.
# Create a share we can toy with.
write_shares
(
write_shares
(
self
.
anonymous_storage_server
,
self
.
anonymous_storage_server
,
...
@@ -565,8 +555,6 @@ class ShareTests(TestCase):
...
@@ -565,8 +555,6 @@ class ShareTests(TestCase):
renew_secret
,
renew_secret
,
cancel_secret
,
cancel_secret
,
)
)
finally
:
patch
.
cleanUp
()
expected
=
[
expected
=
[
{
{
...
@@ -771,9 +759,6 @@ class ShareTests(TestCase):
...
@@ -771,9 +759,6 @@ class ShareTests(TestCase):
"""
"""
self
.
clock
.
advance
(
when
)
self
.
clock
.
advance
(
when
)
patch
=
MonkeyPatch
(
"
time.time
"
,
self
.
clock
.
seconds
)
try
:
patch
.
setUp
()
# Create a share we can toy with.
# Create a share we can toy with.
wrote
,
read
=
extract_result
(
wrote
,
read
=
extract_result
(
self
.
client
.
slot_testv_and_readv_and_writev
(
self
.
client
.
slot_testv_and_readv_and_writev
(
...
@@ -786,8 +771,6 @@ class ShareTests(TestCase):
...
@@ -786,8 +771,6 @@ class ShareTests(TestCase):
r_vector
=
[],
r_vector
=
[],
),
),
)
)
finally
:
patch
.
cleanUp
()
self
.
assertThat
(
self
.
assertThat
(
wrote
,
wrote
,
Equals
(
True
),
Equals
(
True
),
...
@@ -1052,10 +1035,6 @@ class ShareTests(TestCase):
...
@@ -1052,10 +1035,6 @@ class ShareTests(TestCase):
r_vector
=
[],
r_vector
=
[],
)
)
patch
=
MonkeyPatch
(
"
time.time
"
,
self
.
clock
.
seconds
)
try
:
patch
.
setUp
()
# Create a share we can toy with.
# Create a share we can toy with.
self
.
assertThat
(
write
(),
is_successful_write
())
self
.
assertThat
(
write
(),
is_successful_write
())
...
@@ -1064,8 +1043,6 @@ class ShareTests(TestCase):
...
@@ -1064,8 +1043,6 @@ class ShareTests(TestCase):
self
.
clock
.
advance
(
self
.
server
.
LEASE_PERIOD
.
total_seconds
()
+
1
)
self
.
clock
.
advance
(
self
.
server
.
LEASE_PERIOD
.
total_seconds
()
+
1
)
self
.
assertThat
(
write
(),
is_successful_write
())
self
.
assertThat
(
write
(),
is_successful_write
())
finally
:
patch
.
cleanUp
()
# The spent passes have been reported to the spending service.
# The spent passes have been reported to the spending service.
self
.
assertThat
(
self
.
assertThat
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment