Is it possible to run unit tests for a custom uploaded VCL file?
I need to be able to run tests against our custom VCL before uploading it to Fastly. The Fastly docs suggest that to test custom VCL we should upload the VCL to a test account, and test against a testing environment before copying the VCL to production (https://docs.fastly.com/guides/vcl/previewing-and-testing-vcl-before-activating-it). Manual testing or testing the entire testing environment with an integration testing tool such as Selenium isn’t really sufficient - we think that we should be able to unit test our VCL code.
Varnish comes with it’s own testing tool called varnishtest. (See https://www.smashingmagazine.com/2016/05/five-simple-steps-test-varnish-cache-deployment-varnishtest/). I have tried using this to test our Fastly validated and working Fastly VCL, but have obviously found that there are extensions (https://docs.fastly.com/guides/vcl/guide-to-vcl#fastly-39-s-vcl-extensions) that aren’t compatible with the VCC compiler, even when using varnish 2.1, which is the version that the Fastly docs say their syntax is compatible with (https://docs.fastly.com/guides/vcl/guide-to-vcl).
Does Fastly provide a varnishtest tool or similar compatible with Fastly Varnish, or does anyone know of another solution to this?
Please sign in to leave a comment.