Thu, 23 Mar 2023 12:14:53 +0000
client: Fix timeout handling
Previously, the timeout handler would fire an error that would get caught and
logged by the timer code. However that error never reached the upper levels of
scansion, leading to the whole thing just hanging.
Now we just trigger resumption of the async runner, and throw the error from
there if we haven't received the stanza yet.
With this change, timeouts are now correctly handled and reported as failures.
8
42b4e73c0d30
client: Wait for login to complete before continuing past the 'connects' action
Matthew Wild <mwild1@gmail.com>
parents:
6
diff
changeset
|
1 | local async = require "scansion.async"; |
66
909c00296c2a
client: Make use of new scansion.error library, log the received stanza when different to expected one
Matthew Wild <mwild1@gmail.com>
parents:
60
diff
changeset
|
2 | local new_error = require "scansion.error".new_error; |
4 | 3 | local verse = require "verse".init("client"); |
1
017c5809d537
client: Enable verse log output
Matthew Wild <mwild1@gmail.com>
parents:
0
diff
changeset
|
4 | |
0
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 | local parse_xml = require "scansion.xml".parse; |
6
0c94ea0cabec
client: Implement send/receive, including new stanzacmp library
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
6 | |
82
f90056b8e278
main.lua, client: Make timeouts more coherent (stanza timeout was greater than action timeout), add command-line options to change them
Matthew Wild <mwild1@gmail.com>
parents:
73
diff
changeset
|
7 | local default_stanza_timeout = 3; |
6
0c94ea0cabec
client: Implement send/receive, including new stanzacmp library
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
8 | |
0c94ea0cabec
client: Implement send/receive, including new stanzacmp library
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
9 | local stanzacmp = require "scansion.stanzacmp"; |
0c94ea0cabec
client: Implement send/receive, including new stanzacmp library
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
10 | |
171
433a1f36d0d3
client: Move some generic utility functions to a helpers module
Matthew Wild <mwild1@gmail.com>
parents:
164
diff
changeset
|
11 | local helpers = require "scansion.helpers"; |
16
59f176aa3465
client: Allow simple variable substitution in XML in scripts
Matthew Wild <mwild1@gmail.com>
parents:
15
diff
changeset
|
12 | |
0
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 | return { |
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 | _validate = function (client) |
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 | assert(client.jid, "No JID specified"); |
23
af7a51d78b7b
client: Improve stream logging, now prefixed by client name (taken from script)
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
16 | client.stream = verse.new(verse.new_logger(client.name)); |
48
6450aea6c564
scansion.objects.client: Pass on 'connect_host' to the stream
Kim Alvefur <zash@zash.se>
parents:
46
diff
changeset
|
17 | client.stream.connect_host = client.connect_host |
49
69c329681c3b
scansion.objects.client: And the port too
Kim Alvefur <zash@zash.se>
parents:
48
diff
changeset
|
18 | client.stream.connect_port = client.connect_port |
23
af7a51d78b7b
client: Improve stream logging, now prefixed by client name (taken from script)
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
19 | |
af7a51d78b7b
client: Improve stream logging, now prefixed by client name (taken from script)
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
20 | function client.log(fmt, ...) |
af7a51d78b7b
client: Improve stream logging, now prefixed by client name (taken from script)
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
21 | return client.stream:info(fmt, ...); |
af7a51d78b7b
client: Improve stream logging, now prefixed by client name (taken from script)
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
22 | end |
10 | 23 | |
24 | -- This one prints all received data | |
23
af7a51d78b7b
client: Improve stream logging, now prefixed by client name (taken from script)
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
25 | client.stream:hook("incoming-raw", function (s) client.log("Data in: %s", s); end, 1000); |
af7a51d78b7b
client: Improve stream logging, now prefixed by client name (taken from script)
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
26 | client.stream:hook("outgoing-raw", function (s) client.log("Data out: %s", s); end, 1000); |
af7a51d78b7b
client: Improve stream logging, now prefixed by client name (taken from script)
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
27 | -- And incoming, parsed, stanzas |
af7a51d78b7b
client: Improve stream logging, now prefixed by client name (taken from script)
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
28 | client.stream:hook("stanza", function (s) client.log("Stanza: %s", s) end); |
60
e032cdb517ab
client.lua: Handle unexpected disconnects in the middle of a test
Matthew Wild <mwild1@gmail.com>
parents:
53
diff
changeset
|
29 | -- Handle unexpected disconnects |
e032cdb517ab
client.lua: Handle unexpected disconnects in the middle of a test
Matthew Wild <mwild1@gmail.com>
parents:
53
diff
changeset
|
30 | client.stream:hook("disconnected", function (s) |
118
073136acfeab
client: Add _finish handler to disconnect from server if still connected
Matthew Wild <mwild1@gmail.com>
parents:
111
diff
changeset
|
31 | if not (client.disconnect_expected or client.script.finished) or (s.reason and s.reason ~= "stream closed" and s.reason ~= "closed") then |
90
8458f8bdb3b0
client: Detect unexpected disconnects more reliably
Matthew Wild <mwild1@gmail.com>
parents:
84
diff
changeset
|
32 | client.log("Unexpected disconnect!"); |
8458f8bdb3b0
client: Detect unexpected disconnects more reliably
Matthew Wild <mwild1@gmail.com>
parents:
84
diff
changeset
|
33 | error("Unexpected disconnect"..(s.reason and " ("..tostring(s.reason)..")" or "")); |
8458f8bdb3b0
client: Detect unexpected disconnects more reliably
Matthew Wild <mwild1@gmail.com>
parents:
84
diff
changeset
|
34 | end |
60
e032cdb517ab
client.lua: Handle unexpected disconnects in the middle of a test
Matthew Wild <mwild1@gmail.com>
parents:
53
diff
changeset
|
35 | end); |
0
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
36 | end; |
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
37 | |
118
073136acfeab
client: Add _finish handler to disconnect from server if still connected
Matthew Wild <mwild1@gmail.com>
parents:
111
diff
changeset
|
38 | _finish = function (client) |
073136acfeab
client: Add _finish handler to disconnect from server if still connected
Matthew Wild <mwild1@gmail.com>
parents:
111
diff
changeset
|
39 | if client.stream.connected then |
073136acfeab
client: Add _finish handler to disconnect from server if still connected
Matthew Wild <mwild1@gmail.com>
parents:
111
diff
changeset
|
40 | client.disconnect_expected = true; |
073136acfeab
client: Add _finish handler to disconnect from server if still connected
Matthew Wild <mwild1@gmail.com>
parents:
111
diff
changeset
|
41 | client.stream:close(); |
073136acfeab
client: Add _finish handler to disconnect from server if still connected
Matthew Wild <mwild1@gmail.com>
parents:
111
diff
changeset
|
42 | end |
073136acfeab
client: Add _finish handler to disconnect from server if still connected
Matthew Wild <mwild1@gmail.com>
parents:
111
diff
changeset
|
43 | end; |
073136acfeab
client: Add _finish handler to disconnect from server if still connected
Matthew Wild <mwild1@gmail.com>
parents:
111
diff
changeset
|
44 | |
0
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
45 | connects = function (client) |
8
42b4e73c0d30
client: Wait for login to complete before continuing past the 'connects' action
Matthew Wild <mwild1@gmail.com>
parents:
6
diff
changeset
|
46 | local wait, done = async.waiter(); |
52
3eedbb76e3f2
scansion.objects.client: Split long line into one statement per line
Kim Alvefur <zash@zash.se>
parents:
51
diff
changeset
|
47 | client.stream:hook("ready", function () |
53
3208dff3fb31
scansion.objects.client: Pause connection before resuming async processing
Kim Alvefur <zash@zash.se>
parents:
52
diff
changeset
|
48 | client.stream.conn:pause() |
52
3eedbb76e3f2
scansion.objects.client: Split long line into one statement per line
Kim Alvefur <zash@zash.se>
parents:
51
diff
changeset
|
49 | client.log"ready" |
3eedbb76e3f2
scansion.objects.client: Split long line into one statement per line
Kim Alvefur <zash@zash.se>
parents:
51
diff
changeset
|
50 | done() |
3eedbb76e3f2
scansion.objects.client: Split long line into one statement per line
Kim Alvefur <zash@zash.se>
parents:
51
diff
changeset
|
51 | client.log("ready done") |
3eedbb76e3f2
scansion.objects.client: Split long line into one statement per line
Kim Alvefur <zash@zash.se>
parents:
51
diff
changeset
|
52 | end); |
4 | 53 | client.stream:connect_client(client.jid, client.password); |
8
42b4e73c0d30
client: Wait for login to complete before continuing past the 'connects' action
Matthew Wild <mwild1@gmail.com>
parents:
6
diff
changeset
|
54 | wait(); |
15
0441673df075
client: Add full JID as property of clients
Matthew Wild <mwild1@gmail.com>
parents:
10
diff
changeset
|
55 | client.full_jid = client.stream.jid; |
50
0ce9c9a0c2a0
scansion.objects.client: Expose a 'host' property with the bare hostname
Kim Alvefur <zash@zash.se>
parents:
49
diff
changeset
|
56 | client.host = client.stream.host; |
0
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
57 | end; |
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
58 | |
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
59 | sends = function (client, data) |
171
433a1f36d0d3
client: Move some generic utility functions to a helpers module
Matthew Wild <mwild1@gmail.com>
parents:
164
diff
changeset
|
60 | local stanza = helpers.fill_vars(client.script, assert(parse_xml((table.concat(data):gsub("\t", " "))))); |
73
1c07ef6c6502
client: Wait for 'drained' event when sending stanzas (experimental, may help with syncing to server's logs)
Matthew Wild <mwild1@gmail.com>
parents:
66
diff
changeset
|
61 | local wait, done = async.waiter(); |
1c07ef6c6502
client: Wait for 'drained' event when sending stanzas (experimental, may help with syncing to server's logs)
Matthew Wild <mwild1@gmail.com>
parents:
66
diff
changeset
|
62 | local function handle_drained() |
1c07ef6c6502
client: Wait for 'drained' event when sending stanzas (experimental, may help with syncing to server's logs)
Matthew Wild <mwild1@gmail.com>
parents:
66
diff
changeset
|
63 | client.stream:unhook("drained", handle_drained); |
1c07ef6c6502
client: Wait for 'drained' event when sending stanzas (experimental, may help with syncing to server's logs)
Matthew Wild <mwild1@gmail.com>
parents:
66
diff
changeset
|
64 | done(); |
1c07ef6c6502
client: Wait for 'drained' event when sending stanzas (experimental, may help with syncing to server's logs)
Matthew Wild <mwild1@gmail.com>
parents:
66
diff
changeset
|
65 | end |
1c07ef6c6502
client: Wait for 'drained' event when sending stanzas (experimental, may help with syncing to server's logs)
Matthew Wild <mwild1@gmail.com>
parents:
66
diff
changeset
|
66 | client.stream:hook("drained", handle_drained); |
6
0c94ea0cabec
client: Implement send/receive, including new stanzacmp library
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
67 | client.stream:send(stanza); |
73
1c07ef6c6502
client: Wait for 'drained' event when sending stanzas (experimental, may help with syncing to server's logs)
Matthew Wild <mwild1@gmail.com>
parents:
66
diff
changeset
|
68 | wait(); |
0
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
69 | end; |
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
70 | |
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
71 | receives = function (client, data) |
26
c32334d33438
client: Wait for received stanzas using async waiter
Matthew Wild <mwild1@gmail.com>
parents:
25
diff
changeset
|
72 | local wait, done = async.waiter(); |
84
c9061cd9951b
client: Support for "receives: nothing", to verify that the server does not respond to a given stanza, for example
Matthew Wild <mwild1@gmail.com>
parents:
83
diff
changeset
|
73 | local expected_stanza = false; |
164
14500a149b31
client: Ignore timeout timer if we received a stanza
Matthew Wild <mwild1@gmail.com>
parents:
130
diff
changeset
|
74 | local have_received_stanza = false; |
84
c9061cd9951b
client: Support for "receives: nothing", to verify that the server does not respond to a given stanza, for example
Matthew Wild <mwild1@gmail.com>
parents:
83
diff
changeset
|
75 | data = table.concat(data):gsub("\t", " "):gsub("^%s+", ""):gsub("%s+$", ""); |
c9061cd9951b
client: Support for "receives: nothing", to verify that the server does not respond to a given stanza, for example
Matthew Wild <mwild1@gmail.com>
parents:
83
diff
changeset
|
76 | if data ~= "nothing" then |
171
433a1f36d0d3
client: Move some generic utility functions to a helpers module
Matthew Wild <mwild1@gmail.com>
parents:
164
diff
changeset
|
77 | expected_stanza = helpers.fill_vars(client.script, assert(parse_xml(data))); |
84
c9061cd9951b
client: Support for "receives: nothing", to verify that the server does not respond to a given stanza, for example
Matthew Wild <mwild1@gmail.com>
parents:
83
diff
changeset
|
78 | end |
6
0c94ea0cabec
client: Implement send/receive, including new stanzacmp library
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
79 | local function stanza_handler(received_stanza) |
164
14500a149b31
client: Ignore timeout timer if we received a stanza
Matthew Wild <mwild1@gmail.com>
parents:
130
diff
changeset
|
80 | have_received_stanza = true; |
84
c9061cd9951b
client: Support for "receives: nothing", to verify that the server does not respond to a given stanza, for example
Matthew Wild <mwild1@gmail.com>
parents:
83
diff
changeset
|
81 | if not expected_stanza then |
111
25530dccf696
scansion.error, client: Change error syntax slightly, so first param is identifier string
Matthew Wild <mwild1@gmail.com>
parents:
105
diff
changeset
|
82 | error(new_error("unexpected-stanza", { |
25530dccf696
scansion.error, client: Change error syntax slightly, so first param is identifier string
Matthew Wild <mwild1@gmail.com>
parents:
105
diff
changeset
|
83 | text = "Received unexpected stanza"; |
25530dccf696
scansion.error, client: Change error syntax slightly, so first param is identifier string
Matthew Wild <mwild1@gmail.com>
parents:
105
diff
changeset
|
84 | stanza = tostring(received_stanza); |
25530dccf696
scansion.error, client: Change error syntax slightly, so first param is identifier string
Matthew Wild <mwild1@gmail.com>
parents:
105
diff
changeset
|
85 | })); |
84
c9061cd9951b
client: Support for "receives: nothing", to verify that the server does not respond to a given stanza, for example
Matthew Wild <mwild1@gmail.com>
parents:
83
diff
changeset
|
86 | elseif not expected_stanza or not stanzacmp.stanzas_match(expected_stanza, received_stanza) then |
c9061cd9951b
client: Support for "receives: nothing", to verify that the server does not respond to a given stanza, for example
Matthew Wild <mwild1@gmail.com>
parents:
83
diff
changeset
|
87 | if not expected_stanza then |
c9061cd9951b
client: Support for "receives: nothing", to verify that the server does not respond to a given stanza, for example
Matthew Wild <mwild1@gmail.com>
parents:
83
diff
changeset
|
88 | client.log("Received a stanza when none were expected: %s", received_stanza); |
c9061cd9951b
client: Support for "receives: nothing", to verify that the server does not respond to a given stanza, for example
Matthew Wild <mwild1@gmail.com>
parents:
83
diff
changeset
|
89 | else |
c9061cd9951b
client: Support for "receives: nothing", to verify that the server does not respond to a given stanza, for example
Matthew Wild <mwild1@gmail.com>
parents:
83
diff
changeset
|
90 | client.log("Expected: %s", expected_stanza); |
c9061cd9951b
client: Support for "receives: nothing", to verify that the server does not respond to a given stanza, for example
Matthew Wild <mwild1@gmail.com>
parents:
83
diff
changeset
|
91 | client.log("Received: %s", received_stanza); |
c9061cd9951b
client: Support for "receives: nothing", to verify that the server does not respond to a given stanza, for example
Matthew Wild <mwild1@gmail.com>
parents:
83
diff
changeset
|
92 | end |
111
25530dccf696
scansion.error, client: Change error syntax slightly, so first param is identifier string
Matthew Wild <mwild1@gmail.com>
parents:
105
diff
changeset
|
93 | error(new_error("unexpected-stanza", { |
25530dccf696
scansion.error, client: Change error syntax slightly, so first param is identifier string
Matthew Wild <mwild1@gmail.com>
parents:
105
diff
changeset
|
94 | text = "Received unexpected stanza"; |
105
da98bb33cee6
scansion.objects.client: Include expected stanza in error, if any
Matthew Wild <mwild1@gmail.com>
parents:
90
diff
changeset
|
95 | stanza = tostring(received_stanza); |
da98bb33cee6
scansion.objects.client: Include expected stanza in error, if any
Matthew Wild <mwild1@gmail.com>
parents:
90
diff
changeset
|
96 | expected = expected_stanza and tostring(expected_stanza) or nil; |
da98bb33cee6
scansion.objects.client: Include expected stanza in error, if any
Matthew Wild <mwild1@gmail.com>
parents:
90
diff
changeset
|
97 | })); |
6
0c94ea0cabec
client: Implement send/receive, including new stanzacmp library
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
98 | else |
83
52f8fa7f999e
client: Store last received id so it can be used in scripts
Matthew Wild <mwild1@gmail.com>
parents:
82
diff
changeset
|
99 | client.last_received_id = received_stanza.attr.id; |
23
af7a51d78b7b
client: Improve stream logging, now prefixed by client name (taken from script)
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
100 | client.log("YES! %s", expected_stanza) |
6
0c94ea0cabec
client: Implement send/receive, including new stanzacmp library
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
101 | end |
0c94ea0cabec
client: Implement send/receive, including new stanzacmp library
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
102 | expected_stanza = nil; |
27
34d405303242
client: Remove stanza handler when stanza comes in
Matthew Wild <mwild1@gmail.com>
parents:
26
diff
changeset
|
103 | client.stream:unhook("stanza", stanza_handler); |
51
afc7765827be
scansion.objects.client: Hold of reading from clients when they are not expecting stanzas
Kim Alvefur <zash@zash.se>
parents:
50
diff
changeset
|
104 | client.stream.conn:pause(); |
90
8458f8bdb3b0
client: Detect unexpected disconnects more reliably
Matthew Wild <mwild1@gmail.com>
parents:
84
diff
changeset
|
105 | client.log("Calling done") |
26
c32334d33438
client: Wait for received stanzas using async waiter
Matthew Wild <mwild1@gmail.com>
parents:
25
diff
changeset
|
106 | done(); |
6
0c94ea0cabec
client: Implement send/receive, including new stanzacmp library
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
107 | end |
0c94ea0cabec
client: Implement send/receive, including new stanzacmp library
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
108 | client.stream:hook("stanza", stanza_handler, 100); |
82
f90056b8e278
main.lua, client: Make timeouts more coherent (stanza timeout was greater than action timeout), add command-line options to change them
Matthew Wild <mwild1@gmail.com>
parents:
73
diff
changeset
|
109 | verse.add_task(client.stanza_timeout or default_stanza_timeout, function () |
172
2c17151ed21b
client: Fix timeout handling
Matthew Wild <mwild1@gmail.com>
parents:
171
diff
changeset
|
110 | done(); |
2c17151ed21b
client: Fix timeout handling
Matthew Wild <mwild1@gmail.com>
parents:
171
diff
changeset
|
111 | end); |
2c17151ed21b
client: Fix timeout handling
Matthew Wild <mwild1@gmail.com>
parents:
171
diff
changeset
|
112 | client.stream.conn:resume(); |
2c17151ed21b
client: Fix timeout handling
Matthew Wild <mwild1@gmail.com>
parents:
171
diff
changeset
|
113 | wait(); |
2c17151ed21b
client: Fix timeout handling
Matthew Wild <mwild1@gmail.com>
parents:
171
diff
changeset
|
114 | |
2c17151ed21b
client: Fix timeout handling
Matthew Wild <mwild1@gmail.com>
parents:
171
diff
changeset
|
115 | if not have_received_stanza then |
82
f90056b8e278
main.lua, client: Make timeouts more coherent (stanza timeout was greater than action timeout), add command-line options to change them
Matthew Wild <mwild1@gmail.com>
parents:
73
diff
changeset
|
116 | if expected_stanza then |
f90056b8e278
main.lua, client: Make timeouts more coherent (stanza timeout was greater than action timeout), add command-line options to change them
Matthew Wild <mwild1@gmail.com>
parents:
73
diff
changeset
|
117 | client.log("TIMEOUT waiting for %s", expected_stanza) |
130
ce99abde467b
client: Throw scansion error on stanza timeout, to avoid traceback
Matthew Wild <mwild1@gmail.com>
parents:
118
diff
changeset
|
118 | local e = new_error("stanza-timeout", { text = "Timed out waiting for stanza" }); |
ce99abde467b
client: Throw scansion error on stanza timeout, to avoid traceback
Matthew Wild <mwild1@gmail.com>
parents:
118
diff
changeset
|
119 | error(e); |
82
f90056b8e278
main.lua, client: Make timeouts more coherent (stanza timeout was greater than action timeout), add command-line options to change them
Matthew Wild <mwild1@gmail.com>
parents:
73
diff
changeset
|
120 | end |
f90056b8e278
main.lua, client: Make timeouts more coherent (stanza timeout was greater than action timeout), add command-line options to change them
Matthew Wild <mwild1@gmail.com>
parents:
73
diff
changeset
|
121 | if expected_stanza == false then |
f90056b8e278
main.lua, client: Make timeouts more coherent (stanza timeout was greater than action timeout), add command-line options to change them
Matthew Wild <mwild1@gmail.com>
parents:
73
diff
changeset
|
122 | client.log("Good - no stanzas were received (expected)"); |
f90056b8e278
main.lua, client: Make timeouts more coherent (stanza timeout was greater than action timeout), add command-line options to change them
Matthew Wild <mwild1@gmail.com>
parents:
73
diff
changeset
|
123 | done(); |
f90056b8e278
main.lua, client: Make timeouts more coherent (stanza timeout was greater than action timeout), add command-line options to change them
Matthew Wild <mwild1@gmail.com>
parents:
73
diff
changeset
|
124 | end |
172
2c17151ed21b
client: Fix timeout handling
Matthew Wild <mwild1@gmail.com>
parents:
171
diff
changeset
|
125 | end |
0
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
126 | end; |
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
127 | |
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
128 | disconnects = function (client) |
90
8458f8bdb3b0
client: Detect unexpected disconnects more reliably
Matthew Wild <mwild1@gmail.com>
parents:
84
diff
changeset
|
129 | client.disconnect_expected = true; |
29
9dcdea04601c
client: Implement 'disconnects' action
Matthew Wild <mwild1@gmail.com>
parents:
28
diff
changeset
|
130 | client.stream:close(); |
0
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
131 | end; |
2e31b584f8d9
It is better to write and run incomplete tests than not to run complete tests. -- Martin Fowler
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
132 | } |