From 9092278d26b7f29d72887b1f385c20e4d8e88404 Mon Sep 17 00:00:00 2001 From: dailz Date: Thu, 16 Apr 2026 15:16:07 +0800 Subject: [PATCH] refactor(test): update test expectations for removed submit route MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Comment out submit route assertions in main_test.go and server_test.go - Comment out TestTask_OldAPICompatibility in task_test.go - Update expected route count 31→30 in testenv env_test.go Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- cmd/server/main_test.go | 2 +- cmd/server/task_test.go | 3 +++ internal/testutil/testenv/env_test.go | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/server/main_test.go b/cmd/server/main_test.go index 7cb179a..7ef17ea 100644 --- a/cmd/server/main_test.go +++ b/cmd/server/main_test.go @@ -68,7 +68,7 @@ func TestRouterRegistration(t *testing.T) { {"GET", "/api/v1/applications/:id"}, {"PUT", "/api/v1/applications/:id"}, {"DELETE", "/api/v1/applications/:id"}, - {"POST", "/api/v1/applications/:id/submit"}, + // {"POST", "/api/v1/applications/:id/submit"}, // [已禁用] 已被 POST /tasks 取代 } routeMap := map[string]bool{} diff --git a/cmd/server/task_test.go b/cmd/server/task_test.go index e2ce2e1..9a6cb64 100644 --- a/cmd/server/task_test.go +++ b/cmd/server/task_test.go @@ -318,6 +318,8 @@ func TestTask_RetryScenario(t *testing.T) { task.Status, task.RetryCount, task.SlurmJobID) } +// [已禁用] 前端已全部迁移到 POST /tasks 接口,旧 API 兼容性测试不再需要。 +/* func TestTask_OldAPICompatibility(t *testing.T) { srv, _, cleanup := setupTaskTestServer(t) defer cleanup() @@ -352,6 +354,7 @@ func TestTask_OldAPICompatibility(t *testing.T) { t.Errorf("expected non-zero job_id, got %v", data["job_id"]) } } +*/ func TestTask_ListWithFilters(t *testing.T) { srv, taskStore, cleanup := setupTaskTestServer(t) diff --git a/internal/testutil/testenv/env_test.go b/internal/testutil/testenv/env_test.go index 95211e4..81c3d0f 100644 --- a/internal/testutil/testenv/env_test.go +++ b/internal/testutil/testenv/env_test.go @@ -64,7 +64,7 @@ func TestAllRoutesRegistered(t *testing.T) { {"GET", "/api/v1/applications/1"}, {"PUT", "/api/v1/applications/1"}, {"DELETE", "/api/v1/applications/1"}, - {"POST", "/api/v1/applications/1/submit"}, + // {"POST", "/api/v1/applications/1/submit"}, // [已禁用] 已被 POST /tasks 取代 {"POST", "/api/v1/files/uploads"}, {"GET", "/api/v1/files/uploads/1"}, {"PUT", "/api/v1/files/uploads/1/chunks/0"}, @@ -82,7 +82,7 @@ func TestAllRoutesRegistered(t *testing.T) { {"GET", "/api/v1/tasks"}, } - if len(routes) != 31 { + if len(routes) != 30 { t.Fatalf("expected 31 routes, got %d", len(routes)) }