From 5659de4ab857df27a364a1307a2a4727e3d8eb7c Mon Sep 17 00:00:00 2001 From: Myroslav Date: Wed, 24 Jul 2024 10:08:55 +0200 Subject: [PATCH] Shut down agent after each test (#1922) Since the `CodyIntegrationTextFixture` starts a fresh agent for every test case, we need to shut down those agents during cleanup. Otherwise the leftover agent processes clog the RAM (each Node process takes 50-250 MB), and the JVM threads which listen to them keep running forever. ## Test plan Manually run the stability check in CI --- .../sourcegraph/cody/util/CodyIntegrationTextFixture.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/integrationTest/kotlin/com/sourcegraph/cody/util/CodyIntegrationTextFixture.kt b/src/integrationTest/kotlin/com/sourcegraph/cody/util/CodyIntegrationTextFixture.kt index 57cfdd30e5..60c4c594b4 100644 --- a/src/integrationTest/kotlin/com/sourcegraph/cody/util/CodyIntegrationTextFixture.kt +++ b/src/integrationTest/kotlin/com/sourcegraph/cody/util/CodyIntegrationTextFixture.kt @@ -49,6 +49,13 @@ open class CodyIntegrationTextFixture : BasePlatformTestCase() { logger.warn("Error shutting down session", x) } } + CodyAgentService.getInstance(myFixture.project).apply { + try { + stopAgent(project) + } catch (x: Exception) { + logger.warn("Error shutting down agent", x) + } + } } finally { super.tearDown() }