Skip to content

Commit

Permalink
add better test to be more sure that file descriptor limits were actu…
Browse files Browse the repository at this point in the history
…ally raised

License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
  • Loading branch information
whyrusleeping committed Sep 2, 2016
1 parent 3de3ab2 commit 934bcc8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@
"hash": "QmVvJ27GcLaLSXvcB4auk3Gn3xuWK5ti5ENkZ2pCoJEYW4",
"name": "autobatch",
"version": "0.2.0"
},
{
"author": "whyrusleeping",
"hash": "QmdCL8M8DXJdSRnwhpDhukX5r8ydjxnzPJpaKrFudDA8yn",
"name": "hang-fds",
"version": "0.0.0"
}
],
"gxVersion": "0.4.0",
Expand Down
8 changes: 8 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,18 @@ multihash_src:
$(eval MULTIHASH_HASH := $(shell cd .. && bin/gx deps find go-multihash))
$(eval MULTIHASH_SRC := gx/ipfs/$(MULTIHASH_HASH)/go-multihash)

hang-fds_src:
$(eval HANG_FDS_HASH := $(shell cd .. && bin/gx deps find hang-fds))
$(eval HANG_FDS_SRC := gx/ipfs/$(HANG_FDS_HASH)/hang-fds)

bin/multihash: multihash_src $(call find_go_files, $(MULTIHASH_SRC)) IPFS-BUILD-OPTIONS
@echo "*** installing $@ ***"
go build $(GOFLAGS) -o bin/multihash $(MULTIHASH_SRC)/multihash

bin/hang-fds: hang-fds_src $(call find_go_files, $(HANG_FDS_SRC)) IPFS-BUILD-OPTIONS
@echo "*** installing $@ ***"
go build $(GOFLAGS) -o bin/hang-fds $(HANG_FDS_SRC)

iptb_src:
$(eval IPTB_HASH := $(shell cd .. && bin/gx deps find iptb))
$(eval IPTB_SRC := gx/ipfs/$(IPTB_HASH)/iptb)
Expand Down
2 changes: 1 addition & 1 deletion test/sharness/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
BINS = bin/random bin/multihash bin/ipfs bin/pollEndpoint \
bin/iptb bin/go-sleep bin/random-files
bin/iptb bin/go-sleep bin/random-files bin/hang-fds
SHARNESS = lib/sharness/sharness.sh
IPFS_ROOT = ../..

Expand Down
22 changes: 7 additions & 15 deletions test/sharness/t0060-daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,13 @@ test_expect_success "daemon raised its fd limit" '
grep "raised file descriptor limit to 1024." actual_daemon > /dev/null
'

get_col_four() {
awk '{ print $4 }' $1
}

if [ `uname` == "Linux" ]; then
test_expect_success "get fd limit through /proc" '
cat /proc/$IPFS_PID/limits > limits &&
grep "Max open files" limits > fd_limits_line &&
limit=$(get_col_four fd_limits_line)
'

test_expect_success "limit from system looks good" '
test "$limit" -eq 1024
'
fi
test_expect_success "daemon actually can handle 1024 file descriptors" '
hang-fds -hold=2s 1000 '$API_MADDR'
'

test_expect_success "daemon didnt throw any errors" '
test_expect_code 1 grep "too many open files" daemon_err
'

test_kill_ipfs_daemon

Expand Down

0 comments on commit 934bcc8

Please sign in to comment.