0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
posthog/plugin-server/tests/helpers
Harry Waye 21bc4b01ca
refactor(e2e): make e2e tests 4x faster (#12214)
* refactor(e2e): make e2e tests 4x faster

I'm a little scared to make changes to the pluginsServer without having
some way to test that is close to production. I started changing some of
the internals in https://github.com/PostHog/posthog/pull/12191 but
started to see test failures for internals that I'm not confident in
handling without having some higher level tests testing the
pluginsServer functionality as a whole, so I started looking at the e2e
tests which are very slow and look like they don't have great coverage.

Rather than restarting the pluginsServer each time, we can use the
feature of partitioning by teamId to run multiple tests against the same
server.

To do this I've added a few helper functions for pulling out of
ClickHouse which enforce that you include a filter on teamId. It's a
little more verbose but also hopefully serves as good documentation for
how e.g. plugins work and are loaded.

I've also avoided reaching into the internals of the pluginsServer as
much as possible, only doing so to reload the plugins. Ideally we'd also
handle the reload via the PubSub which would allow us to, for example,
run the e2e tests against a separate pluginsServer process thereby
getting more confidence, but that's a stretch and maybe something we can
do without. This would however make it easy, for instance to:

 1. make big refactors without fear of breaking things
 2. swap out, e.g. the anonymous consumer to use instead something
    written in bash or maybe something not quite as absurd.

* enable buffer, remove random teamId
2022-10-12 16:14:46 +01:00
..
clickhouse.ts feat(app-metrics): Set up schema and data gathering of app metrics (#12143) 2022-10-12 11:30:58 +03:00
graphile.ts
kafka.ts chore: nuke protobuf fully (#10932) 2022-08-03 15:41:44 +02:00
plugins.ts feat(apps): rename web.ts to site.ts (#12179) 2022-10-11 10:27:21 +00:00
promises.ts
sql.ts refactor(e2e): make e2e tests 4x faster (#12214) 2022-10-12 16:14:46 +01:00
sqlMock.ts
worker.ts