Skip to content

Commit f511bb2

Browse files
committed
bug: use URI.open instead of Kernel#open (Kernel#open fails in ruby 3.0)
Fixes #20
1 parent e110597 commit f511bb2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Diff for: check_haproxy.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def haproxy_response(options)
130130
end
131131

132132
begin
133-
return open(options.url, open_options(options))
133+
return URI.open(options.url, **open_options(options))
134134
rescue OpenURI::HTTPError => e
135135
puts "ERROR: #{e.message}"
136136
options.http_error_critical ? exit(CRITICAL) : exit(UNKNOWN)

Diff for: test/test_check_haproxy.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
NUM_TESTS=$(find test/haproxy/ -type f -name '*.csv' |wc -l|awk '{print $1}')
4-
echo "1..$(($NUM_TESTS + 2))" # this sucks, you have to add test count manually
4+
echo "1..$(($NUM_TESTS + 3))" # this sucks, you have to add test count manually
55
I=1
66
for f in test/haproxy/*.csv; do
77
OUTPUT_FILE=$(mktemp)
@@ -36,3 +36,6 @@ do_test 'warn limit' \
3636

3737
do_test 'crit limit' \
3838
"./check_haproxy.rb -u test/haproxy/fedoraproject_org.csv -w 1 -c2 -p fedmsg-raw-zmq-outbound-backend |grep 'CRIT.*too many sessions' > /dev/null"
39+
40+
do_test 'live url' \
41+
"./check_haproxy.rb -u 'http://demo.1wt.eu/' >/dev/null"

0 commit comments

Comments
 (0)