Browsing the /r/golang subreddit, you might get the impression that "mock" is a dirty word. I was recently reading a thread on testing strategies and was surprised by the intensity of the anti-mock sentiment. The arguments were visceral: Avoid mocks like the plague. Mocks are like payday loans. Convenient. You say “expect this method to be called with args X and Y, return Z”. Seems cheap. But the loan shark quickly starts charging interest. At FunnelStory, we see it differently. We’ve learned to love mocks—not as a shortcut, but as the only way to meaningfully build and maintain a complex application as a small team (with no dedicated QA). We manage a complex distributed system that orchestrates LLMs, syncs CRM data, and handles long-running workflows. In this environment, relying solely on "real" integration tests left us with blind spots. We couldn't reliably test what happens when an API sends a 429 Rate Limit, or when a workflow needs to pause for exactly 24 hours. More importantly, we realized that the majority of our edge cases depend on specific combinations of integrations that exist in a customer's workspace—states that are impossible to reproduce or recreate in our own environments. This reality drove us to define a new goal: 100% meaningful coverage. We don't just want green checkmarks for the "happy paths" that run when the database is online. We want to cover the "chaos paths" that cause production outages. While we are still refactoring our legacy code to fully meet this standard, this disciplined style of mocking has become indispensable to our scale. Here is the "Tactical Pair" strategy we adopted to make mocks safe, reliable, and effective. The Problem: Mock Drift vs. Integration Complexity When testing systems, you face two opposing risks: Mock Drift: Mocks are static, but reality evolves. If your database schema changes but your mock doesn't, your test suite stays green while production breaks. The mock becomes a lie. The Integration Trap: Testing...
First seen: 2025-12-24 12:44
Last seen: 2025-12-24 19:45