Commit 1f387af2 authored by Jeromy Johnson's avatar Jeromy Johnson Committed by GitHub

Merge pull request #3149 from ipfs/test/fdlimit-raising

fdlimit: improve fdlimit autoraising tests
parents 309535c0 af914c51
......@@ -30,12 +30,15 @@ func checkAndSetUlimit() error {
return fmt.Errorf("error getting rlimit: %s", err)
}
var setting bool
if rLimit.Cur < ipfsFileDescNum {
if rLimit.Max < ipfsFileDescNum {
log.Error("adjusting max")
rLimit.Max = ipfsFileDescNum
}
fmt.Printf("Adjusting current ulimit to %d.\n", ipfsFileDescNum)
fmt.Printf("Adjusting current ulimit to %d...\n", ipfsFileDescNum)
rLimit.Cur = ipfsFileDescNum
setting = true
}
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
......@@ -43,5 +46,9 @@ func checkAndSetUlimit() error {
return fmt.Errorf("error setting ulimit: %s", err)
}
if setting {
fmt.Printf("Successfully raised file descriptor limit to %d.\n", ipfsFileDescNum)
}
return nil
}
......@@ -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",
......
......@@ -60,10 +60,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)
......
......@@ -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/go-timeout
bin/iptb bin/go-sleep bin/random-files bin/go-timeout bin/hang-fds
SHARNESS = lib/sharness/sharness.sh
IPFS_ROOT = ../..
......
......@@ -121,12 +121,20 @@ test_expect_success "daemon with pipe eventually becomes live" '
test_fsh cat stdin_daemon_out || test_fsh cat stdin_daemon_err || test_fsh cat stdin_poll_apiout || test_fsh cat stdin_poll_apierr
'
ulimit -n 512
ulimit -S -n 512
TEST_ULIMIT_PRESET=1
test_launch_ipfs_daemon
test_expect_success "daemon raised its fd limit" '
grep "ulimit" actual_daemon > /dev/null
grep "raised file descriptor limit to 1024." actual_daemon > /dev/null
'
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
......
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