From 473dee6e8d282476f95f2b380481da2de42460c9 Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Tue, 17 Nov 2026 13:09:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(test):=20=E6=8F=92=E4=BB=B6=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=88=AA=E6=AD=A2=E6=B5=8B=E8=AF=95=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E5=90=8E=E6=8D=A2=E5=9B=9E=E5=B7=A5=E4=BD=9C=E5=8F=B0=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=9C=8D=E5=8A=A1=20(#1956)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #1982 让测试 harness 收尾时像 finishCloseProject 一样停止运行、构建和调试, TestPluginSettingsLatestQueuedDeadlineRequiresRestart 换上的空 pluginservice.Service 没有 Runs,收尾时 stopRunsForProject 空指针,整包 workbench 测试 panic。 测试结束时换回原来的服务,与同样换服务的 pluginsync 测试一致。 --- desktop/internal/workbench/settings_plugin_effects_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/desktop/internal/workbench/settings_plugin_effects_test.go b/desktop/internal/workbench/settings_plugin_effects_test.go index 75b29e9727..774db0c6f6 100644 --- a/desktop/internal/workbench/settings_plugin_effects_test.go +++ b/desktop/internal/workbench/settings_plugin_effects_test.go @@ -51,7 +51,11 @@ func TestPluginSettingsLatestQueuedDeadlineRequiresRestart(t *testing.T) { server := &pluginServer{project: p, session: &pluginservice.LanguageSession{PluginID: "example", Version: "1.0.0"}, cancel: func() {}, done: make(chan struct{}), settingsGate: make(chan struct{}, 1)} server.settingsGate <- struct{}{} h.app.pluginServers = map[string]*pluginServer{"example": server} + // The bare service has no runs, builds or backends; the harness closes the project with the + // workbench's own service, as the other tests that swap it in do. + original := h.app.plugins h.app.plugins = &pluginservice.Service{} + defer func() { h.app.plugins = original }() h.app.applyLivePluginSettings(p, "example", "1.0.0") h.settle() if _, pending := h.app.pluginSettingsRestart.Load("example"); !pending {