medic / cht-core

The CHT Core Framework makes it faster to build responsive, offline-first digital health apps that equip health workers to provide better care in their communities. It is a central resource of the Community Health Toolkit.
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
469 stars 217 forks source link

Update e2e test log watcher to wait for expected logs #9620

Open dianabarsan opened 2 weeks ago

dianabarsan commented 2 weeks ago

Describe the issue We have a procedure in e2e test where we collect service logs while performing certain requests or operations. and analyze the resulting logs to validate whether or not actions have been successful / correct. Unfortunately, there is a delay between the actions happening and the logs being pushed to the watcher - docker needs to write the log to a file and then we tail the file and get the result. This leaves us with flaky tests. The solution applied right now is to wait for a moderate amount of time (usually less than a second) before collecting logs, to insure that we are giving docker (or k3d) a chance to finish writing logs to wherever.

Describe the improvement you'd like Instead of relying on these waits, change the log collector function to resolve only when all expected lines are logged.