Skip to content

Commit 934bcc8

Browse files
committed
add better test to be more sure that file descriptor limits were actually raised
License: MIT Signed-off-by: Jeromy <[email protected]>
1 parent 3de3ab2 commit 934bcc8

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

package.json

+6
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@
189189
"hash": "QmVvJ27GcLaLSXvcB4auk3Gn3xuWK5ti5ENkZ2pCoJEYW4",
190190
"name": "autobatch",
191191
"version": "0.2.0"
192+
},
193+
{
194+
"author": "whyrusleeping",
195+
"hash": "QmdCL8M8DXJdSRnwhpDhukX5r8ydjxnzPJpaKrFudDA8yn",
196+
"name": "hang-fds",
197+
"version": "0.0.0"
192198
}
193199
],
194200
"gxVersion": "0.4.0",

test/Makefile

+8
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,18 @@ multihash_src:
5454
$(eval MULTIHASH_HASH := $(shell cd .. && bin/gx deps find go-multihash))
5555
$(eval MULTIHASH_SRC := gx/ipfs/$(MULTIHASH_HASH)/go-multihash)
5656

57+
hang-fds_src:
58+
$(eval HANG_FDS_HASH := $(shell cd .. && bin/gx deps find hang-fds))
59+
$(eval HANG_FDS_SRC := gx/ipfs/$(HANG_FDS_HASH)/hang-fds)
60+
5761
bin/multihash: multihash_src $(call find_go_files, $(MULTIHASH_SRC)) IPFS-BUILD-OPTIONS
5862
@echo "*** installing $@ ***"
5963
go build $(GOFLAGS) -o bin/multihash $(MULTIHASH_SRC)/multihash
6064

65+
bin/hang-fds: hang-fds_src $(call find_go_files, $(HANG_FDS_SRC)) IPFS-BUILD-OPTIONS
66+
@echo "*** installing $@ ***"
67+
go build $(GOFLAGS) -o bin/hang-fds $(HANG_FDS_SRC)
68+
6169
iptb_src:
6270
$(eval IPTB_HASH := $(shell cd .. && bin/gx deps find iptb))
6371
$(eval IPTB_SRC := gx/ipfs/$(IPTB_HASH)/iptb)

test/sharness/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

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

test/sharness/t0060-daemon.sh

+7-15
Original file line numberDiff line numberDiff line change
@@ -129,21 +129,13 @@ test_expect_success "daemon raised its fd limit" '
129129
grep "raised file descriptor limit to 1024." actual_daemon > /dev/null
130130
'
131131

132-
get_col_four() {
133-
awk '{ print $4 }' $1
134-
}
135-
136-
if [ `uname` == "Linux" ]; then
137-
test_expect_success "get fd limit through /proc" '
138-
cat /proc/$IPFS_PID/limits > limits &&
139-
grep "Max open files" limits > fd_limits_line &&
140-
limit=$(get_col_four fd_limits_line)
141-
'
142-
143-
test_expect_success "limit from system looks good" '
144-
test "$limit" -eq 1024
145-
'
146-
fi
132+
test_expect_success "daemon actually can handle 1024 file descriptors" '
133+
hang-fds -hold=2s 1000 '$API_MADDR'
134+
'
135+
136+
test_expect_success "daemon didnt throw any errors" '
137+
test_expect_code 1 grep "too many open files" daemon_err
138+
'
147139

148140
test_kill_ipfs_daemon
149141

0 commit comments

Comments
 (0)