medic / cht-conf

A command-line interface for configuring Community Health Toolkit applications
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
23 stars 25 forks source link

feat(#425): E2E test actions #620

Closed m5r closed 1 month ago

m5r commented 2 months ago

Description

medic/cht-conf#425

This PR adds a first E2E test covering the compile-app-settings and upload-app-settings actions. Tests are run against an actual CHT instance using CHT Docker helper and are run automatically in the CI.

The containers the CI runs with cannot resolve local-ip.medicmobile.org even though they can resolve 127-0-0-1.local-ip.medic.org 🤔 (related medic-infrastructure issue) so the E2E tests are running a slightly modified docker helper script to force DNS resolution. It's a temporary band-aid that should be removed as soon as the DNS issue is fixed.

Code review items

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

mrjones-plip commented 2 months ago

@m5r - instead of using an upstream branch on CHT Core in the dnm-docker-helper-experiments branch which hard codes IP in curl call in Docker Helper, and then in turn we have to either hold this in a branch forever or have end users get it - instead lets update the CHT Conf runner to have an entry in /etc/hosts before it tries to fetch the certs from local-ip server.

Something like this should work (untested!) :

- name: Hard code local-ip IP in /etc/hosts per https://github.com/medic/medic-infrastructure/issues/571#issuecomment-2209120441
  run: |
      echo "15.188.129.97 local-ip.medicmobile.org" | sudo tee -a /etc/hosts
m5r commented 1 month ago

@tatilepizs excellent idea! First, I've added logs and increased the timeout to 120 seconds. This should be enough as it rarely takes more than 60 seconds in the CI to spin up an instance. cht-core's API tests have a 200 second timeout but I don't think we need to reach for that high timeout at this stage. Second, I've added a section in the README to cover the npm run e2e-test command and how tests are run. Let me know if anything is missing/needs clarification.

And finally to answer your question, I don't know either why cht-docs doesn't have much covering cht-conf..

mrjones-plip commented 1 month ago

I don't know either why cht-docs doesn't have much covering cht-conf...

This is both a question and an answer ;) It's not been documented because people keep asking the question!!

If either of you are interested in starting docs on this, possibly with a first step of creating a docs page and replacing the enire readme with a "see docs site!" link, that'd be great!

cc @esthermmoturi & @nsitaula

tatilepizs commented 1 month ago

😅 I can help with that. I am going to create a PR to move the README file to the docs. thanks @mrjones-plip

And thanks @m5r for the improvements and the section in the README file 🌟

medic-ci commented 1 month ago

:tada: This PR is included in version 4.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

garethbowen commented 1 month ago

@m5r NB this should have been a chore not a feat as it's not something that a CLI user will notice.

m5r commented 1 month ago

My bad, thanks @garethbowen for pointing out the correct commit type, I'll keep these guidelines (that's the convention semantic-release follows) in mind for future PRs