-
Notifications
You must be signed in to change notification settings - Fork 4
HTTPS Integration tests not working (app_3001) #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @d4vsanchez, thanks for the really detailed description! I personally haven't been able to get any integration tests working for apps. using ssl, it always resulted in a bad cert error (i think it is an issue with |
Tbh i think having a drash server made it a bit convoluted - i'm not saying it's hard or impossible to have a drash server, sockets server and sockets client work together, just 3 being in 1 file with tests is a bit tricky, and the drash server isn't actually needed. I'm curious how you managed to get it working though, do you still have the code you used? FYI there's an in progress PR here: https://github.com/drashland/sockets/pull/89 |
The decode error is coming from when a socket client is trying to connect to the server it seems ( |
@ebebbington I thought I have git stashed it on the weekend but it seems that erased the changes. Exactly, what I managed to look is that the DecodeError is after that line. The WebSocket seems to be created successfully (not 100% sure) but its state doesn't change from CONNECTING to OPEN. If you remove the Line 17 which sends the data, the DecodeError doesn't happen anymore (though the test doesn't work for obvious reasons). I tested that the WebSocket wasn't changing its status by adding a while loop between the WebSocket instantiation and the const socketClient = new WebSocket(
`wss://${socketServer.hostname}:${socketServer.port}`,
);
+ while (socketClient.readyState === 0) {}
await socketClient.send(JSON.stringify(data)); I'm going to check the #89 after work to see if I can help in something else. |
I believe that loop stops the event loop anyways, i think a better way might be:
That process has helped me countless times xD Thanks for the fast response, and yeah feel free to check it out, have a tinker etc etc, it's all very appreciated. Although, i get the error when just trying to connect to the server, without sending any messages - i wonder if the certs are invalid in some way |
I don't think the certs are valid... atm i'm just trying to use wscat but. getting ECONNREFUSED, really stuck on how to fix it :/ |
i'm going to look into this during the month of june. if i can't figure out, then we're going to have to release v1.0.0 without it; and make a fix to include this in v1.0.1 or 1.1.0, whichever comes first |
Hi everyone! I managed to make it work by issuing a new certificate that's valid until 2120. The thing is that I had to create some files as said here: https://gist.github.com/cecilemuller/9492b848eb8fe46d462abeb26656c4f8 and run the tests using the following flag Do you think is useful if I create a PR and you help me find out if it's possible to run the tests without the |
Hi @d4vsanchez, that’s great news! Yes PR’s are welcome :) |
closing as this issue is way too old compared to the current codebase, closing in favour of #128 |
The
app_3001
is not working for two reasons:readyState
from CONNECTING to OPEN. And sending the data to the socket in the CONNECTING state fails with aSending fatal alert DecodeError
exception.To Reproduce
Steps to reproduce the first behavior:
deno test --allow-all tests/integration/app_3001/tests.ts
.Steps to reproduce the second behavior:
tests/deps.ts
.deno test --allow-all tests/integration/app_3001/tests.ts
.I'm exporting Drash with the following change in the
tests/deps.ts
file:Expected behavior
Tests must pass.
Suggested Solution(s)
First problem's solution I think is simple, Drash could be imported as above and that'll fix it.
Second problem is not that straightforward (at least for me). I tried setting a while loop and an "open" event listener to the
clientSocket
variable to check if the Socket would change itsreadyStatus
to OPEN, but it never did. Moving the Socket to the test case, instead of having it on the Drash server worked OK (the "open" event listener was called), my two cents is that thereturn this.response;
of the Drash server has any kind of problem with the async nature of the connection of the Socket and that function gets executed without expecting the OPEN connection status.Screenshots
tests/deps.ts
file:Environment
Additional context
app_3000
and theapp_3001
tests, and maybe that server is the cornerstone of the test.The text was updated successfully, but these errors were encountered: