Hey,
Thanks for maintaining this project, it's great for correlating Cloudflare analytics with other metrics. The use of venom is nice for easy testing but as written it requires real CF credentials which can be a problem if these aren't readily available.
I'm wondering if you'd be open to the expansion of testing with options to mock the Cloudflare responses. There's at least two options for doing this that I can see:
- We could write integration tests that use a
GraphQL object that provides mock responses to allow testing of individual functions.
- (+) Allows partial and gradual implementation of test coverage
- (+) Changing API responses only require updated mock responses for the individual function
- (+) Complements additional integration testing of other functions, if we choose to implement that
- (-) Doesn't enhance functional or E2E test coverage
- (-) Adds a second separate test suite
- We could implement a test HTTP server mode that serves a set of mock responses defined in JSON files and allow Venom tests to be written against them.
- (+) Continues to use the easy-to-write Venom testing
- (-) More code changes required to support running the binary in test server mode
- (-) Much more complex code required to implement a GraphQL server that serves the correct responses
I think option 1 (integration tests) would be worthwhile in itself, and I'd be happy to raise a PR with some initial tests. Depending on maintainer preference we could implement them in table-test format using only the standard library, or use e.g. stretchr/testify and httpmock to write BDD style tests.
Let me know if you're interested and I'll open a PR if so.
Thanks!
Hey,
Thanks for maintaining this project, it's great for correlating Cloudflare analytics with other metrics. The use of venom is nice for easy testing but as written it requires real CF credentials which can be a problem if these aren't readily available.
I'm wondering if you'd be open to the expansion of testing with options to mock the Cloudflare responses. There's at least two options for doing this that I can see:
GraphQLobject that provides mock responses to allow testing of individual functions.I think option 1 (integration tests) would be worthwhile in itself, and I'd be happy to raise a PR with some initial tests. Depending on maintainer preference we could implement them in table-test format using only the standard library, or use e.g. stretchr/testify and httpmock to write BDD style tests.
Let me know if you're interested and I'll open a PR if so.
Thanks!