-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add ephemeral tests to waspc/e2e-tests
#3465
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
base: franjo/ephemeral-tests-move-snapshot-folder
Are you sure you want to change the base?
Add ephemeral tests to waspc/e2e-tests
#3465
Conversation
waspc/e2e-tests
|
Cool! I won't get into proper reviewing if others have time because I don't have enough time do to it properly, but I would potentially recommend @cprecioso as a reviewer, he is new to this piece of code and will both benefit from learning about it + offering a fresh perspective. My only quick feedback is, do we have to call them "ephemeral"? Can't they just be named "tests", and "snapshot" tests are then kind of a specialization? Ephemeral sounds like there is sometihng unusually ephemeral happening, but then one realized "oh ok they are just normal tests" hah, so would be nice to avoid that "misdirection". I guess you maybe did so because you hvae Tests and then you have SnapshotTests and you needed to also somehow name these guys, but maybe that is then design issue (or maybe not). Sequential part -> I hope when you said they have to execute sequentially, you meant a single test calls its content sequentially, not that all of them have to wait for each other? If actually all tests have to execute sequentially, that kind of sucks, doesn't it? Would be good to understand better in that case if we can not hvae that limitation. Ok this is my quick take, I hope someobdy else can take this one over. |
|
Hey, didn't take a look yet, just a heads-up that I won't be able to fit this review before I go on vacation. I can do it when I come back. |
Yes. It's simply giving them a name. I could name them just
Sadly they are fully sequential because of Do note that currently even snapshot tests are executed sequentially (the project generation part, which is also the most expensive part time wise, as it's done sequentially before running the So we do have a lot to gain by optimizing both of them.
That is fine, I still have to fix the issue that interactive tests (e.g. |
|
Maybe "Regression tests" is what we want? |
|
I don't think "regression tests" term is used in this way. I would just call them Tests then and that is ok, they are just normal, general tests. |
Description
What are "ephemeral" tests?
Before this PR
waspc/e2e-testsonly had the snapshot tests. They function in a way where we want to keep their artifacts (snapshots) as part of the git tracked files. Ephemeral tests on the other hand are just normal tests where we don't want to keep any artifacts after running them. So think of them as normal tests, we just use this name to keep them distinct from the snapshot tests.Before going to deep into the solution be aware that we are aiming to refactor the whole
waspc/e2e-testsby moving them away from the current unix shell commands approach. Instead we will write all of our logic in pure haskell. This is to make them cross platform compatible. That is why the tests which would require complex unix shell command implementations were only partially implemented. As the unix shell commands logic will be dropped, they are not worth the time investment.More on cross platform compatible e2e tests here: #3404
In short, we want a net gain positive from these tests, not that they cover everything. Standard good code quality rules still apply.
The CLI commands table, which the implementation was based on can be found here: https://www.notion.so/wasp-lang/CLI-Testing-24518a74854c8051b0fef88533592504?source=copy_link
In there we mention which commands we are testing, which we are not, and why.
Note, as we now have additional variant of tests besides the snapshot tests, I decided to refactor the structure so that the snapshot tests logic is moved under the
waspc/e2e-tests/SnapshotTestfolder.Changes related to moving snapshot tests folder are in a separate PR: #3468
Ephemeral tests consist of a name (which creates a same-named directory under
EphemeralTest/temp) and ephemeral test cases. Each ephemeral test case is a unix shell command. Ephemeral test cases are executed sequentially. This is different from snapshot tests which only ever have a single unix shell command. This approach makes it much easier to build the unix shell commands (since we can split them into steps - test cases), and also we can validate the individual test cases separately. The validity of the test case is done by checking its exit status.Sequentiality is enforced by executing the unix shell commands while creating the
Hspec'sSpec. Only for the captured exit status to be translated into SUCCESS/FAIL after running all of the tests. This is because I couldn't forceTastyto run them in sequence even while using thesequentialfunction.Blocked by #3480 which enables us to use the
wasp db resetcommand non-interactively. This PR assumes the above PR is merged.Type of change