readmeio / rdme

ReadMe's official command-line interface (CLI) and GitHub Action 🌊
https://docs.readme.com/main/docs/rdme
MIT License
103 stars 42 forks source link

test: mock out git #972

Closed kellyjosephprice closed 7 months ago

kellyjosephprice commented 7 months ago

🧰 Changes

Speeds up a few tests by mocking out git commands.

I was poking around to investigate a bug (https://linear.app/readme-io/issue/RM-8336/childdocs-are-createdsyncd-before-parentdocs-in-rdme-cli) and noticed some test timeouts when running them locally. It looks like for a number of tests, we were making actual requests like git remote. I don't understand why those can be so slow, they're nearly instant when running them in a shell?

my machine before image

my machine after image

With all the parallelization, and the fact that the slowest part seems to be the e2e tests, the actual speed up on CI is negligible. But for running individual test files, they go from 5+ seconds to <1 second.

🧬 QA & Testing

Tests should pass???

kellyjosephprice commented 7 months ago

amazing, LGTM! are you still seeing the perf benefits?

Yea, it looked like the exact same time for test runs.