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
Please consider adapting websocket-functional-test.el to use ert-deftest #64
Comments
I can use ert within the test, but do you also want it to not be run from the command line to execute? |
I've attached a build log for reference. The relevant section is L733 to L796, and L734 is where we run It looks like Finally, it would be nice to move away from the obsolete P.S. There's already been an uncharacteristically early positive response to my ITP (intent to package email), so I think you'll appreciate knowing that people are excited about seeing your work included in Debian :-) |
P.S. what I mean by "error-handling" test unit is a test unit designed to test the libraries error-handling capabilities. eg: test for expected failure error string, and pass if it matches or fail if the error string isn't triggered when the failure case is triggered. |
Can you comment further on why About error-handling tests, I don't personally believe it is all that useful to test actual error messages. We do test that the library does error out when it is supposed to. |
Hi Andrew,
Andrew Hyatt <notifications@github.com> writes:
Can you comment further on why `websocket-server-close` and
websocket-to-bytes` should fail? I'm not sure what you are referring
to - the ert tests you are referring to work, because the code under
test works. I took another look at the code but didn't see anything
obviously wrong.
testserver.py is not called, and python isn't installed (see previously
attached build log), so I expect some self tests to fail, because
testserver.py + ERT tests seem to exist to verify that communication
over a websocket functions correctly. The console output indicates that
communication with the server is failing, and it's not clear which test
unit this is attached to.
Evidence of the failure is in the unhandled error output:
```
Websocket client connection: Host header not found
...
Websocket client connection: HTTP/1.1 not found
```
About error-handling tests, I don't personally believe it is all that
useful to test actual error messages. We do test that the library
does error out when it is supposed to.
Fair point :-) one can test for success instead, and of course it
doesn't need to be a string comparison--that was just a example.
The issue is that tests always pass, even when there a server is not
active, and thus when all websocket transfers will fail. If tests
always pass, even when the server is absent, then the results have
superficial value. eg: The units and associated code-paths have valid
syntax and no logic errors, but aren't actually testing functionality.
I'm sorry I won't have the free time to jump in and work on fixing them
myself until mid January (at the earliest), and I understand it's
annoying and/or insulting when people complain but don't contribute code.
This bug report is a request to call testserver.py as part of the ERT
tests and to integrate `websocket-functional-test.el` into those tests.
Here are some units that seem like they should fail when the server is
not running, and thus when websocket transfers necessarily fail (there
may be more):
websocket-get-server-response, websocket-send, websocket-send-text,
websocket-server-close, websocket-verify-response-code
Best,
Nicholas
|
I think there may be some confusion here. There's two main testing files in the websocket package: the Please let me know if I'm misunderstanding your point. |
PTAL at commit 69ee80a and let me know if it seems acceptable to you. It should fulfill the requirements as described. |
I've merged this into the master branch now. Thank you for the suggestion! |
@ahyatt, sorry for the delay replying; I got lost in the backlog of work and messages. Thank you very much for working on this! It looks good, with one issue: I'll understand if this isn't something you're interested in supporting ;-) It would be nice to have though, since the alternative is disabling this test on Debian infrastructure. Thank you! |
I think it's valuable to have functional tests that use an outside source of truth such as echo.websocket.org. Disabling the functional tests in Debian seems like a reasonable idea. We do the opposite in the emacs elpa repository - we don't include the unit tests, since there have been contributions there I have authors that haven't signed the FSF papers. |
Sorry for the delay again; it took a while to find the time to look into this!
Agreed :-)
Unless one is testing DNS or routing, I don't see how this is more valuable than a server (that is independent of emacs-websocket) running on localhost. For example, after reading up on what other software uses to validate its websocket support I found that the Autobahn|Testsuite seems to the standard by which all others are measured. For the purposes of CI, it's available as the
Pulling out teeth also seems like a reasonable idea ;-) and I think we'll agree that context and consideration of the available alternatives is important.
If an author has disappeared, has refused to sign the papers, objects to the FSF's invasive identity verification, or the concept of copyright assignment to a 3rd party, then no other options exist (other than a clean-room rewrite by someone who hasn't seen the existing unit tests...but that's pedantic, no?). If you don't want to work on this, would you accept a PR that enables the use of an alternative "outside source of truth" such as Autobahn running on localhost? I imagine it will require these: a variable for the URL; a variable for a "server-start-command" and another for "server-kill-command"; possibly a third variable to hold the server's PID; functions to make use of these, plus a branch to take the "server-start-command" path rather than the echo.websocket.org one if the "websocket-test-url" variable is set. Everything apart from the URL allows Emacs to manage the server--to minimise dependencies on external frameworks. Thanks, |
I previously used Python's Tornado webserver to test out websocket in our functional test. Yes, it was nice to have something purely on-machine, but I found the disadvantages outweighed the advantages, the main disadvantage being the user needed to have something installed to test with. Installing things is not always so easy. For most manual runs of the functional tests, the dependency was a source of failures and didn't buy a lot. However, if you wanted to set up some sort of continuous functional test using Autobahn because this is useful for Debian, that's fine with me. Send over a PR and I will take a look. One idea I never implemented is to use the emacs websocket client to talk to the server. Benefit: no outside dependencies at all. Drawback: you can't really be sure you are testing anything. |
Hi,
Thanks again for maintaining this software. As mentioned in another issue I'm investigating packaging this library for Debian. Would you please consider adapting websocket-functional-test.el to use ert-deftest? I maintain the Debian package for Elpy, so I know it's possible ;-) As for the "why" our Emacsen Team exclusively uses ERTs for QA and CI.
Sincerely,
Nicholas
The text was updated successfully, but these errors were encountered: