Open Morfent opened 6 years ago
User#rename since it relies on a round trip from the server to a client to the login server and back in order to work
No! The login server has already participated by the time rename
is called. We just validate the signed assertion in the verifier process and send the reply to the user. So networking isn't really involved here.
Users disconnecting voluntarily while in rooms will make the server try to send |deinit| messages to them well after they've disconnected.
This isn't really a problem. In a multiprocess async world, you just ignore the mistimed message and carry on.
No! The login server has already participated by the time rename is called. We just validate the signed assertion in the verifier process and send the reply to the user. So networking isn't really involved here.
You're right. Networking with the login server would probably be too insecure and lengthy for tests. I was trying to describe a login test from connect to rename, but that's ridiculous. Testing it piece-meal would make more sense and wouldn't take an eternity to finish
This isn't really a problem. In a multiprocess async world, you just ignore the mistimed message and carry on.
...true, but I feel they can be avoided. They're not something I'd consider a high priority to fix though.
I mean, you can always mock loginserver.js
if you really wanted to test login code. Would probably not be a bad thing to test?
Wait, login code doesn't use loginserver.js
But honestly we need more integration tests. It's weird that we can pass all our current tests without actually being able to start a battle. Sim bots currently literally spin up a PS instance; we should do that too.
static/index.html
redirects the user to the client. They can also help pinpoint bugs in SockJS or faye-websocket that could potentially create ghost connections, and can help ensure that the socket multiplexer properly cleans up sockets after they have disconnectedUser
methods are difficult to test, especiallyUser#rename
since it relies on a round trip from the server to a client to the login server and back in order to work. The other problem is that I haven't found an efficient way to be able to test how the main process communicates with workers since they need to set up their static and SockJS servers each time they're spawned. Go handles tests with networking by making mocks of networking-related structs, which is something proxyquire might be able to emulate|deinit|
messages to them well after they've disconnected. Battles try to move players to their subchannels before they've even been added to the battle room's channel. This is mitigated in sockets.js, I know, but after having found ways to break faye-websocket by violating RFC6455, For the parts of PS that don't follow its own protocol, I feel like tests to narrow down where and how they happen would help make it possible for sockets.js to be able to trust what the parent process is sending ittl;dr testing networking in an optimal way would allow testing the parts of Users/Rooms that interact with sockets so real connections, users, and rooms can be used for tests