From e9738eab068bcbcd69790d9d25493acdb4fc8c01 Mon Sep 17 00:00:00 2001 From: xuans Date: Sun, 27 Sep 2026 09:56:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E8=AF=81=E4=B9=A6=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E6=B8=85=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 整理部署清理测试替身格式并修正旧备份断言提示,保持测试行为与实现一致。 --- backend/internal/deployment/service_test.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/backend/internal/deployment/service_test.go b/backend/internal/deployment/service_test.go index 9d458e4..179d5e6 100644 --- a/backend/internal/deployment/service_test.go +++ b/backend/internal/deployment/service_test.go @@ -39,31 +39,18 @@ func newMemoryClient() *memoryClient { func (c *memoryClient) MkdirAll(context.Context, string) error { return nil } func (c *memoryClient) List(_ context.Context, directory string) ([]string, error) { - entries := make([]string, 0) - prefix := strings.TrimSuffix(directory, "/") + "/" - for filePath := range c.files { - if !strings.HasPrefix(filePath, prefix) { - continue - } - name := strings.TrimPrefix(filePath, prefix) - if name == "" || strings.Contains(name, "/") { - continue - } - entries = append(entries, filePath) - } - return entries, nil } @@ -176,7 +163,7 @@ func TestDeployReplacesFilesAndCleansBackups(t *testing.T) { } } if backupCount != 0 { - t.Fatalf("成功部署后应保留三份远程备份:%d", backupCount) + t.Fatalf("成功部署后不应残留远程备份:%d", backupCount) } }