1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-27 16:07:42 +08:00

dockertest -> test/3nodetest

This commit is contained in:
Juan Batiz-Benet
2015-01-07 07:27:44 -08:00
parent b479602b61
commit 28cf220de1
23 changed files with 35 additions and 21 deletions

View File

@ -1,8 +0,0 @@
# STRIP strips color from terminal output
STRIP="perl -pe 's/\e\[?.*?[\@-~]//g'"
# TODO use a for loop like a grownup
docker logs dockertest_bootstrap_1 2>&1 | eval $STRIP > ./build/bootstrap.log
docker logs dockertest_client_1 2>&1 | eval $STRIP > ./build/client.log
docker logs dockertest_data_1 2>&1 | eval $STRIP > ./build/data.log
docker logs dockertest_server_1 2>&1 | eval $STRIP > ./build/server.log

View File

@ -1,5 +1,6 @@
RANDOMSRC = Godeps/_workspace/src/github.com/jbenet/go-random/random
RANDOMSRC = ../../Godeps/_workspace/src/github.com/jbenet/go-random
IMAGE_NAME = ipfs-test-latest
IPFS_ROOT = ../..
test: clean setup
./run-test-on-img.sh $(IMAGE_NAME)
@ -15,13 +16,13 @@ data/filetiny: Makefile
data/filerand: bin/random
./bin/random 50000000 > ./data/filerand
bin/random:
go build -o ./bin/random ../$(RANDOMSRC)
bin/random: $(RANDOMSRC)/**/*.go
go build -o ./bin/random $(RANDOMSRC)/random
# just build it every time... this part isn't
# even the lengthy part, and it decreases pain.
docker_ipfs_image:
cd .. && docker build -t $(IMAGE_NAME) .
cd $(IPFS_ROOT) && docker build -t $(IMAGE_NAME) .
docker images | grep $(IMAGE_NAME)
clean:

View File

@ -0,0 +1,8 @@
# STRIP strips color from terminal output
STRIP="perl -pe 's/\e\[?.*?[\@-~]//g'"
# TODO use a for loop like a grownup
docker logs 3nodetest_bootstrap_1 2>&1 | eval $STRIP > ./build/bootstrap.log
docker logs 3nodetest_client_1 2>&1 | eval $STRIP > ./build/client.log
docker logs 3nodetest_data_1 2>&1 | eval $STRIP > ./build/data.log
docker logs 3nodetest_server_1 2>&1 | eval $STRIP > ./build/server.log

View File

@ -1,16 +1,16 @@
ipfs bootstrap add /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
echo "dockertest> starting client daemon"
echo "3nodetest> starting client daemon"
ipfs daemon &
sleep 3
while [ ! -f /data/idtiny ]
do
echo "dockertest> waiting for server to add the file..."
echo "3nodetest> waiting for server to add the file..."
sleep 1
done
echo "dockertest> client found file with hash:" $(cat /data/idtiny)
echo "3nodetest> client found file with hash:" $(cat /data/idtiny)
ipfs cat $(cat /data/idtiny) > filetiny
@ -25,10 +25,10 @@ fi
while [ ! -f /data/idrand ]
do
echo "dockertest> waiting for server to add the file..."
echo "3nodetest> waiting for server to add the file..."
sleep 1
done
echo "dockertest> client found file with hash:" $(cat /data/idrand)
echo "3nodetest> client found file with hash:" $(cat /data/idrand)
cat /data/idrand
@ -46,4 +46,4 @@ if (($? > 0)); then
exit 1
fi
echo "dockertest> success"
echo "3nodetest> success"

View File

@ -3,7 +3,7 @@ ipfs bootstrap add /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_T
# wait for daemon to start/bootstrap
# alternatively use ipfs swarm connect
echo "dockertest> starting server daemon"
echo "3nodetest> starting server daemon"
ipfs daemon &
sleep 3
# TODO instead of bootrapping: ipfs swarm connect /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
@ -11,11 +11,11 @@ sleep 3
# must mount this volume from data container
ipfs add -q /data/filetiny > tmptiny
mv tmptiny /data/idtiny
echo "dockertest> added tiny file. hash is" $(cat /data/idtiny)
echo "3nodetest> added tiny file. hash is" $(cat /data/idtiny)
ipfs add -q /data/filerand > tmprand
mv tmprand /data/idrand
echo "dockertest> added rand file. hash is" $(cat /data/idrand)
echo "3nodetest> added rand file. hash is" $(cat /data/idrand)
# allow ample time for the client to pull the data
sleep 10000000

13
test/jenkins/network-test.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
export GOPATH=$WORKSPACE
PWD=`pwd`
cd ../3nodetest
make clean
make test
make save_logs
docker cp 3nodetest_server_1:/root/.go-ipfs/logs/events.log $(PWD)/build/server-events.log
docker cp 3nodetest_bootstrap_1:/root/.go-ipfs/logs/events.log $(PWD)/build/bootstrap-events.log
docker cp 3nodetest_client_1:/root/.go-ipfs/logs/events.log $(PWD)/build/client-events.log