Skip to content
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

e2e tests fail #132

Closed
witash opened this issue Sep 10, 2024 · 10 comments
Closed

e2e tests fail #132

witash opened this issue Sep 10, 2024 · 10 comments
Assignees
Labels
Type: Technical issue Improve something that users won't notice

Comments

@witash
Copy link
Contributor

witash commented Sep 10, 2024

changes to user management have broken the end-to-end tests, so that the user creation request returns 400.
this is caused by validatePassword, the test password is too weak

Also, at the end of the ltfu spec, the encounter which is meant to be created on the fhir server by completing a task is not created, for unknown reasons

@witash witash added the Type: Technical issue Improve something that users won't notice label Sep 10, 2024
@witash witash self-assigned this Sep 10, 2024
@witash witash moved this from Todo to In Progress in Product Team Activities Sep 10, 2024
@witash
Copy link
Contributor Author

witash commented Sep 10, 2024

running locally, I get this error

  ● Steps to follow the Loss To Follow-Up (LTFU) workflow › Should follow the LTFU workflow

    CHT user creation failed: Reason 400

      75 |     contactId = createUserResponse.body.contact.id;
      76 |   } else {
    > 77 |     throw new Error(`CHT user creation failed: Reason ${createUserResponse.status}`);
         |           ^
      78 |   }
      79 | };
      80 |

      at test/ltfu-flow.spec.ts:77:11
      at fulfilled (test/ltfu-flow.spec.ts:5:58)

because either validatePassword failes, or because validateUsername fails because already exists because database is not being removed properly. so not a problem for remote runs in the github workflow.

the next error is

    Expected: 1
    Received: 0

      175 |
      176 |     expect(retrieveFhirDbEncounter.status).toBe(200);
    > 177 |     expect(retrieveFhirDbEncounter.body.total).toBe(1);
          |                                                ^
      178 |   });
      179 | });
      180 |

      at test/ltfu-flow.spec.ts:177:48
      at fulfilled (test/ltfu-flow.spec.ts:5:58)

so the LTFU flow is supposed to create a task on CHT, and when this task is completed outbound push sends an Encounter to the FHIR server.
It looks like the ltfu spec is working up to this last step; in particular the request to complete the task

expect(submitChtTaskResponse.status).toBe(201);

returns 201.

is the task not actually completed, cht returns 201 anyway?
is the encounter not created?
created not sent?

then the next error, for remote run in the github workflow, is
https://github.com/medic/cht-interoperability/actions/runs/10788982689/job/29921014029#step:6:169
probably a rate limit that someone has encountered before and has a workaround for

@lorerod
Copy link
Contributor

lorerod commented Sep 13, 2024

For the error in the remote run in the GitHub workflow:
https://github.com/medic/cht-interoperability/actions/runs/10788982689/job/29921014029#step:6:169
I can't find DOCKERHUB_TOKEN or DOCKERHUB_USERNAME in the repository actions settings. Maybe I don't have permission. @njuguna-n @witash, can you please help with this?

lorerod pushed a commit that referenced this issue Sep 14, 2024
@lorerod
Copy link
Contributor

lorerod commented Sep 14, 2024

or because validateUsername fails because already exists because database is not being removed properly.

@witash I think the database is not removed properly locally because ${COUCHDB_DATA} is a bind mount to a local directory ./srv.
I hope you don't mind I push a commit to fix(#132): change password to pass validation in tests branch.

@lorerod
Copy link
Contributor

lorerod commented Sep 14, 2024

Locally I'm unable to reproduce the error in:
expect(retrieveFhirDbEncounter.body.total).toBe(1);

The e2e es passing:

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        11.65 s
Ran all test suites matching /ltfu-flow.spec.ts/i.

@njuguna-n
Copy link

@lorerod I also don't have access to actions settings for the repo. You can reach out to @github-owners on Slack if it's still a blocker.

@witash
Copy link
Contributor Author

witash commented Sep 16, 2024

@witash I think the database is not removed properly locally because ${COUCHDB_DATA} is a bind mount to a local directory ./srv.

good catch, I was very confused about why the couchdb data was persisting even when the volumes were destroyed.
Instead of deleting it manually in the script (which gives me permissions errors somehow) maybe we just change this to a normal docker volume; e2e tests will delete it by calling docker compose down -v via startup.sh destroy

@lorerod lorerod self-assigned this Sep 16, 2024
lorerod pushed a commit that referenced this issue Sep 16, 2024
@witash
Copy link
Contributor Author

witash commented Sep 17, 2024

Locally I'm unable to reproduce the error in: expect(retrieveFhirDbEncounter.body.total).toBe(1);

After running it in on a different computer, it now works for me also.

witash added a commit that referenced this issue Sep 19, 2024
Co-authored-by: Maria Lorena Rodriguez Viruel <[email protected]>
Co-authored-by: Maria Lorena Rodriguez Viruel <[email protected]>
@witash
Copy link
Contributor Author

witash commented Sep 19, 2024

for the rate limit issue, looks like a fix could be to switch to ecr

@lorerod
Copy link
Contributor

lorerod commented Sep 20, 2024

@witash I implemented retries when starting containers in #133
Do you think that this issue can be closed?

@lorerod
Copy link
Contributor

lorerod commented Oct 1, 2024

As the e2e tests are not failing anymore due to rate limit issues, I’m closing this issue. I’ve created a follow-up issue to Switch Docker Compose to Pull Images from ECR.

@lorerod lorerod closed this as completed Oct 1, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Product Team Activities Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Technical issue Improve something that users won't notice
Projects
Archived in project
Development

No branches or pull requests

3 participants