Skip to content
Snippets Groups Projects
Commit 6168ec5c authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Fix gh-265 "session.test spontaneously fails".

Remove races in the test.
Re-enable the test after 'console' patch.

Also fix session.storage.test.lua (broken if called multiple times).
parent 6171d618
No related merge requests found
......@@ -112,6 +112,9 @@ function inc() active_connections = active_connections + 1 end
function dec() active_connections = active_connections - 1 end
---
...
net = { box = require('net.box') }
---
...
session.on_connect(inc)
---
...
......@@ -121,19 +124,33 @@ session.on_disconnect(dec)
active_connections = 0
---
...
--# create connection con_one to default
c = net.box:new(0, box.cfg.listen)
---
...
while active_connections < 1 do fiber.sleep(0.001) end
---
...
active_connections
---
- 0
- 1
...
c1 = net.box:new(0, box.cfg.listen)
---
...
while active_connections < 2 do fiber.sleep(0.001) end
---
...
--# create connection con_two to default
active_connections
---
- 0
- 2
...
c:close()
---
...
c1:close()
---
...
--# drop connection con_one
--# drop connection con_two
fiber.sleep(0) -- yield
while active_connections > 0 do fiber.sleep(0.001) end
---
...
active_connections
......@@ -162,7 +179,7 @@ session.on_disconnect(audit_disconnect)
box.schema.user.grant('guest', 'read,write,execute', 'universe')
---
...
a = (require 'net.box'):new('127.0.0.1', box.cfg.listen)
a = net.box:new('127.0.0.1', box.cfg.listen)
---
...
a:call('dostring', 'return space:get{session.id()}[1] == session.id()')[1][1]
......
......@@ -95,6 +95,9 @@ dump(tres2)
---
- '''["cde","def"]'''
...
getmetatable(session).aggregate_storage = {}
---
...
session = nil
---
...
......@@ -44,4 +44,5 @@ table.sort(tres2)
dump(tres1)
dump(tres2)
getmetatable(session).aggregate_storage = {}
session = nil
......@@ -46,16 +46,19 @@ session.on_disconnect(nil, fail)
-- check how connect/disconnect triggers work
function inc() active_connections = active_connections + 1 end
function dec() active_connections = active_connections - 1 end
net = { box = require('net.box') }
session.on_connect(inc)
session.on_disconnect(dec)
active_connections = 0
--# create connection con_one to default
c = net.box:new(0, box.cfg.listen)
while active_connections < 1 do fiber.sleep(0.001) end
active_connections
--# create connection con_two to default
c1 = net.box:new(0, box.cfg.listen)
while active_connections < 2 do fiber.sleep(0.001) end
active_connections
--# drop connection con_one
--# drop connection con_two
fiber.sleep(0) -- yield
c:close()
c1:close()
while active_connections > 0 do fiber.sleep(0.001) end
active_connections
session.on_connect(nil, inc)
......@@ -68,7 +71,7 @@ session.on_connect(audit_connect)
session.on_disconnect(audit_disconnect)
box.schema.user.grant('guest', 'read,write,execute', 'universe')
a = (require 'net.box'):new('127.0.0.1', box.cfg.listen)
a = net.box:new('127.0.0.1', box.cfg.listen)
a:call('dostring', 'return space:get{session.id()}[1] == session.id()')[1][1]
a:close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment