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

First end to end test #2923

Merged
merged 38 commits into from
Apr 21, 2023
Merged

First end to end test #2923

merged 38 commits into from
Apr 21, 2023

Conversation

stchris
Copy link
Contributor

@stchris stchris commented Mar 6, 2023

How to review this: run make e2e. You can run the visual debugger by running PWDEBUG=1 make e2e.

TODOS

  • figure out the "disable host check" thing
  • make CI work
  • reduce the amount of events this gets triggered by
  • perhaps parametrize the BASE_URL in CI
  • have the test clean up after itself
  • use authentication instead of single user mode
  • have the tests run on separate (configurable) ElasticSearch & Postgres DBs
  • prefix test-created resources with [e2e]
  • fix the timestamp prefix when waiting for the ui container

docker-compose.dev.yml Outdated Show resolved Hide resolved
.github/workflows/e2e.yml Outdated Show resolved Hide resolved
@stchris stchris marked this pull request as ready for review April 8, 2023 13:17
Makefile Outdated Show resolved Hide resolved
Copy link
Contributor

@tillprochaska tillprochaska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a few more comments below, but nothing important, feel free to ignore if you disagree :).

Also didn’t mention it before, but I tested this on my machine and make e2e did all the magic and it worked out of the box. (Although the test was failing, for the same reason it fails in CI).

One more suggestion, I often find it helpful to open a shell in the container then run commands directly in the container, because that sometimes makes it a faster to iterate, so instead of running make e2e repeatedly, when I’m actively working on tests, I’d prefer to run make e2e-shell (as a convenience), and then run make e2e-local in the container. Would it be ok if I added that to the Makefile?

e2e/Dockerfile Outdated Show resolved Hide resolved
docker-compose.dev.yml Outdated Show resolved Hide resolved
docker-compose.dev.yml Outdated Show resolved Hide resolved
e2e/test_sanity.py Outdated Show resolved Hide resolved
@stchris
Copy link
Contributor Author

stchris commented Apr 13, 2023

@tillprochaska I was looking at adding the e2e-shell target, but the e2e container does not have make installed. Would you like me to add it?

Just for comparison: here's my workflow when doing iterations during writing a test: I bring up Aleph with make services and then run make e2e-local inside the aleph virtualenv. The big advantage is that you can use the visual debugger and codegen tools this way.

@tillprochaska
Copy link
Contributor

I bring up Aleph with make services and then run make e2e-local inside the aleph virtualenv.

Just to make sure I’m not misunderstanding you: You run make e2e-local in the api container? Or directly on your host machine?

The big advantage is that you can use the visual debugger and codegen tools this way.

Yep, makes sense. I was going to look into doing this while running Playwright in Docker, but I assume this probably requires some fairly complex configuration, so probably not worth it.

Let’s just ignore my comment about this for now. I’ll try to figure out a workflow that works well for me first, and then I can always add something to the Makefile later :)

e2e/test_sanity.py Outdated Show resolved Hide resolved
@stchris
Copy link
Contributor Author

stchris commented Apr 13, 2023

Just to make sure I’m not misunderstanding you: You run make e2e-local in the api container? Or directly on your host machine?

I'm running it on my host machine.

e2e/test_sanity.py Outdated Show resolved Hide resolved
@tillprochaska
Copy link
Contributor

tillprochaska commented Apr 13, 2023

Oh, just noticed one more thing. When running the tests locally, they write to my local dev database and ES index -- I think it would be good to use a test database and index here as well, so it can be deleted/reset easily. For our current Python tests, we override the settings here:

https://github.com/alephdata/aleph/blob/main/aleph/tests/util.py#L32
https://github.com/alephdata/aleph/blob/main/aleph/tests/util.py#L29

@stchris
Copy link
Contributor Author

stchris commented Apr 14, 2023

Oh, just noticed one more thing. When running the tests locally, they write to my local dev database and ES index -- I think it would be good to use a test database and index here as well, so it can be deleted/reset easily. For our current Python tests, we override the settings here:

https://github.com/alephdata/aleph/blob/main/aleph/tests/util.py#L32 https://github.com/alephdata/aleph/blob/main/aleph/tests/util.py#L29

I'll take this as an item into the discussion next week. To me it was practical at times to be able to open up my local Aleph installation and check what the tests have done, but having a clean env makes sense to me.

@Rosencrantz
Copy link
Contributor

Might be good to have some cleanup in place for when the tests finish running?

@stchris stchris changed the title First e2e test First end to end test Apr 20, 2023
@stchris stchris merged commit 7307a29 into develop Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants