Skip to content

test: Speed up backend tests#9289

Merged
timgl merged 25 commits intomasterfrom
speed-up-tests
Apr 27, 2022
Merged

test: Speed up backend tests#9289
timgl merged 25 commits intomasterfrom
speed-up-tests

Conversation

@timgl
Copy link
Copy Markdown
Collaborator

@timgl timgl commented Mar 30, 2022

Problem

Backend tests are slow

Changes

Insert all events and persons created during a test in bulk when we call sync_execute.

For some tests that don't ever run sync_execute you can run flush_persons_and_events() manually.
Before:
image

After:
image

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

How did you test this code?

tests?

@posthog-bot
Copy link
Copy Markdown
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@posthog-bot
Copy link
Copy Markdown
Contributor

This PR was closed due to 2 weeks of inactivity. Feel free to reopen it if still relevant.

@timgl timgl reopened this Apr 15, 2022
@timgl timgl changed the title Speed up backend tests tests: Speed up backend tests Apr 15, 2022
@timgl timgl changed the title tests: Speed up backend tests test: Speed up backend tests Apr 15, 2022
@timgl timgl requested a review from EDsCODE April 26, 2022 14:41
@timgl timgl marked this pull request as ready for review April 26, 2022 14:45
Copy link
Copy Markdown
Collaborator

@EDsCODE EDsCODE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it.

Also, this gives us a foundation to try out the idea we talked about—testing the snapshots before inserting data and executing the query. Right before bulk_creations we could run test snapshots of the query and if the queries are exactly identical, just have sync execute return snapshots of the results to continue the test

@timgl timgl merged commit 5887bd2 into master Apr 27, 2022
@timgl timgl deleted the speed-up-tests branch April 27, 2022 12:38
fuziontech added a commit that referenced this pull request Apr 28, 2022
* master: (137 commits)
  feat(cohorts): add cohort filter grammars (#9540)
  feat(cohorts): Backwards compatibility of groups and properties (#9462)
  perf(ingestion): unsubscribe from buffer topic while no events are produced to it (#9556)
  fix: Fix `Loading` positioning and `LemonButton` disabled state (#9554)
  test: Speed up backend tests (#9289)
  fix: LemonSpacer -> LemonDivider (#9549)
  feat(funnels): Highlight significant deviations in new funnel viz (#9536)
  docs(storybook): Lemon UI (#9426)
  feat: add support for list of teams to enable the conversion buffer for (#9542)
  chore(onboarding): cleanup framework grid experiment (#9527)
  fix(signup): domain provisioning on cloud (#9515)
  chore: split out async migrations ci (#9539)
  feat(ingestion): enable json ingestion for self-hosted by default (#9448)
  feat(cohort): add all cohort filter selectors to Storybook (#9492)
  feat(ingestion): conversion events buffer consumer (#9432)
  ci(run-backend-tests): remove CH version default (#9532)
  feat: Add person info to events (#9404)
  feat(ingestion): produce to buffer partitioned by team_id:distinct_id (#9518)
  fix: bring latest_migrations.manifest up to date (#9525)
  chore: removes unused feature flag (#9529)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants