Permalink
Browse files

trying to get tests to pass lcoally for pushing

  • Loading branch information...
1 parent d196876 commit 3fd1f6e8d8e216c27f329ab7b674c0989bea3aa5 BuzzTroll committed Sep 4, 2010
View
@@ -5,6 +5,11 @@ export PATH=/usr/sbin/:$PATH
dir=`dirname $0`
cd $dir/..
pypath=`pwd`
+
+cd ../
+export NIMBUS_HOME=`pwd`
+source $NIMBUS_HOME/ve/bin/activate
+
if [ "X${PYTHONPATH}" == "X" ]; then
export PYTHONPATH=$pypath
else
@@ -18,6 +23,7 @@ $LANTORRENT_HOME/bin/make_lt_server.sh 4 $pidfile
xinet_pid=`cat $pidfile`
echo "xinet on $xinet_pid"
+cd $LANTORRENT_HOME
$dir/lt-daemon &
ltd_pid=$!
@@ -32,6 +32,7 @@ def getrows(con):
def do_it_live(con, rows):
+ pylantorrent.log(logging.INFO, "lan torrent daemon setting up to send")
degree = 1
maxd = 3
@@ -119,6 +119,8 @@ def main(argv=sys.argv[1:]):
if not o.nonblock:
(rc, message) = wait_until_sent(con, rid)
+ else:
+ print "request id: %s" % (rid)
if rc == 0:
print "Success"
@@ -58,6 +58,42 @@ def test_request_many_block(self):
self.assertEqual(rc, 0, "rc should be 0 but is %d" % (rc))
self._t_file_compare(fname)
+ def get_rid(self, out_file):
+ f = open(out_file, "r")
+ lines = f.readlines()
+ l = len(lines)
+ rid_line = lines[l-2]
+ ra = rid_line.split(":", 1)
+ rid = ra[1].strip()
+ f.close()
+ return rid
+
+
+ def test_request_many_nonblock(self):
+ port = int(self.ports_a[0])
+ host = "localhost:%d" % (port)
+
+ print "requesting all the files"
+ rids = []
+ for i in range(0, 10):
+ (osf, out_file) = tempfile.mkstemp()
+ os.close(osf)
+ fname = self._get_temp_file()
+ rc = pylantorrent.request.main(["-O", out_file, "-n", self.src_file, fname, str(uuid.uuid1()), host])
+ self.assertEqual(rc, 0, "rc should be 0 but is %d" % (rc))
+ rid = self.get_rid(out_file)
+ rids.append(rid)
+
+ print "waiting on all the files"
+ for rid in rids:
+ rc = pylantorrent.request.main(["-a", rid])
+ self.assertEqual(rc, 0, "rc should be 0 but is %d" % (rc))
+
+ print "checking all the files"
+ for f in self.files:
+ self._t_file_compare(f)
+
+

0 comments on commit 3fd1f6e

Please sign in to comment.