aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2015-11-04 00:57:02 +0900
committerKazuki Yamaguchi <k@rhe.jp>2015-11-04 00:57:02 +0900
commitb33d179b001119155d4dc0bd8dc43a18a29cfaa9 (patch)
tree580869fe3642ce637717386ef324680f0e8669ac /test
parentdc870b7b2e8da6f96c3e5141d0341d5a29ca38f4 (diff)
downloadplum-b33d179b001119155d4dc0bd8dc43a18a29cfaa9.tar.gz
connection: fix stream id managing
Diffstat (limited to 'test')
-rw-r--r--test/plum/client/test_connection.rb5
-rw-r--r--test/plum/server/test_https_connection.rb4
-rw-r--r--test/utils/server.rb8
3 files changed, 10 insertions, 7 deletions
diff --git a/test/plum/client/test_connection.rb b/test/plum/client/test_connection.rb
index 204eb3a..2903cfa 100644
--- a/test/plum/client/test_connection.rb
+++ b/test/plum/client/test_connection.rb
@@ -4,9 +4,8 @@ using Plum::BinaryString
class ClientConnectionTest < Minitest::Test
def test_open_stream
con = open_client_connection
- stream = con.open_stream(weight: 256)
- assert(stream.id % 2 == 1)
- assert_equal(256, stream.weight)
+ stream = con.open_stream
+ assert(stream.id % 2 == 1, "Stream ID is not odd")
assert_equal(:idle, stream.state)
end
end
diff --git a/test/plum/server/test_https_connection.rb b/test/plum/server/test_https_connection.rb
index b93d1b1..d227f73 100644
--- a/test/plum/server/test_https_connection.rb
+++ b/test/plum/server/test_https_connection.rb
@@ -59,6 +59,8 @@ class HTTPSConnectionNegotiationTest < Minitest::Test
}
rescue Timeout::Error
flunk "server timeout"
+ rescue => e
+ flunk e
ensure
tcp_server.close
end
@@ -75,6 +77,8 @@ class HTTPSConnectionNegotiationTest < Minitest::Test
ssl.write Connection::CLIENT_CONNECTION_PREFACE
ssl.write Frame.settings.assemble
sleep
+ rescue => e
+ flunk e
ensure
sock.close
end
diff --git a/test/utils/server.rb b/test/utils/server.rb
index 82eb00f..be2aba6 100644
--- a/test/utils/server.rb
+++ b/test/utils/server.rb
@@ -13,16 +13,16 @@ module ServerUtils
end
end
- def open_new_stream(arg1 = nil, **kwargs)
+ def open_new_stream(arg1 = nil, state: :idle, **kwargs)
if arg1.is_a?(ServerConnection)
con = arg1
else
con = open_server_connection
end
- @_stream = con.instance_eval {
- new_stream((con.streams.keys.last||0/2)*2+1, **kwargs)
- }
+ @_stream = con.instance_eval { stream(((@max_stream_id+1)/2)*2+1) }
+ @_stream.set_state(state)
+ @_stream.update_dependency(**kwargs)
if block_given?
yield @_stream
else