add better test to be more sure that file descriptor limits were actually raised
License: MIT Signed-off-by: Jeromy <why@ipfs.io>
Jeromy committed
Sep 1, 2016 at 18:55 UTC
af914c5193a63a2fc5af1f6235bdb2c29e3b1658
4 files changed
+22
-16
package.json
+6
@@ -189,6 +189,12 @@
189
"hash": "QmVvJ27GcLaLSXvcB4auk3Gn3xuWK5ti5ENkZ2pCoJEYW4",
190
"name": "autobatch",
191
"version": "0.2.0"
192
+ },
193
+ {
194
+ "author": "whyrusleeping",
195
+ "hash": "QmdCL8M8DXJdSRnwhpDhukX5r8ydjxnzPJpaKrFudDA8yn",
196
+ "name": "hang-fds",
197
+ "version": "0.0.0"
198
}
199
],
200
"gxVersion": "0.4.0",
test/Makefile
+8
@@ -60,10 +60,18 @@ multihash_src:
60
$(eval MULTIHASH_HASH := $(shell cd .. && bin/gx deps find go-multihash))
61
$(eval MULTIHASH_SRC := gx/ipfs/$(MULTIHASH_HASH)/go-multihash)
62
63
+hang-fds_src:
64
+ $(eval HANG_FDS_HASH := $(shell cd .. && bin/gx deps find hang-fds))
65
+ $(eval HANG_FDS_SRC := gx/ipfs/$(HANG_FDS_HASH)/hang-fds)
66
+
67
bin/multihash: multihash_src $(call find_go_files, $(MULTIHASH_SRC)) IPFS-BUILD-OPTIONS
68
@echo "*** installing $@ ***"
69
go build $(GOFLAGS) -o bin/multihash $(MULTIHASH_SRC)/multihash
70
71
+bin/hang-fds: hang-fds_src $(call find_go_files, $(HANG_FDS_SRC)) IPFS-BUILD-OPTIONS
72
+ @echo "*** installing $@ ***"
73
+ go build $(GOFLAGS) -o bin/hang-fds $(HANG_FDS_SRC)
74
+
75
iptb_src:
76
$(eval IPTB_HASH := $(shell cd .. && bin/gx deps find iptb))
77
$(eval IPTB_SRC := gx/ipfs/$(IPTB_HASH)/iptb)
test/sharness/Makefile
+1
-1
@@ -8,7 +8,7 @@
8
9
T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh))
10
BINS = bin/random bin/multihash bin/ipfs bin/pollEndpoint \
11
- bin/iptb bin/go-sleep bin/random-files bin/go-timeout
11
+ bin/iptb bin/go-sleep bin/random-files bin/go-timeout bin/hang-fds
12
SHARNESS = lib/sharness/sharness.sh
13
IPFS_ROOT = ../..
14
test/sharness/t0060-daemon.sh
+7
-15
@@ -129,21 +129,13 @@ test_expect_success "daemon raised its fd limit" '
129
grep "raised file descriptor limit to 1024." actual_daemon > /dev/null
130
'
131
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
+'
139
140
test_kill_ipfs_daemon
141