Commit Graph

63 Commits

Author SHA1 Message Date
meejah
ce7458e604 test for disconnect / error propagation 2021-04-14 15:05:44 -06:00
meejah
b73c76c8df run '_Transit' tests on websockets too 2021-04-14 15:05:44 -06:00
meejah
4112f718d4 unused 2021-04-14 15:05:44 -06:00
meejah
eb3bc6b5a8 cleanup 2021-04-14 15:05:44 -06:00
meejah
941e4fe18a clean up imports 2021-04-14 15:05:44 -06:00
meejah
09e46d3713 cleanup 2021-04-14 15:05:44 -06:00
meejah
a89988af90 get rid of placeholder/test code; skip test_short for websockets 2021-04-14 15:05:44 -06:00
meejah
816e997b01 post-rebase fixups 2021-04-14 15:05:44 -06:00
meejah
f18edc89f9 refine 2021-04-14 15:05:44 -06:00
meejah
99c71112b6 a passing thing 2021-04-14 15:05:44 -06:00
meejah
dd1cc7d520 upgrade all tests; reactor_turn(); remove debug 2021-04-14 15:05:44 -06:00
meejah
002773d79f WIP: first passing IOPump test 2021-04-14 15:05:44 -06:00
meejah
5210566150 websocket version of tests, with handshake 2021-04-14 15:05:44 -06:00
meejah
21af1f68a3 Transit is no longer a factory 2021-04-14 15:05:44 -06:00
meejah
34dd36158e unused 2021-04-14 15:05:44 -06:00
meejah
7e58767ac1 pyflakes 2021-04-14 15:05:44 -06:00
meejah
ca55509763 fix global stats-gathering / recording 2021-04-14 15:05:44 -06:00
meejah
60e70bac3c cleanup / dead code 2021-04-14 15:05:44 -06:00
meejah
03906ffe0d pass actual database, not config 2021-04-14 15:05:44 -06:00
meejah
3ae3bb7443 cleanup, remove dead code 2021-04-14 15:05:44 -06:00
meejah
b7bcdfdca3 more stats / recording works 2021-04-14 15:05:44 -06:00
meejah
53864f57f0 use 'backends' for usage-recording 2021-04-14 15:05:44 -06:00
meejah
40919b51be count bytes missing 2021-04-14 15:05:44 -06:00
meejah
ff578fccf8 fix more tests (that examine internals) 2021-04-14 15:05:44 -06:00
meejah
734ed809c2 fix more tests 2021-04-14 15:05:44 -06:00
meejah
b51237d958 start of refactoring usage-recording: pass one test 2021-04-14 15:05:44 -06:00
meejah
00086a798d flush cleanup 2021-04-12 08:50:22 -06:00
meejah
6efc274b81 get rid of double-flush() pairing with florian 2021-04-12 08:44:06 -06:00
meejah
591740ce5f better name for interface 2021-04-10 18:42:12 -06:00
meejah
f3c391e98b more coverage 2021-04-02 23:15:48 -06:00
meejah
2903c7f2a0 re-org + comments 2021-04-02 23:05:52 -06:00
meejah
2d506de55a upcall, 2.7-friendly 2021-04-02 20:33:57 -06:00
meejah
45c09fdd05 explicit interface, different naming 2021-04-02 20:10:01 -06:00
meejah
0434296415 still support py27 2021-04-02 19:57:22 -06:00
meejah
8447f88159 pyflakes 2021-04-02 16:11:18 -06:00
meejah
85f3f5b63c 'mock' location 2021-04-02 16:00:11 -06:00
meejah
5e21a3c35a all tests pass 2021-04-02 16:00:11 -06:00
meejah
b9c2bbc524 refactor to use IOPump: one test passes 2021-04-02 16:00:11 -06:00
Brian Warner
ca309d5283 post-rebase: update newer tests 2020-05-23 17:50:26 -07:00
Joe Harrison
45824ca5d6 Use StringTransportWithDisconnection for transit server tests.
Replace the use of TCP in the test suite with Twisted's
StringTransport, specifically StringTransportWithDisconnection which
allows us to trigger a disconnect event on the server side during testing.

The `dataReceived` method on the server is now called directly, and any
effects will be realised immediately.
Responses are available to the test client using the `value()` method of
the transport objects, and the buffer can be cleared using `clear()`.

This allows all asynchronous behaviour to be removed from the transit
server test suite.
Furthermore, as we never have to wait for the server, tests no longer
hang if they fail: the errors are encountered immediately.
2020-05-23 17:18:47 -07:00
Brian Warner
1a7faf0654 tolerate clients who disconnect before sending a complete handshake
If the client connected and then immediately disconnected, or disconnected
before sending enough of a handshake to be classified as good or bad, we
tried to record the usage record as if the connection was complete ("happy"),
which triggered an assertion. This dumps an error to the log and failed to
record the usage record. In May 2020, this happened 55 times in 40 days.
2020-05-21 22:49:14 -07:00
Brian Warner
9758d83279 fix IPv4/IPv6 listening port
whoops, it's "::" (the unspecified address), not "::1" (the loopback address)

refs #12
2019-09-11 00:23:50 -07:00
Brian Warner
273c4d796c change default port= to listen on both IPv4+IPv6
The default was "tcp:4001", which happens to expand into
"tcp:4001:interface=127.0.0.1", which limits the listening socket to IPv4
connections only.

Changing it to "tcp:4001:interface=\:\:1" means "listen on ::1", which is the
IPv6 name for the loopback interface, and gets us a socket that accepts both
IPv4 and IPv6 connections.

Note: this might cause incompatibilities with IPv4-only hosts, if they don't
accept the "::1" name. For these systems, run the server as `twist
transitrelay --port=tcp:4001" to revert to the old behavior.

closes #12
2019-09-10 23:09:04 -07:00
Brian Warner
a9680918b9 test_stats: try more realistic fake time.time()
Maybe windows+py36 was failing because "456" is too small of a value, and the
OS time libraries can't figure out UTC for something back in 1970. Switch to
a fixed timestamp from just a few minutes ago, to see if it likes 2018
better.
2018-02-19 13:23:40 -08:00
Brian Warner
071471a353 test_stats: mock time.time() with a float, to appease windows
For some reason, the appveyor (windows) tests fail on py36 with an OSError
during an internal (twisted.python.log) call to datetime.fromtimestamp().
It's possible that my mock times are too old (I'm using made-up values like
"456"), but maybe it's just that real time.time() returns a float instead of
an integer.
2018-02-19 13:12:14 -08:00
Brian Warner
f7b8c5b19a copy increase_rlimits.py from magic-wormhole-mailbox-server
This code was originally in magic-wormhole, embedded in the server startup
code. I carved it out to a separate file (with tests) in mailbox-server, but
it should be used here too.
2018-02-19 12:26:10 -08:00
Brian Warner
4e9b6c53a9 rework mood tracking, full tests of usage events 2018-02-12 16:57:39 -08:00
Brian Warner
547ead75ba test_transit_server: factor out wait() 2018-02-12 16:55:37 -08:00
Brian Warner
05ffcb2d55 test_transit_server: improve coverage 2017-11-09 16:39:44 -08:00
Brian Warner
c270ad6e0b DB: small cleanups, improve test coverage 2017-11-09 16:39:25 -08:00