mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 04:12:23 +01:00
21bc4b01ca
* 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 |
||
---|---|---|
.. | ||
clickhouse.ts | ||
graphile.ts | ||
kafka.ts | ||
plugins.ts | ||
promises.ts | ||
sql.ts | ||
sqlMock.ts | ||
worker.ts |