TL;DR - It sets up a basic acceptance testing framework for Killgrave.
Here's some further information:
Requirements/assumptions
It requires/uses the acceptance Go build flag to avoid being executed with other tests (e.g. unit or integration tests).
Assumes the binary killgrave exists in the local bin/ directory at testing time.
So, you need to compile the app before running these tests, and run them as a black box
To simplify that, I've added an acceptancemake target that does both.
Relies on txtar files to simplify test cases definition.
In the future, we might explore the idea of reusing those, with an in-memory file system, adequately injected into the app.Run() function, so we can also use the same framework and test cases for more like integration tests.
The main testing algorithm is:
For every directory under acceptance/tests:
Creates a temporary directory with the files defined at config.txtar (imposters, schemas, responses, etc)
Runs Killgrave, at any available, randomly assigned port, specifying the former as the imposters directory
For every .txtar file on http directory:
It performs the request defined in req.http
Asserts the response against the file defined in res.http.
So, it's pretty easy to define multiple acceptance/end-2-end tests for different imposters.
Once merged, I'd suggest to consider adding one extra test to this suite as part of the definition of done (DoD) for all the remaining PRs, and for the new ones, unless completely unrelated.
Also, in the near future, we could extend this kind of framework to also assert the Killgrave's output.
Thanks!
PS: I merged #173 because it was a requirement to have ✅ checks here, and the only suggestion I left unresolved was adding more coverage with tests, which is indirectly covered by the changes present here.
TL;DR - It sets up a basic acceptance testing framework for Killgrave.
Here's some further information:
Requirements/assumptions
acceptance
Go build flag to avoid being executed with other tests (e.g. unit or integration tests).killgrave
exists in the localbin/
directory at testing time.acceptance
make target that does both.txtar
files to simplify test cases definition.app.Run()
function, so we can also use the same framework and test cases for more like integration tests.The main testing algorithm is:
acceptance/tests
:config.txtar
(imposters, schemas, responses, etc).txtar
file onhttp
directory:req.http
res.http
.So, it's pretty easy to define multiple acceptance/end-2-end tests for different imposters.
Once merged, I'd suggest to consider adding one extra test to this suite as part of the definition of done (DoD) for all the remaining PRs, and for the new ones, unless completely unrelated.
Also, in the near future, we could extend this kind of framework to also assert the Killgrave's output.
Thanks!
PS: I merged #173 because it was a requirement to have ✅ checks here, and the only suggestion I left unresolved was adding more coverage with tests, which is indirectly covered by the changes present here.