-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat(#425): Create e2e test setup #610
feat(#425): Create e2e test setup #610
Conversation
fix(#602): fix errors with validate functions
5f4bd5e
to
61f4032
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the incremental PRs here! I want to start with a broad question/suggestion about approach:
Is there a reason you think it might be better to use a shell script for the orchestration of the tests and to trigger the mocha
run vs using mocha
to orchestrate the setup and teardown of everything by running shell commands? (Shell script calling Mocha as you have done here vs Mocha calling shell commands....) Seems like either could work. 🤔
My main motivation for asking is that in cht-core, we settled on orchestrating everything (e.g. the integration tests) through mocha so that launching the tests via a mocha command will do all the setup/teardown of docker, etc. I guess doing the setup in mocha will result in more LoC overall (vs just a shell script), but it will be JS code1 which may be more accessible to cht-conf devs (folks like me that are not very savvy with shell scripts... 😅 ). IDK, @sugat009, let me know what you think here!
I was a bit skeptical at first glance about using the docker-helper to spin up the test instance, but the more I have thought about it, the more I like it! It is going to add some overhead complexity that might be challenging, but we will get a lot for free (such as avoiding port collisions and valid SSL certs). Seems like if we don't use the docker-helper we will just end up manually implementing the same thing.... In the future (does not have to be a part of this project), we should look into enhancing the docker-helper to be easier to use programmatically (so we don't have to echo "y"
). Would be nice to just have a one-and-done command to run instead of the script having to be "interactive"....
Footnotes
-
Admittedly it will be JS code that makes a bunch of shell calls via
const { execSync, spawn } = require('child_process');
🤷 ↩
That's a very intriguing question @jkuester . I don't have a strong preference, but upon reflection, even though we utilize Mocha for setup and teardown orchestration, we essentially end up executing shell commands, albeit through JavaScript. In terms of choosing between the two, I'd say each approach has its own advantages and disadvantages. However, if I were to lean towards one, I'd opt for writing it in shell scripts. They are simpler to write, have lower resource overhead, and there's the rare scenario where a task is feasible in the shell but not as straightforward in a programming language like JS, TS, or Python.
My apologies for not being aware of this. I must admit, I'm not a shell expert myself 😅. However, if the technical preference leans towards using JavaScript for these types of tasks, I have no objections and I'm willing to rewrite this in JS.
Yes, this would be a nice feature to have. I'm thinking of adding a flag to |
@m5r @tatilepizs what are your thoughts on orchestrating the tests with a shell script vs Mocha? I agree with Sugat that a shell script will be more straightforward, but at the same time I put a lot of value in consistency and so it would be nice to match cht-core. @tatilepizs do you have any context for why we went with mocha for the cht-core e2e/integration tests? |
I also like the simplicity of bash and would usually prefer it over javascript for tiny, well-defined scripts.
|
I agree with @jkuester and @m5r about consistency, using different things could be complicated especially when we are learning about the project. I understand @sugat009's point about simplicity, but I really like the organization and structure of having just one way of doing things.
No I don't, when I joined Medic that decision was already made 😅 However, I think that in one of the projects from ecosystem, they use something different than mocha to run tests. Am I right @lorerod ? |
Hi @m5r @jkuester @tatilepizs @sugat009, we experienced with Jest in the cht-interoperability repo, and it was mainly for unit and API tests. Our e2e test doesn't require web browser testing as the repo publishes an API, not a web interface. For API e2e testing, we use Jest with Supertest. I understand the benefits of having only one way of doing things. Cht-conf is more closely related to cht-core. |
That is helpful context @lorerod and thank you everyone for the input! cht-conf is currently using |
Thanks, everyone for your feedback and input, it makes complete sense to go with |
@sugat009 Just checking up with where we're at here? |
@garethbowen This task has been on pause for a while now as I've been assigned other tasks such as medic/cht-android#308 and https://github.com/moh-kenya/config-echis-2.0/issues/1871. The progress before transitioning to pause is that I've re-written this in JS up until the point where the docker helper file is run and I was working on providing it input like in line 30 of |
Add support for AuthSession cookie
9d89609
to
86a0e97
Compare
Closing in favor of #620. Reason is Josh is out and there is no way to merge this to |
Description
Add a shell script that downloads the
cht-core
docker-helper
file and setscht-core
up for e2e testing. The shell script also destroyscht-core
containers using the samedocker-helper
after testing has been completed.medic/cht-conf#[425]
Code review items
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.