-
Notifications
You must be signed in to change notification settings - Fork 4
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
Migrate tests to cucumber #78
Conversation
fa19df6
to
50475a0
Compare
This is more or less done. A few things should probably be renamed for consistency. Unlike the old integration tests, the new cucumber tests really only test externally observable behavior (which I think is a strength). The one exception is double authentication. It's very hard to meaningfully tell the difference between double auths without just asking the DB if someone got added twice somehow, so that's the only bit of test SQL. One side thing is because of the high volume of votes for chart testing, i ended up having to parallelize the vote generator. This is a little ugly, but I think it's for the best. |
50475a0
to
2415a45
Compare
dbeeba2
to
bf282db
Compare
bf282db
to
c98c77a
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.
This is good work @ZoopOTheGoop. Just a few tweaks related to more how this would be used in practice please:
- In your givens, you could do a quick check to see if infra is running correctly and bail with a message suggesting how the tests should be run (eg
cargo make full-test
or something else) - If you want to stick with
cargo-make
, do you think its worth adding as a build dep? - Test infra should ideally be different from the infra used for local development (ie uses a different sql db, runs on different ports, etc). The goal is someone should be able to run the server locally & be able to run tests simultaneously without them tainting each other. Can you explore spinning up 'test' infra distinct from the infra used to iterate locally? Happy for that work to be in another PR.
- We should be able to run the entire test suite with a single command (ie at the moment its:
cargo make db-up && cargo make full-test
.
Finally, when I run the test suite locally, using cargo make db-up && cargo make full-test
the suite gets stuck on "List of top 20 staps'. Does it succeed on your end? This is the top of the output I get with clean infra which I have to ctrl+c to stop:
Feature: List of top 20 snaps
Scenario: Tails opens the store homepage, seeing the top snaps
✔> Given a snap with id "3Iwi803Tk3KQwyD6jFiAJdlq8MLgBIoD" gets 100 votes where 75 are upvotes
> Given 25 test snaps gets between 150 and 200 votes, where 125 to 175 are upvotes
2024-02-21T22:05:16.153301Z WARN ratings::features::user::use_cases: an error occurred when calling snapd: an error happened when attempting to retrieve info via /assertions/snap-declaration didn't find a snap with the given id
2024-02-21T22:05:16.156976Z WARN ratings::features::user::use_cases: an error occurred when calling snapd: an error happened when attempting to retrieve info via /assertions/snap-declaration didn't find a snap with the given id
2024-02-21T22:05:16.207071Z WARN ratings::features::user::use_cases: an error occurred when calling snapd: an error happened when attempting to retrieve info via /assertions/snap-declaration didn't find a snap with the given id
2024-02-21T22:05:16.207803Z WARN ratings::features::user::use_cases: an error occurred when calling snapd: an error happened when attempting to retrieve info via /assertions/snap-declaration didn't find a snap with the given id
2024-02-21T22:05:16.229790Z WARN ratings::features::user::use_cases: an error occurred when calling snapd: an error happened when attempting to retrieve info via /assertions/snap-declaration didn't find a snap with the given id
2024-02-21T22:05:16.238972Z WARN ratings::features::user::use_cases: an error occurred when calling snapd: an error happened when attempting to retrieve info via /assertions/snap-declaration didn't find a snap with the given id
You have to be very patient with that test. If you want to see progress change the logging level to The warnings are going to happen no matter what, since we're randomly generating Snap IDs, any request to |
Re: infra, I don't think it's good as a Re: Re: auto-starting infra, ahead of you in making that an issue :) #82, def a separate PR IMO. |
Thanks for the responses. Agreed main sounds like a better place to checking if the infra is ready. For cargo-make my focus there is for other people who are new to the project and aren't as familiar with how to get everything up and running. The idea being we can say here's a single command to run the test suite or here's a single command to iterate locally. We've provided the default happy path and then individuals can choose to go off piste. |
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.
Feel free to merge when you're ready
As the title says, this will migrate the integration tests (or some subset) to Cucumber, currently under investigation.
Closes #65