start work on 'check-grid' target, for use in an automated prodnet tester. Just a docstring so far.

This commit is contained in:
Brian Warner 2008-06-18 12:57:47 -07:00
parent 28f4652b96
commit 50d945ea8f
2 changed files with 64 additions and 0 deletions

View File

@ -253,6 +253,18 @@ check-speed: .built
$(PYTHON) src/allmydata/test/check_speed.py $(TESTCLIENTDIR) $(PYTHON) src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
$(PYTHON) bin/tahoe stop $(TESTCLIENTDIR) $(PYTHON) bin/tahoe stop $(TESTCLIENTDIR)
# This target also uses a pre-established client node, along with a long-term
# directory that contains some well-known files. See the docstring in
# src/allmydata/test/check_grid.py to see how to set this up.
check-grid: .built
if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
@echo "stopping any leftover client code"
-$(PYTHON) bin/tahoe stop $(TESTCLIENTDIR)
$(PYTHON) bin/tahoe start $(TESTCLIENTDIR)
sleep 5
$(PYTHON) src/allmydata/test/check_grid.py $(TESTCLIENTDIR)
$(PYTHON) bin/tahoe stop $(TESTCLIENTDIR)
# 'make repl' is a simple-to-type command to get a Python interpreter loop # 'make repl' is a simple-to-type command to get a Python interpreter loop
# from which you can type 'import allmydata' # from which you can type 'import allmydata'
repl: repl:

View File

@ -0,0 +1,52 @@
#! /usr/bin/python
"""
Test an existing Tahoe grid, both to see if the grid is still running and to
see if the client is still compatible with it. This script is suitable for
running from a periodic monitoring script, perhaps by an hourly cronjob.
This script uses a pre-established client node (configured to connect to the
grid being tested) and a pre-established directory (stored as the 'testgrid:'
alias in that client node's aliases file). It then performs a number of
uploads and downloads to exercise compatibility in various directions (new
client vs old data).
This script expects that the client node will be running before the script
starts.
To set up the client node, do the following:
tahoe create-client DIR
touch DIR/no_storage
populate DIR/introducer.furl
tahoe start DIR
tahoe -d DIR add-alias testgrid `tahoe -d DIR mkdir`
pick a 10kB-ish test file, compute its md5sum
tahoe -d DIR put FILE testgrid:old.MD5SUM
tahoe -d DIR put FILE testgrid:recent.MD5SUM
tahoe -d DIR put FILE testgrid:recentdir/recent.MD5SUM
echo "" | tahoe -d DIR put --mutable testgrid:log
echo "" | tahoe -d DIR put --mutable testgrid:recentlog
This script will perform the following steps (the kind of compatibility that
is being tested is in [brackets]):
read old.* and check the md5sums [confirm that new code can read old files]
read all recent.* files and check md5sums [read recent files]
delete all recent.* files and verify they're gone [modify an old directory]
read recentdir/recent.* files and check [read recent directory]
delete recentdir/recent.* and verify [modify recent directory]
delete recentdir and verify (keep the directory from growing unboundedly)
mkdir recentdir
upload random 10kB file to recentdir/recent.MD5SUM (prepare for next time)
upload random 10kB file to recent.MD5SUM [new code can upload to old servers]
append one-line timestamp to log [read/write old mutable files]
append one-line timestamp to recentlog [read/write recent mutable files]
delete recentlog
upload small header to new mutable recentlog [create mutable files]
This script will also keep track of speeds and latencies and will write them
in a machine-readable logfile.
"""