Closed Shinyaigeek closed 4 months ago
@Shinyaigeek Thank you for reporting the issue. Now we have custom-syntax registration for parsing VCL so I've tried to implement some syntax for testing like:
describe
before_xxx
hooksafter_xxx
hooksPlease try to use https://github.com/ysugimoto/falco/tree/feature/testing-syntax for your testing environment and let me know if you have any additional opinions or problems for this feature.
@ysugimoto Thank you for fast reply and PoC! I tested it, and it was exactly what I wanted! Thanks!
@Shinyaigeek Thanks for testing, I will create PR and merge into upstream.
Kind of proposals
You can turn on multiple checkboxes.
Describe the feature
Thank you for developing this great tool! This is just a feature request about falco's testing feature.
I want the function to structure unit-tests like a jest's
describe, test, it
label. Due to the VCL's variable limitation, VCL's each subroutine's set it's returned value as a global variable(like areq.http.VARS:hoge
), and a following subroutine will refers it and invoke the process which depends on it (at least in my application).In a view of testing, each unit-test set
req.http.VARS:~~
as parameters before invoking a testing targeted subroutine, and invoke subroutine, and asseretreq.http.VARS:~~
as it's returned values. This way is useful for testing in a micro-scope, but not useful for in a macro-scope.I want the function to structure (or unify) micro-scope unit-tests (
it
) and illustrate macro-scope testing scenario (describe
)usecase in real world
for example, please think about writing a VCL to handle login processing. You might want to split the its processing to the above 3 steps (= subroutine ).
sub parse_jwt
sub validate_jwt
sub handle_auth
As mentioned above, each unit-tests for the each subroutine set some
req.http.VARS:~~
as parameters, and assertreq.http.VARS:~~
as subroutine's returned value.Each unit-test's meaning and subroutine's specification are clear thanks to it's label setted by
@suite
decorator, but overall login flow's test's meaning and specification are unclear in a macro view.