Commit Graph

3990 Commits

Author SHA1 Message Date
Daira Hopwood
a622109a87 Don't include [magic_folder]enabled and local.directory fields by default.
Add a comment reminding to do the field modification properly.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
6fb7f86855 Don't use a long path for the [magic_folder]local.directory field.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
2a79252a72 Fix some path Unixisms.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
45adc30ed6 Fix test_alice_bob.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
e591c3aa81 Refactor _check_up/downloader_count.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
1abc2c39c8 Don't download the deletion marker file unnecessarily.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
c6191257ea Distinguish deletion of directories.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
d6bb49b1a6 Rename deleted files to .backup rather than unlinking them.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
David Stainton
a043a31860 Add file conflict unit test 2016-07-21 12:35:59 -07:00
David Stainton
99d1339d38 Add basic bob upload test and fix conflict detect 2016-07-21 12:35:59 -07:00
David Stainton
ee3d9b19be Fix bob's uploading test... 2016-07-21 12:35:59 -07:00
David Stainton
890e4622b9 Attempt to teach bob to upload a file 2016-07-21 12:35:59 -07:00
David Stainton
9ed61f1eb4 Count conflicted objects 2016-07-21 12:35:59 -07:00
Daira Hopwood
7a3b35e29c Basic remote conflict detection based on ancestor uri
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
f75dda7635 Avoid .format, since it is inconsistent between Python 2.6 and 2.7 (and the rest of Tahoe-LAFS doesn't use it).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
5a2b2e61c7 Fix test_alice_bob.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
e4082a45d3 Add counter for uploader.objects_not_uploaded.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
95e2961a2e Advance Bob's clock after notifying.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
6e5e8ddd80 test_alice_bob: use magic= argument to notify, rather than self.magicfolder.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
meejah
0d466ec1f9 add excluded check 2016-07-21 12:35:59 -07:00
meejah
c883977eb6 add the 'spurious' notifies 2016-07-21 12:35:59 -07:00
Daira Hopwood
c156581b73 Fix a pyflakes warning and check existence of file in Bob's local dir.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
meejah
d61b8ed39e implement 'delete' functionality, with tests 2016-07-21 12:35:59 -07:00
meejah
946656b249 smoketest for magic-folder functionality 2016-07-21 12:35:59 -07:00
Daira Hopwood
cec315da49 Add test that we don't write files outside the magic folder directory. refs ticket:2506
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
567668eb8c Fix infinite loop in should_ignore_path for absolute paths.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
5d5d804719 More debug logging.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
57753a62bc Unicode fix for do_join.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
7d2f30643e Minor cleanups to tests.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
f754938cc9 Ensure that errors from Alice-and-Bob tests are reported correctly if setup fails.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
b56c3e06e4 Cosmetics.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
2a7bb6f444 Eliminate duplicate parsing of invite code.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
c28594268e Remaining test fixes.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
a5874070e3 Make sure that do_cli is only called with strs, and avoid unnecessary use of attributes in tests.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
ed2d27e712 Cosmetics.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
643a105991 URIs are strs.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
59eede8e88 Aliases and nicknames are Unicode.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
bb596b017d Fix call to argv_to_abspath. Also rename localdir to local_dir.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
David Stainton
b32b61e727 Fix magic-folder cli tests
convert path to abs path when matching
strings in the generated config file.
2016-07-21 12:35:59 -07:00
David Stainton
a1beef34a7 Attempt to fix cli tests 2016-07-21 12:35:59 -07:00
Daira Hopwood
b2d494837c Better but still broken tests.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
903c6f1d6c Fix check for initial '-' in argv_to_abspath.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
David Stainton
0789d295a6 Fix tests by submitting unicode args instead of str 2016-07-21 12:35:59 -07:00
David Stainton
16275cb8f6 Teach magic-folder join to use argv_to_abspath
- also we modify argv_to_abspath to through a usage error
if the name starts with a '-'

- add a test
currently the tests fail
2016-07-21 12:35:59 -07:00
David Stainton
941f67f3b0 Use argv_to_abspath for magic-folder join file path arg 2016-07-21 12:35:59 -07:00
Daira Hopwood
5f6783e382 Test creation of a subdirectory.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
8184ed4414 Watch for IN_CREATE events but filter them out for non-directories.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
ee5245ed2c Patch Downloader.REMOTE_SCAN_INTERVAL rather than setting it persistently.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
cbec939d86 Implement creating local directories in downloader.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
60ab5a057a Decode names in the scanned remote.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
a3fa1617c2 Refactoring to allow logging from _write_downloaded_file and _rename_conflicted_file.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
6cb41cadf5 Simplify and fix non-existent-file handling.
Also make the existent and non-existent cases as similar as possible,
with a view to merging them.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
cb905d8d97 Logging/debugging improvements.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
fc3513d172 Refactor and fix race conditions in test_alice_bob.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
ac5730ea1c Correct a call to did_upload_version in the downloader.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
8a6dae6d59 Make sure that test_move_tree waits until files have been uploaded as well as downloaded.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
28587b5b2a Restore a call to increment files_uploaded that was mistakenly removed.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
David Stainton
2fcaa8c2b2 Teach uploader+downloader to use to db schema
here we attempt to fix all the unit tests as well...
however two tests still fail
2016-07-21 12:35:59 -07:00
Daira Hopwood
5754c01cb5 Add magicfolderdb.py.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
David Stainton
615859acc1 Remove magic-folder db code from backupdb.py 2016-07-21 12:35:59 -07:00
David Stainton
e2cee9ba2a WIP 2016-07-21 12:35:59 -07:00
David Stainton
3c50764486 Minor comment correction for get_all_relpaths 2016-07-21 12:35:59 -07:00
David Stainton
f8bb229ab7 For all downloaded files ensure parent dir exists 2016-07-21 12:35:59 -07:00
Daira Hopwood
c2d672e0b6 Simplify the cleanup_Alice_and_Bob callback.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
meejah
94a2ef0095 Make downloader delay a class-variable
This gives the integration-style CLI-based tests a chance
to set the delay to 0 before the first 3-second delayed
call is queued to _lazy_tail in the Downloader
2016-07-21 12:35:59 -07:00
meejah
9aecfed421 Teach unit-tests to time-warp
1. Split alice/bob clocks to avoid races conditions
   in the tests
2. Wrap ._notify so we can advance the clock after inotify
   calls in the RealTest (since it takes >0ms to do the "real" notifies)
2016-07-21 12:35:59 -07:00
meejah
4ed2fb725a Fix call to ready() 2016-07-21 12:35:59 -07:00
Daira Hopwood
31ab5cf4ed Correct a string-type error.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
e03a1e3361 WIP.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
262e238a7d Magic Folder file moves.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
3170cab0fc Prepare to move drop_upload.py to magic_folder.py.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
76a178969d Move backupdb.py to src/allmydata.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
976c89d2e4 Rename upload_ready_d to connected_enough_d.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
5f143f7635 Enable Windows inotify support.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
e7fb665e06 New code for Windows drop-upload support. refs #1431
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
61b3a9cef2 Add magic folder db.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Daira Hopwood
7b4067850f Unicode path fixes for drop-upload.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-21 12:35:59 -07:00
Brian Warner
b6dedc6223 clean up got_static_announcement() call 2016-07-19 17:31:43 -07:00
Brian Warner
2c5f7ed425 factor out yamlutil.py
The yaml.SafeLoader.add_constructor() should probably only be done once,
and moving this all into a module gives us an opportunity to test it
directly.
2016-07-19 17:31:41 -07:00
Brian Warner
9c1e22209f client.py: add missing import, fix wrong name
Without these, clients with a non-empty connections.yaml would crash as
they start up. It's safe to say we need some tests for this :-).

pyflakes catches all of these, but it got accidentally disabled
recently, so travis wasn't running it. I'll fix that in the next commit.
2016-07-19 17:30:45 -07:00
David Stainton
9063106f3a Change 'servers' sections of connections.yaml to support new design in #2788 2016-07-12 17:44:21 +01:00
David Stainton
a67e7c0db9 Remove old self.testing reference and conditional 2016-07-12 17:44:21 +01:00
David Stainton
e4d93a745c Load static server configuration from connections.yaml 2016-07-12 17:44:21 +01:00
Brian Warner
7d692d0afd Split control and log to two separate tubs, remove control knobs.
This also removes the tahoe.cfg keys that would have configured the
control-port. And it deletes the logport.furl file before asking the Tub
to re-create it, because we're now using an ephemeral Tub (so we're not
persisting the private key, so the tubid will change each time).

closes ticket:2794
2016-07-06 21:09:35 -07:00
David Stainton
e5ffbdbcdf Move control/logging to a separate Tub 2016-07-06 21:09:35 -07:00
Brian Warner
3402f75454 copy fixed allocate_tcp_port() from foolscap
The old copy had a bug which occasionally returns a port that was
actually in use, causing intermittent test failures (when large numbers
of ports were allocated). I finally figured out how to fix it in
Foolscap, so this is just a copy of the updated function.

closes ticket:2795
2016-07-06 19:20:32 -07:00
Brian Warner
a39270bd46 more v1-introducer cleanup: require sigs
This removes a little bit of code that tolerated unsigned announcements.
2016-07-05 16:41:15 -07:00
Brian Warner
6f1e01453e remove make_index()
index is now always (service_name, key_id)
2016-06-29 23:06:40 -07:00
Brian Warner
b2e5507e09 sign_to_foolscap: require key 2016-06-29 23:06:40 -07:00
Brian Warner
ae91fa9ffe require all outbound announcements to be signed 2016-06-29 23:06:40 -07:00
Brian Warner
c64ff7b310 more v1 removal cleanup
Historical note: V2 introducers have been around for three years
now (released in 1.10.0), so it's time to drop v1. This branch removes a
lot of fallback code, and tests which exercised it. refs ticket:2784

This patch removes some now-unused code: v1-related support functions on
the client, "stub-client" handlers, and v1-tolerant remote methods on
the server. The unit tests have been cleaned up a bit too, now that
there are fewer cases to exercise.
2016-06-29 22:58:14 -07:00
David Stainton
7feee8a25e Butcher unit tests until all test_introducer tests pass 2016-06-02 17:20:31 +00:00
David Stainton
ea35563b81 Remove v1 introducer code and fix tests
Fixed many of the test_introducer tests.
Work-in-progress.
2016-06-02 16:47:58 +00:00
Brian Warner
0ff00dff6f test loading the cache 2016-05-11 18:17:22 -07:00
Brian Warner
5bedca43e3 load-yaml-cache cleanups
* use yaml.safe_load and yaml.safe_dump
  * configure SafeLoader to return unicode consistently, not str
* log+ignore bad cache, instead of throwing error, since we're already
  in the log+ignore chain from connect_failed()
* use a local exception type, instead of one from storage_client.py
* delegate delivery to self._deliver_announcements

Using yaml.safe_dump gives us:

- ann:
    my-version: tahoe-lafs/1.11.0.post96.dev0
    nickname: node-4

instead of:

- ann:
    !!python/unicode 'my-version': !!python/unicode 'tahoe-lafs/1.11.0.post96.dev0'
    !!python/unicode 'nickname': !!python/unicode 'node-4'

We want SafeLoader to consistently return unicode instead of sometimes
plain strings (for ASCII-safe values) and sometimes unicode
(for everything else). The data we write into the cache was all unicode
to start with (it came from a JSON parser), so it seems better to get
back unicode too.
2016-05-11 18:15:50 -07:00
David Stainton
5508f751b6 Load announcement cache if failure to connect to introducer 2016-05-11 16:48:09 -07:00
Brian Warner
cfb939aa99 improve test_client_cache 2016-05-11 16:48:05 -07:00
Brian Warner
ecec58b339 test_introducer: factor out _load_cache 2016-05-11 15:03:32 -07:00
Brian Warner
1197b15106 introducer_client: split out _deliver_announcements 2016-05-11 12:54:11 -07:00
Brian Warner
155ca03174 test_introducer: cleanups
* Use tempfile for cache to avoid collisions
* Fix pyflakes complaints
* Remove test_client_cache_2, which exercises unsigned announcements.
  These are scheduled to be removed soon (see ticket:2784) and don't
  need to be tested.
2016-05-10 12:14:36 -07:00
Brian Warner
0c2dd8b86b IntroducerClient: small changes to cache handling
* don't remove the cache at connection establishment, we can just wait
  for the first announcement to truncate the cache
* save announcements before notifying subscribers, so they can safely
  read it right away
* remove unused self._got_announcement_cb
2016-05-10 12:14:04 -07:00
David Stainton
ae2b82a1f0 Add IntroducerClient write-only yaml cache file
this change also includes unit tests
2016-05-10 20:19:35 +00:00
Brian Warner
608719df91 tox: add "coverage" environment
Run with "tox -e coverage". Uses a new helper
module (allmydata.test.run_trial) to let us import+execute trial without
knowing exactly where the "trial" binary lives, which helps with using
"coverage run" under tox.
2016-05-09 14:32:21 -07:00
Brian Warner
93bb3e995a stats-gatherer: add --hostname/--location/--port
Updates docs, tests, explains how to update an old gatherer.
2016-05-04 17:58:45 -07:00
Brian Warner
d1d988410b remove "key-generator" node type and client support
closes ticket:2783
2016-05-04 16:53:04 -07:00
meejah
fa418a7809 appease windows, and skip test 2016-05-04 07:54:42 -07:00
Daira Hopwood
dd02f31a3b Fix missing import 2016-05-04 07:54:42 -07:00
Daira Hopwood
242f04818e Fix test to use arguments with absolute unicode paths 2016-05-04 07:54:42 -07:00
David Stainton
3524729fb1 Add make_dirs_with_absolute_mode to fileutils 2016-05-04 07:54:42 -07:00
Daira Hopwood
50747e2ca0 Strip any long path marker in the input to flush_volume.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-05-04 07:54:42 -07:00
Daira Hopwood
d07c45bdf4 Improve all of the Windows-specific error reporting.
Also make the Windows function declarations more readable and consistent.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-05-04 07:54:42 -07:00
Daira Hopwood
b517e200aa replace_file should allow the replaced file not to exist on Windows.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-05-04 07:54:42 -07:00
Daira Hopwood
7015f5d826 Fix fileutil tests.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-05-04 07:54:42 -07:00
Daira Hopwood
07389571c2 Add long_path=False option to abspath_expanduser_unicode.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-05-04 07:54:42 -07:00
Daira Hopwood
62dc2f7ac1 Re-order some imports in fileutil
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-05-04 07:54:42 -07:00
Daira Hopwood
9bfcb72400 Windows fileutil improvements
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-05-04 07:54:42 -07:00
Brian Warner
bbeb397a00 storage_client: remove unnecessary startService upcall 2016-05-03 15:48:08 -07:00
Brian Warner
76f6d2d21a create Tub inside NativeStorageServer, not broker
This makes IServer instances responsible for their own network
connections, which will help when we add HTTP-based servers in the
future. The StorageFarmBroker should not care about how the IServer uses
the network, it just provides the announcement (and local config).
2016-05-03 15:09:13 -07:00
Brian Warner
e147aa3da2 test: use patch() to control Tub creation
This reduces the dependency on the internals of storage_client.py
2016-05-03 14:49:31 -07:00
Brian Warner
e301ac88ea make test slightly easier to follow 2016-05-03 14:03:17 -07:00
Brian Warner
b9edccbeaa set the same options on all Tubs 2016-05-03 11:38:20 -07:00
meejah
aea0abf54a fix one utest 2016-05-02 18:09:53 -06:00
David Stainton
6061b6fc3c WIP Storage broker client creates one tub per server
i was unable to get all the unit tests working;
this is my work in progress.
2016-05-02 15:23:07 +00:00
Brian Warner
22c1031d19 test_introducer: stop using tcp:0
This fixes some of the upcoming-deprecation warnings against Foolscap
(>=0.11.0). There are still a bunch related to the key-generator and the
stats gatherer.
2016-04-28 11:01:40 -07:00
Brian Warner
5a5ba643e6 use twisted.web.static, not nevow.static, for public_html/
This avoids a privacy leak when the web.static= directory is configured
but doesn't exist (which is almost always, since we set `web.static =
public_html` in the default config file, but nothing automatically
creates it). The nevow.static.File class tries to os.stat() the
directory before doing anything else, which causes an exception, which
renders the traceback to the HTTP client as a 500 Internal Server Error,
and the traceback includes the full path of the missing public_html
directory, which reveals the node's basedir.

Plain twisted.web.static.File doesn't do this check, and a missing
web.static directory just results in a plain old 404.

Closes ticket:1720.
2016-04-28 00:42:59 -07:00
Brian Warner
ea473cdc76 remove pickle-based stats output altogether
* update munin plugin to read JSON, not pickle
* update docs
2016-04-27 17:27:33 -07:00
Corbin Simpson
e1dba4abeb stats: Dump a JSON file next to the pickle file.
Extremely useful for interoperating with non-Python (e.g. Monte) tooling.
2016-04-27 14:45:37 -07:00
Brian Warner
96c625920c Teach tub to start synchronously even with ip autodetect
* remove when_tub_ready() from all code
* synchronous-ify all node/client/introducer startup code

refs ticket:2491
2016-04-26 21:54:45 -07:00
Brian Warner
ffc2f48cfe compute tub location before creating Tub
This can be done synchronously because we now know the port number
earlier. This still uses get_local_addresses_sync() (not _async) to do
automatic IP-address detection if the config file didn't set
tub.location or used the special word "AUTO" in it.

The new implementation slightly changes the mapping from tub.location to
the assigned location string. The old code removed all instances of
"AUTO" from the location and then extended the hints with the local
ones (so "hint1:AUTO:hint2" turns into "hint1:hint2:auto1:auto2"). The
new code exactly replaces each "AUTO" with the local hints (so that
example turns into "hint1:auto1:auto2:hint2", and a silly
"hint1:AUTO:AUTO" would turn into "hint1:auto1:auto2:auto1:auto2"). This
is unlikely to affect anybody.
2016-04-26 18:39:47 -07:00
Brian Warner
bdf1f8460d iputil.py: expose get_local_addresses_sync 2016-04-26 18:39:47 -07:00
Brian Warner
cf5b02b487 clean up tub.port processing, reject tcp:0
This is the first step towards making node startup be synchronous: the
tub.port is entirely determined (including any TCP port allocation that
might be necessary) before creating the Tub, so the portnumber part of
FURLs can be determined earlier.
2016-04-26 18:39:47 -07:00
Brian Warner
7637d70f1b test_introducer.ClientSeqnums: disable storage
This test was depending upon the storage announcement happening *after*
startup, but the upcoming synchronous-Tub-startup change will modify the
ordering. Fix it in both cases by disabling storage in the client being
tested.
2016-04-26 18:39:47 -07:00
Brian Warner
1f6c04518e Client: init_helper() must run after init_client()
This has worked so far because everything waited for the Tub to be
ready. We'll soon be making Tub setup synchronous, so we won't have to
wait anymore, so the order will matter.
2016-04-26 18:35:03 -07:00
Brian Warner
62d847663c Revert "test/common: add a slight stall in tearDown"
This reverts commit bb7184163e.

We changed test_runner.BinTahoe.run_bintahoe since this commit landed:
the new version can no longer cause the test to be skipped late (we've
gotten rid of the bin/tahoe script entirely, so it's no longer possible
for us to miss it). Hence I think we don't need this unsightly stall any
longer.
2016-04-26 14:18:40 -07:00
Brian Warner
17cd487dc8 bump Twisted dependency to 16.1.0
closes ticket:2781
2016-04-26 13:56:08 -07:00
Brian Warner
e9e12653f8 SystemTestMixin: don't auto-detect IP addresses
The tubs created for test_system should always use 127.0.0.1 .

refs ticket:2491
2016-04-26 13:55:59 -07:00
Brian Warner
6dfcd52b06 iputil.py: copy allocate_tcp_port() from foolscap
refs ticket:2491
2016-04-26 13:55:51 -07:00
meejah
b834b71dac Change API to a listener-style, with helper 2016-04-26 13:40:02 -06:00
meejah
55898941da Get rid of the 'connected_threshold' argument, too
- use 'when_connected_to', which takes a threshold
2016-04-26 12:26:40 -06:00
meejah
4c619ac98d fix StorageFarmBroker constructors after connected_d gone 2016-04-26 12:26:40 -06:00
meejah
b65a8fe142 Switch to when_connected_enough()
- instead of passing in a Deferred(), we use an observer
- fix up the tests
- TODO: fix magic-folder
2016-04-26 12:26:40 -06:00
meejah
be2576f15d test covering StorageBroker's connected_threshold code 2016-04-26 12:26:39 -06:00
Daira Hopwood
a56a3adaae Teach StorageFarmBroker to fire a deferred when a connection threshold is reached. refs #1449
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-04-26 12:26:39 -06:00
Brian Warner
d2ab4c593b initial tahoe.cfg: explain encoding params better
Meejah pointed out that new users might think the encoding parameters
are fixed, something you must pick correctly when you first set up the
node, and then are never allowed to change again, which is kind of
anxiety-inducing. This updates the comment to explain that the encoding
is stored in each filecap, and the tahoe.cfg values are only used for
newly-uploaded files.
2016-04-26 11:18:44 -07:00
Brian Warner
d05da27ae8 hush pyflakes 2016-04-26 10:43:26 -07:00
meejah
6910309e8f use Resource instead of Page for web-status 2016-04-26 10:33:59 -06:00
meejah
01b09f3bac Only accept 'token' in POST fields (stop using get_arg()) 2016-04-25 15:42:54 -07:00
Brian Warner
f665d0690e test_util: remove obsolete flushLoggedErrors check
We now depend on a much newer version of Twisted than the one that
lacked TestCase.flushLoggedErrors.
2016-04-22 18:48:58 -07:00
Brian Warner
cffa682ddc test_util: fix skip-on-32bit-platform behavior
I set up a raspberry pi buildslave (which, on the "raspbian jesse"
image, uses a 32-bit python, and perhaps a 32-bit kernel too). It fails
test_util.TimeFormat.test_format_time_y2038 with a ValueError inside the
call to time.gmtime(). The test was looking for the equality check to
fail instead. I think catching ValueError is the more-correct way to
detect a system with a 32-bit time type.
2016-04-22 18:45:29 -07:00
Daira Hopwood
5186e68f6b Add ignore_count to deferredutil 2016-04-19 15:16:13 -06:00
Daira Hopwood
1c9a3b4b01 Simplify run_bintahoe and make it work post-pippification.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-04-19 17:47:00 +01:00
Daira Hopwood
ee8bddbb1a Allow tahoe to be run using 'python -m allmydata.scripts.runner'.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-04-19 17:22:34 +01:00
meejah
6e17328eb5 teach abbreviate_time to understand timedelta
original review wanted to do this instead of depending on "humanize"
2016-04-12 18:42:53 -06:00
meejah
308bb8c41f match get_or_create_private_config API (closes ticket:2775) 2016-04-12 12:58:42 -06:00
meejah
4a25573e2d Add simple auth-token to get JSON data 2016-04-12 12:58:27 -06:00
Brian Warner
d385bb7a21 hush pyflakes 2016-04-12 00:39:03 -07:00
Brian Warner
04a9c51e3a download_to_data: fix comment 2016-04-12 00:38:08 -07:00
meejah
db517e8edd Progress API
- IProgress interface + PercentProgress implementation
 - progress= args to many upload/download APIs
 - ultimately for magic-folder
2016-04-12 00:30:50 -07:00
Brian Warner
bb7184163e test/common: add a slight stall in tearDown
With the new Foolscap-0.11.0 (which changed the way connections are
established), I'm seeing DirtyReactorErrors getting thrown by
allmydata.test.test_system.SystemTest.test_filesystem_with_cli_in_subprocess
, on a host that has three IP addresses (one is 127.0.0.1, two is wifi,
three is a VPN). The test itself is getting skipped because bin/tahoe
isn't in the expected place, but by that point, the nodes have already
been launched and have established connections over one of the three
hints (probably 127.0.0.1). The test terminates so quickly that the
connections to the other two addresses have not finished being
abandoned. The extra stall seems to give Foolscap enough time to reap
the cancelled connections and makes the DRT go away.

I think an offline test, or maybe one with a single external IP address,
wouldn't hit this case.

Arbitrary stalls are never very satisfactory, of course. Usually there
is some threshold delay value, below which it fails reliably, above
which it works on my own machine (for now). This one is weird: the
threshold seems to be below the resolution of the system clock. Stalling
for one nanosecond was enough to fix the problem, but using a simple
fireEventually() didn't work.
2016-04-07 20:59:42 -10:00
Brian Warner
8279d919f3 remove "manhole" (ssh-accessible REPL)
This little-used debugging feature allowed you to SSH or Telnet "into" a
Tahoe node, and get an interactive Read-Eval-Print-Loop (REPL) that
executed inside the context of the running process. The SSH
authentication code used a deprecated feature of Twisted, this code had
no unit-test coverage, and I haven't personally used it in at least 6
years (despite writing it in the first place). Time to go.

Also experiment with a Twisted-style "topfiles/" directory of NEWS
fragments. The idea is that we require all user-visible changes to
include a file or two (named as $TICKETNUM.$TYPE), and then run a script
to generate NEWS during the release process, instead of having a human
scan the commit logs and summarize the changes long after they landed.

Closes ticket:2367
2016-04-06 13:40:06 -10:00
Brian Warner
ce548687f8 iputil.py: avoid DirtyReactorError when running tests offline
The udpprot.transport.connect() fails if we don't have a network
connection, but the port is still listening, so trial gives us a
DirtyReactorError. The fix is a "finally:" which does
port.stopListening() even in this case.

Closes ticket:2769
2016-04-03 19:26:57 -10:00
Brian Warner
d57c8d5e39 bump Twisted dependency (>=15.1.0) to get the [tls] extra
We only really need "Twisted >= 13.0.0", but we must add "[tls]" because
otherwise pip won't install it when Foolscap asks for it later, and we
need ">= 15.1.0" because that's the first version that provided "[tls]".

Fixes ticket:2760.
2016-03-30 11:33:36 -07:00
Brian Warner
017fec16a4 test/check_memory: stop using .tac files 2016-03-25 16:26:29 -07:00
Brian Warner
77b3ab019d add __main__.py so "python -m allmydata" works
Thanks to dstufft for the suggestion. I know this can make it slightly
easier to run tahoe in some funny environments (where an appropriate
"python" is on your path but the generated "tahoe" executable is not).
2016-03-25 14:49:18 -07:00
Daira Hopwood
0598c830ed Rename distribution from allmydata-tahoe to tahoe-lafs. fixes ticket:2011
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-03-25 19:16:01 +00:00
Daira Hopwood
c3d54e0221 Back out the dependency on the conch extra for Twisted. refs ticket:2740
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-03-25 18:44:15 +00:00
Daira Hopwood
1db2419655 Update Twisted dependency to include tls and conch extras.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-03-25 18:33:04 +00:00
Brian Warner
b5aad1ba4c test_system: remove foolscap version check
Our install_requires= want foolscap>=0.10.1, and this check only fired
if we were given <0.6.4, so the check should be obsolete.

Also, the check was breaking my attempt to test Tahoe against a
development release of Foolscap, as the NormalizedVersion call threw an
IrrationalVersionError at my Versioneer-based "0.10.1+14.g37d8279"
version string.
2016-03-23 02:16:50 -07:00
Brian Warner
831b39d8fb remove src/buildtest/ and related build_helper/ test files
This was used to exercise our old virtualenv-like scheme. Now that we
use virtualenv, they're unnecessary. Plus, removing it lets us stop
polluting end-user installs with the extra package (that might
conceivably conflict with some other project that names itself
"buildtest").
2016-03-22 22:56:03 -07:00
Brian Warner
dd84abd9f2 setup.py: work with tox under py3
This allows a python3-based "tox" (as shipped with modern debian and
ubuntu systems) to run setup.py egg_info, update_version, and sdist
commands. It moves the main "tahoe requires py2" check out of setup.py
and into allmydata.scripts.runner.run, where it gets applied at runtime
rather than build time.

It also changes the execfile(_auto_deps.py) and Versioneer-like "ask git
what our version string should be" code to work under both py2 and py3.

fixes ticket:2747
2016-03-22 22:34:42 -07:00
Brian Warner
b8ad887823 Reduce setuptools dep to >=11.3
We don't necessarily need this ourselves (__init__.py's version-checking
code is the only thing in tahoe per se that uses setuptools, and our
setup.py's use of setuptools isn't something that install_requires= can
say anything about). But at least one old environment failed because a
sub-dependency needed a newer version than Tahoe asked for. I'm not sure
if this ought to be here, but it may help for a transitional period
until these ancient environments get updated.

closes ticket:2744
2016-03-18 11:28:58 -07:00
Brian Warner
141ff17b91 auto_deps: bump to setuptools>=20.3
20.3 is the current version as of today. I'm not really sure what
version we need, but this is better than the previous zetuptoolz "0.6c6"
requirement. Closes ticket:2744.
2016-03-17 22:12:04 -07:00
Brian Warner
36865a329c fix test_runner.BinTahoe.test_the_right_code
With our new tox/pip/virtualenv -based environment, we no longer need
the bin/tahoe script, so the tests that examine it needed to change.
In particular, we no longer need to be running tests from the root of a
source tree. Instead, what we care about is that the subprocess 'tahoe'
is importing code from the same place that the unit test .py files live.
2016-03-15 18:15:29 -07:00
Daira Hopwood
2e91068da1 Use version information from pkg_resources when we can't get it from import.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-03-15 17:31:32 +00:00
Daira Hopwood
8ddfc3def0 Tolerate IrrationalVersionError when parsing version numbers of dependencies,
without a warning. fixes ticket:2733

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-03-15 17:31:32 +00:00
Daira Hopwood
fe360ee47b Fix tests that were incorrectly skipping due to not being able to find the 'tahoe' script.
TODO: this may have broken testing "frozen" builds.
refs ticket:1582

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-03-15 17:31:32 +00:00
Daira Hopwood
aa8a5be037 On Windows we need pypiwin32. refs ticket:1582
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-03-15 17:31:13 +00:00
Daira Hopwood
f1890c09f2 Delete some crufty workarounds.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-03-15 17:30:35 +00:00
Daira Hopwood
d8549a2c7f setuptools delenda est. fixes ticket:1582 :-D
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-03-15 17:19:10 +00:00
Brian Warner
28f2a0f12d test_util: tolerate unordered repr of NumDict
NumDict does not make any claims about the order of its repr(), so the
test needs to be prepared for it to be stringified in any order. On unix
the old test happened to pass, but on certain windows boxes (maybe
certain versions of python?), it failed. Fixes ticket:2736.
2016-02-23 10:51:25 -08:00
Brian Warner
186f6d4a59 Merge pull request #236 from daira/2725.timezone-test.0
Fix tests on platforms without time.tzset (e.g. Windows)
2016-02-08 14:39:28 -08:00
Daira Hopwood
e4d536e609 Avoid spurious SUCCESS!?? for test_format_time_y2038.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-02-05 20:04:43 +00:00
Daira Hopwood
c6449b687a Fix tests on platforms without time.tzset (e.g. Windows). fixes ticket:2725
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-02-05 19:14:09 +00:00
Leif Ryge
56a9f5adaf remove introducer's set_encoding_parameters
I'm not sure why this ever existed, but it doesn't appear to be used.

(If an introducer called a client's set_encoding_parameters method it would
keep the provided parameters in an instance attribute but would not actually
use them.)
2016-02-05 11:44:12 +00:00
Brian Warner
46fd26e7d2 bump foolscap dependency to 0.10.1
The tahoe-deps repo was also updated, and the tahoe-deps tarball was
regenerated.

Closes ticket:2722
2016-02-02 22:19:57 -08:00
Daira Hopwood
e1285d27b9 Fix an error-reporting problem in test_welcome (this does not fix the underlying failure). refs ticket:2725
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-02-02 19:34:01 +00:00
Daira Hopwood
278ee0db76 Fix an error handling path that would never have been reached. fixes ticket:2543
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-02-02 18:55:34 +00:00
Daira Hopwood
0d6fcf445e Remove -u shortcut for 'tahoe ls --uri' which clashes with --node-url. fixes ticket:1949, ticket:2137
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-02-02 18:45:52 +00:00
Daira Hopwood
498563da69 Simplify an existing test by using TimezoneMixin.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-02-02 18:11:24 +00:00
Daira Hopwood
0abbf474b0 Don't call time.tzset() if the platform doesn't have it. fixes ticket:2723
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-02-02 18:10:33 +00:00
Brian Warner
67af736db1 web/status.py: minor renaming to hush pyflakes 2016-01-31 11:02:50 -08:00
Leif Ryge
55fdbaa3a2 Make tests work with both Nevow 0.11 and 0.12
closes #2663
2016-01-31 17:18:03 +00:00
Leif Ryge
5b33f1fdf3 wui: improved columns in welcome page server list
As discussed at https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1973 and in
previous pull request #129.

 - replace lengthy timestamps with human-readable deltas (eg 1h 2m 3s)
 - replace "announced" column with "Last RX" column
 - remove service column (it always said the same thing, "storage")
 - fix colspan on 'You are not presently connected' message

Previous versions, some with github comments: 3fe9053134 , 486dbfc7bd , and c89ea62580, 9fabb92486, bbd8b42a25

Unlike previous attempts, the tests on this one should pass in any timezone.
(But like current master, will fail with Nevow >=0.12...)

Thanks to an anonymous contributor who wrote some of the tests.
2016-01-23 14:28:09 +00:00
Leif Ryge
c86388b79c revert previous commit to fix attribution (vanity)
This reverts the previous commit (modulo the one line that daira added) so that
my contributions will be properly attributed by git blame etc.
2016-01-23 14:27:11 +00:00
Daira Hopwood
a2d724aab7 wui: improved columns in welcome page server list
As discussed at https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1973 and in
previous pull request #129.

 - replace lengthy timestamps with human-readable deltas (eg 1h 2m 3s)
 - replace "announced" column with "Last RX" column
 - remove service column (it always said the same thing, "storage")
 - fix colspan on 'You are not presently connected' message

Previous versions, some with github comments: 3fe9053134 , 486dbfc7bd , and c89ea62580, 9fabb92486, bbd8b42a25

Unlike previous attempts, the tests on this one should pass in any timezone.
(But like current master, will fail with Nevow >=0.12...)

Thanks to an anonymous contributor who wrote some of the tests.
2016-01-15 20:02:19 +00:00
Leif Ryge
6226f6b497 wui: use standard time format (#1077) 2016-01-15 19:46:39 +00:00
Daira Hopwood
f2824459eb Reject path arguments that start with '-' with a usage error.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-12-28 21:27:15 +00:00
Daira Hopwood
e88e07a278 Improved error handling and cosmetics for ctypes calls on Windows.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-12-28 21:17:32 +00:00
Daira Hopwood
56bf458355 Find the node-directory option correctly even if we are in a subcommand.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-12-28 20:52:51 +00:00
Daira Hopwood
1f7069e622 test_encodingutil: use self.patch rather than modifying encodingutil.io_encoding directly.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-12-28 20:52:51 +00:00
Daira Hopwood
394a4e25e6 Require arguments to do_cli to be strs.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-12-28 20:52:51 +00:00
Daira Hopwood
48917186f2 URIs are strs.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-12-28 20:12:29 +00:00
Daira Hopwood
46719a8bcf Aliases are Unicode.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-12-28 20:12:29 +00:00
Daira Hopwood
58841cab38 Refactor tahoe.cfg handling to configutil.
Author: David Stainton <david@leastauthority.com>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-12-28 19:36:19 +00:00
Daira Hopwood
b5222e3679 Merge pull request #204 from leif/preferred_peers-rebased3
new feature: preferred storage servers
2015-12-04 18:01:30 +00:00
Leif Ryge
96eaca6a6d new feature: preferred storage servers
this includes a squash merge of dca1de6856 which
was previously seen in pull request #128, as well as daira's suggested changes
from pull request #204.
2015-12-01 19:35:41 +00:00
Daira Hopwood
8ce7e2430c Add test for 'tahoe create-node/client/introducer' output. closes ticket:2556
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-12-01 17:58:16 +00:00
Daira Hopwood
02d96b970e Quote local paths correctly in the output of node creation commands. fixes ticket:2556
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-12-01 17:54:46 +00:00
Daira Hopwood
913082230c Disable bridging of foolscap logging to the Twisted log, and remove docs for it. fixes ticket:2567
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-11-03 17:35:21 +00:00
Brian Warner
67dcedd8df introweb: fix connection hints for server announcements
A long time ago, the introducer's status web page would show the
advertised IP addresses for all published services, by parsing their
FURL's connection hints. This hasn't worked since about 12-Aug-2014 when
foolscap-0.6.5 changed the internal format of these hints (the column
has been empty this whole time).

This removes the "Advertised IPs" column from the Service Announcements
table. Instead, the service's full connection hints (not just the IP
address) is displayed in a tooltip/popup on the "Announced" timestamp
column.

The code that pulls these connection hints is now tolerant of all three
foolscap styles:

* foolscap<=0.6.4 : tuples of ("ipv4",host,port)
* 0.6.5 .. 0.8.0  : tuples of ("tcp",host,port)
* foolscap>=0.9.0 : strings

fixes ticket:2510
2015-09-22 17:19:52 -07:00
Brian Warner
8f0c417910 remove "announcement_distinct_hosts" from introweb JSON
The machine-parseable JSON output for the introducer status web page
used to include a key named "announcement_distinct_hosts", which counted
the number of distinct IP addresses advertised by all connected storage
servers. This hasn't worked since Aug-2014 when foolscap-0.6.5 change
the internal hints format.

This removes that field.
2015-09-22 17:19:47 -07:00
Brian Warner
71323fbd8f introducer: stop tracking hints for subscribed clients
A long time ago, the introducer's status web page would show the
advertised IP addresses for all subscribers, by parsing their
RemoteReference's FURL's connection hints. This hasn't worked since
about 12-Aug-2014 when foolscap-0.6.5 changed the internal format of
these hints.

This removes the feature: we no longer attempt to show advertised IP
addresses of subscribed clients. It also removes the code that looked
inside foolscap internals for this information.
2015-09-22 17:19:43 -07:00
Daira Hopwood
a4dfc31a19 Avoid spurious errors when an imported version is consistent with pkg_resources
but not parseable; also improve related error reporting. fixes ticket:2499

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-09-12 00:59:51 +01:00
Brian Warner
e5979f970f test_cli_cp: minor cleanup 2015-07-28 17:39:26 -07:00
Brian Warner
98ab848cda cp: error on target-filename collisions, rather than overwrite
Closes ticket:2447
2015-07-28 17:39:26 -07:00
Zooko
f0fd34d16c unit test for my desired behavior 2015-07-28 17:39:26 -07:00
Daira Hopwood
023f9fa4d3 test_version.py: minor cleanup.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-29 00:20:33 +01:00
Daira Hopwood
2c99294a4f Don't show scary diagnostic warnings from --version[-and-path] (corrected). refs ticket:2436
The previous version would incorrectly add to the output of
get_package_versions_string each time it was called.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-29 00:20:33 +01:00
Daira Hopwood
3239527929 Revert "Don't show scary diagnostic warnings from --version[-and-path]"
This reverts commit 431728f8f8.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-29 00:20:33 +01:00
Brian Warner
29ab496bd7 mutable/retrieve.py: remove all bare assert()s
Replace them with _assert() or precondition(). Closes ticket:2462.
2015-07-28 13:32:46 -07:00
Brian Warner
6252a72965 IReadable.read(): document out-of-range errors
closes ticket#2461
2015-07-28 13:01:15 -07:00
Brian Warner
27ea6e1a3c test_mutable: more enhancements 2015-07-28 10:27:24 -07:00
Brian Warner
89e9076c41 mutable/retrieve.py: rewrite partial-read handling
This should tolerate offset/size combinations that read the last byte of
the file, something which was broken before. It quits early in the case
of zero-byte reads, to simplify the resulting "which segments do I need"
logic. Probably addresses ticket:2459.
2015-07-28 10:13:32 -07:00
Brian Warner
46d7085dfe enhance SDMF/MDMF tests: zero-length files, size=None 2015-07-28 10:13:32 -07:00
Daira Hopwood
a7e1dac27f Add tests for SDMF partial reads. refs #2459
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-28 10:13:32 -07:00
Daira Hopwood
9076db137a Remove some bare asserts in retrieve.py (there are still quite a few left). refs #2462
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-28 10:13:32 -07:00
Daira Hopwood
19df54927d Minor code cleanup in __init__.py.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-21 18:55:47 +01:00
Daira Hopwood
431728f8f8 Don't show scary diagnostic warnings from --version[-and-path]
if the only problem is that extra packages are found by pkg_resources.
fixes ticket:2436

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-21 18:51:29 +01:00
Daira Hopwood
c830419e04 Eliminate mock dependency.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-17 22:12:25 +01:00
Daira Hopwood
3ae6ceb6a8 Add Namespace utility class. (This is already used in the leasedb/cloud backend branch.)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-17 22:12:25 +01:00
Daira Hopwood
2d7c852ace Bump pyasn1 requirement to >= 0.1.8.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-16 15:38:06 +01:00
Daira Hopwood
baaf2a4a55 Blacklist mock > 1.0.1.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-16 15:24:45 +01:00
Brian Warner
28b74b0b74 test/check_load: hush (newer) pyflakes
pyflakes-0.9.2 gets confused about list comprehensions, so rename the
loop variable even though we'd deleted that name already.
2015-07-12 18:25:55 -07:00
Brian Warner
7aedd7c1b2 test_web: avoid IP autodetection, was causing dirty reactor 2015-07-12 18:20:43 -07:00
Daira Hopwood
f18da535c9 Remove packages from not_import_versionable that we now can always version.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-06-02 18:12:23 +01:00
Daira Hopwood
96024d7244 Add OpenSSL version check and tests. refs ticket:2215
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-06-02 18:07:20 +01:00
Brian Warner
45ebbbf44b wrap long lines, and tolerate various-width wrappings of the --help output
test_cli.Help was too sensitive to the way that the --help output was
wrapped, which caused failures on travis when COLUMNS= was set low and
the expected strings were split across separate lines.
2015-05-26 11:40:17 -07:00
Brian Warner
8f41713fe9 cli: improve formatting of all commands
Also:

* do some light refactoring of create-client/node
* make it clear that these commands' --basedir options do the same as
  the global --node-directory option
* use "global-options" instead of "global-opts"
2015-05-26 11:31:06 -07:00
Brian Warner
01619844de scripts: improve rendering of synopsis/usage
Subcommands "--help" is now rendered as:

```
 tahoe [global-options] COMMAND [options] ARGS
 (use 'tahoe --help' to view global options)
 USAGE (flags/options)
 DESCRIPTION
 DESCRIPTION_UNWRAPPED
```

The new .description and .description_unwrapped fields allow
commands (subclasses of twisted.python.usage.Usage) better control over
how their explanations are rendered: the old .longdesc field was wrapped
unpleasantly.
2015-05-26 11:29:49 -07:00
Brian Warner
5d5fa05a42 scripts/runner.py: put command group descriptions in parens 2015-05-26 11:27:57 -07:00
Brian Warner
1c34cbd627 refactor scripts/common.py: move _default_nodedir out to its own file 2015-05-26 11:27:57 -07:00
Zooko
a9b152780e remove dead code: NamedTemporaryDirectory
fixes #2433
2015-05-26 17:20:11 +00:00
Daira Hopwood
143af61518 fileutil.py: use ctypes.get_last_error() instead of GetLastError(). refs #1531
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-05-18 01:42:01 +01:00
Daira Hopwood
4794666df6 On Windows, the user's home directory may be either %USERPROFILE% or %HOMEDRIVE%%HOMEPATH% depending on the Windows version. fixes ticket:2417
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-05-13 14:42:31 +01:00
Daira Hopwood
f973657a6a interfaces.py: fix arguments to create_subdirectory.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-05-13 14:21:28 +01:00
Daira Hopwood
5d046c597e drop-upload.py: fix error messages.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-05-13 14:21:17 +01:00
Daira Hopwood
0c4acc763b Fix a pyflakes warning.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-05-13 14:21:17 +01:00
Daira Hopwood
07aa5e76b5 Retire the setup_requires hack in cases where it isn't needed (and can cause build problems). refs #2286
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-05-13 12:49:18 +01:00
Daira Hopwood
d106a77567 _auto_deps.py: update comments. refs #2416
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-05-13 12:44:21 +01:00
Daira Hopwood
c2874a7073 Allow working with Twisted >= 13 on Windows if pywin32 is manually installed. fixes #2416
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-05-13 12:44:21 +01:00