Commit a2cc7dc1 authored by Brian Tiger Chow's avatar Brian Tiger Chow

test(withdocker)!

misc fixes

set all nodes to error

fix: check return value after cat

License: MIT
Signed-off-by: default avatarBrian Tiger Chow <brian@perfmode.com>
parent d894529c
......@@ -17,6 +17,11 @@ test: test_go test_sharness
test_expensive: test_go_expensive test_sharness_expensive
test_docker:
cd ./src/github.com/jbenet/go-ipfs
docker build -t zaqwsx_ipfs-test-img .
cd dockertest/ && make
test_go:
go test -test.short ./...
......
RANDOMSRC = Godeps/_workspace/src/github.com/jbenet/go-random/random
test: clean setup
fig build --no-cache
fig up
setup: docker_ipfs_image data/file
docker_ipfs_image:
docker images | grep zaqwsx_ipfs-test-img
data/file: bin/random
cp Makefile ./data/file
bin/random:
go build -o ./bin/random ../$(RANDOMSRC)
clean:
docker rm $(docker ps -q -a -f status=exited) || true
rm -f data/file
this is an ipfs integration test
**requirements**
* Docker
* fig
* Go
* ipfs image named "zaqwsx_ipfs-test-img"
```
make setup
fig build
fig up
```
FROM zaqwsx_ipfs-test-img
RUN ipfs init -b=1024
ADD . /tmp/id
RUN mv -f /tmp/id/config /root/.go-ipfs/config
RUN ipfs id
EXPOSE 4011 4012/udp
this is a bootstrap peer with an empty bootstrap list
it listens on 4011 and 4012
{
"Identity": {
"PeerID": "QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE",
"PrivKey": "CAAS4gQwggJeAgEAAoGBAL+E7A0fcQS9+CHO3YAHj+JzHnWyVA7qqtiAIYbTnp9UvHBb2VFj2Q8eeyKFZD5wHoq3AtOqmIb4TUOMEtWYqXnE8o0T9np8vyCRK5dPn5SVoUw9uax6o2X7OxO1HqTcXHNHGbracawJUdwsk4yuZUpzXLez03yocWwneR0JpVJPAgMBAAECgYAXsa4ygW1OFOKZ7CnjKQxYC738+a8EmWvBlTiQoaXCOI2HqRVdyGiWQkMhpjccsmpU5wdmgHiWWinU7YN3AYgV3cP3qAjyNLBFoxy2dKsS9AOWVwRuuRP12tD05kCCjG4rJAX0JEOClOOtzvQ7/bXarMc3/tMHW7TMLNV8MzcYwQJBAOP9aYSHp8VnsO5j32Ju5SjOQorSdcCweqeUxwlAnXz50KdbNSCMypP3TOt7VeiXTuSITtN44yh+eogF5c4ehycCQQDXDHVmPeBN7uqqqZxZwW5pdeJWvx+REiXXCLE6KEPWlcxbw1D9ublpCCFLYuM68rjq1sjsIVGtiV1tYoMdHJSZAkEA0ddMZ070fB0UHFaQJGktQoGVfXB4MQI94kBtcXanfX/xLBgmre7oBYh4o8TBLXMWigFri/iYG41N+iRzf2NZwQJBAIh8rMpufT2ZZLFaoxRIc4ZVvojmFufhR8j6CFnsElpQivq2tWHEDcx+z3rkUWopgXnzRmSwJQHqTDTPsH26lQkCQQCehmxqaQEwE/QKAI8L8YVolgY2cjUGi6qF/awnI584lDSCuJRU3R/c6nc9R8qljtlJYTtp9iUr8vuN+jt48j+6"
},
"Datastore": {
"Type": "leveldb",
"Path": "/root/.go-ipfs/datastore"
},
"Addresses": {
"Swarm": [
"/ip4/0.0.0.0/tcp/4011",
"/ip4/0.0.0.0/udp/4012/utp"
],
"API": "/ip4/127.0.0.1/tcp/5001"
},
"Mounts": {
"IPFS": "/ipfs",
"IPNS": "/ipns"
},
"Version": {
"Current": "0.1.7",
"Check": "error",
"CheckDate": "0001-01-01T00:00:00Z",
"CheckPeriod": "172800000000000",
"AutoUpdate": "minor"
},
"Bootstrap": [
],
"Tour": {
"Last": ""
},
"Logs": {
"Filename": "/root/.go-ipfs/logs/events.log",
"MaxSizeMB": 0,
"MaxBackups": 0,
"MaxAgeDays": 0
}
}
FROM zaqwsx_ipfs-test-img
RUN ipfs init -b=1024
ADD . /tmp/id
RUN mv -f /tmp/id/config /root/.go-ipfs/config
RUN ipfs id
EXPOSE 4031 4032/udp
ENTRYPOINT ["/bin/bash"]
CMD ["/tmp/id/run.sh"]
{
"Addresses": {
"API": "/ip4/127.0.0.1/tcp/5001",
"Swarm": [
"/ip4/0.0.0.0/tcp/4031",
"/ip4/0.0.0.0/udp/4032/utp"
]
},
"Bootstrap": [
],
"Datastore": {
"Path": "/root/.go-ipfs/datastore",
"Type": "leveldb"
},
"Identity": {
"PeerID": "Qmbtc35vdjVh5o9w2AaT2SgcWwigsaoZUpRfq2FSrFD6mb",
"PrivKey": "CAAS4AQwggJcAgEAAoGBANlJUjOCbPXgYUfo1Pr6nlIjJDPNwN81ACamhaoEZ9VRHXI3fPe7RVAaaXrWLHb892mRqFi1ScE2lcMTLc7WGfyc7dwPqBOZqkVvT0KpCx3Mg246+WvnG8I3HCbWyjSP9tJflOBQxVq6qT2yZSXjNTtDdO4skd4PsPqBco53guYTAgMBAAECgYEAtIcYhrdMNBSSfp5RpZxnwbJ0t52xK0HruDEOSK2UX0Ufg+/aIjEza1QmYupi0xFltg5QojMs7hyd3Q+oNXro5tKsYVeiqrLsUh9jMjaQofzSlV9Oc+bhkkl48YWvF6Y8qx88UYAX+oJqB627H4S1gxLdNEJhPjEAD6n/jql3zUECQQDmHP75wJ7nC4TlxT1SHim5syMAqWNs/SOHnvX8yLrFV9FrMRzsD5qMlIEGBrAjaESzEck6XpbqkyxB8KKGo7OjAkEA8brtEh/AMoQ/yoSWdYT2MRbJxCAn+KG2c6Hi9AMMmJ+K779HxywpUIDYIa22hzLKYumYIuRa1X++1glOAFGq0QJAPQgXwFoMSy9M8jwcBXmmi3AtqnFCw5doIwJQL9l1X/3ot0txZlLFJOAGUHjZoqp2/h+LhYWs9U5PgLW4BYnJjQJAPydY/J0y93+5ss1FCdr8/wI3IHhOORT2t+sZgiqxxcYY5F4TAKQ2/wNKdDIQN+47FfB1gNgsKw8+6mhv6oFroQJACBF2yssNVXiXa2Na/a9tKYutGvxbm3lXzOvmpkW3FukbsObKYS344J1vdg0nzM6EWQCaiBweSA5TQ27iNW6BzQ=="
},
"Logs": {
"Filename": "/root/.go-ipfs/logs/events.log",
"MaxAgeDays": 0,
"MaxBackups": 0,
"MaxSizeMB": 0
},
"Mounts": {
"IPFS": "/ipfs",
"IPNS": "/ipns"
},
"Tour": {
"Last": ""
},
"Version": {
"AutoUpdate": "minor",
"Check": "error",
"CheckDate": "0001-01-01T00:00:00Z",
"CheckPeriod": "172800000000000",
"Current": "0.1.7"
}
}
ipfs bootstrap add /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
ipfs daemon &
sleep 3
while [ ! -f /data/id ]
do
echo waiting for server to add the file...
sleep 1
done
echo client found file with hash: $(cat /data/id)
ipfs cat $(cat /data/id) > file
cat file
if (($? > 0)); then
printf '%s\n' 'ipfs cat failed.' >&2
exit 1
fi
diff -u file /data/file
if (($? > 0)); then
printf '%s\n' 'files did not match' >&2
exit 1
fi
echo "success"
FROM ubuntu
ADD file /data/file
VOLUME ["/data"]
data:
build: ./data
volumes:
- /data
bootstrap:
build: ./bootstrap
expose:
- "4011"
- "4012/udp"
environment:
IPFS_LOGGING: error
server:
build: ./server
links:
- bootstrap
volumes_from:
- data
expose:
- "4021"
- "4022/udp"
environment:
IPFS_LOGGING: error
client:
build: ./client
links:
- bootstrap
volumes_from:
- data
expose:
- "4031"
- "4032/udp"
environment:
IPFS_LOGGING: error
FROM zaqwsx_ipfs-test-img
RUN ipfs init -b=1024
ADD . /tmp/test
RUN mv -f /tmp/test/config /root/.go-ipfs/config
RUN ipfs id
RUN chmod +x /tmp/test/run.sh
EXPOSE 4021 4022/udp
ENTRYPOINT ["/bin/bash"]
CMD ["/tmp/test/run.sh"]
**requirements**
* docker container with bootstrap node linked as "bootstrap" with ID QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
* file in data volume, internally mapped to /data/file
{
"Addresses": {
"API": "/ip4/127.0.0.1/tcp/5001",
"Swarm": [
"/ip4/0.0.0.0/tcp/4021",
"/ip4/0.0.0.0/udp/4022/utp"
]
},
"Bootstrap": [
],
"Datastore": {
"Path": "/root/.go-ipfs/datastore",
"Type": "leveldb"
},
"Identity": {
"PeerID": "Qmbtc2C7rqmAfdeMTM7FX4YF8CeBumMCfk5Z1GBCMbMTfY",
"PrivKey": "CAAS4AQwggJcAgEAAoGBANW3mJMmDSJbdRyykO0Ze5t6WL6jeTtpOhklxePBIkJL/Uil78Va/tODx6Mvv3GMCkbGvzWslTZXpaHa9vBmjE3MVZSmd5fLRybKT0zZ3juABKcx+WIVNw8JlkpEORihJdwb+5tRUC5pUcMzxqHSmGX+d6e9KZqLnv7piNKg2+r7AgMBAAECgYAqc6+w+wv82SHoM2gqULeG6MScCajZLkvGFwS5+vEtLh7/wUZhc3PO3AxZ0/A5Q9H+wRfWN5PkGYDjJ7WJhzUzGfTbrQ821JV6B3IUR4UHo2IgJkZO4EUB5L9KBUqvYxDJigtGBopgQh0EeDSS+9X8vaGmit5l4zcAfi+UGYPgMQJBAOCJQU8N2HW5SawBo2QX0bnCAAnu5Ilk2QaqwDZbDQaM5JWFcpRpGnjBhsZihHwVWvKCbnq83JhAGRQvKAEepMUCQQDzqjvIyM+Au42nP7SFDHoMjEnHW8Nimvz8zPbyrSUEHe4l9/yS4+BeRPxpwI5xgzp8g1wEYfNeXt08buYwCsy/AkBXWg5mSuSjJ+pZWGnQTtPwiGCrfJy8NteXmGYev11Z5wYmhTwGML1zrRZZp4oTG9u97LA+X6sSMB2RlKbjiKBhAkEAgl/hoSshK+YugwCpHE9ytmgRyeOlhYscNj+NGofeOHezRwmLUSUwlgAfdo4bKU1n69t1TrsCNspXYdCMxcPhjQJAMNxkJ8t2tFMpucCQfWJ09wvFKZSHX1/iD9GKWL0Qk2FcMCg3NXiqei5NL3NYqCWpdC/IfjsAEGCJrTFwp/OoUw=="
},
"Logs": {
"Filename": "/root/.go-ipfs/logs/events.log",
"MaxAgeDays": 0,
"MaxBackups": 0,
"MaxSizeMB": 0
},
"Mounts": {
"IPFS": "/ipfs",
"IPNS": "/ipns"
},
"Tour": {
"Last": ""
},
"Version": {
"AutoUpdate": "minor",
"Check": "error",
"CheckDate": "0001-01-01T00:00:00Z",
"CheckPeriod": "172800000000000",
"Current": "0.1.7"
}
}
# must be connected to bootstrap node
ipfs bootstrap add /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
# wait for daemon to start/bootstrap
# alternatively use ipfs swarm connect
ipfs daemon &
sleep 3
echo $(ipfs id)
# TODO instead of bootrapping: ipfs swarm connect /ip4/$BOOTSTRAP_PORT_4011_TCP_ADDR/tcp/$BOOTSTRAP_PORT_4011_TCP_PORT/QmNXuBh8HFsWq68Fid8dMbGNQTh7eG6hV9rr1fQyfmfomE
# must mount this volume from data container
ipfs add -q /data/file > /data/id
echo added file. hash is $(cat /data/id)
# allow ample time for the client to pull the data
sleep 10000000
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment