Skip to content

Commit 6a62849

Browse files
committed
Add:support-evict-yarn-container
1 parent 3f9c3c2 commit 6a62849

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg/copilot-agent/server/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ func (y *YarnCopilotServer) KillContainer(ctx *gin.Context) {
168168
}
169169
container, err := y.mgr.GetContainer(kr.ContainerID)
170170
if err != nil {
171-
ctx.JSON(http.StatusBadRequest, err)
171+
ctx.JSON(http.StatusInternalServerError, err)
172172
return
173173
}
174174
if err := y.mgr.KillContainer(kr.ContainerID); err != nil {
175-
ctx.JSON(http.StatusBadRequest, err)
175+
ctx.JSON(http.StatusInternalServerError, err)
176176
return
177177
}
178178
ctx.JSON(http.StatusOK, KillInfo{Items: []*ContainerInfo{ParseContainerInfo(container, y.mgr)}})

pkg/copilot-agent/server/server_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,14 @@ func TestYarnCopilotServer_KillContainer(t *testing.T) {
233233
assert.Equal(t, "container_e517_1746198264116_5225_01_000003", killInfo.Items[0].Name)
234234

235235
// 测试错误情况
236-
mockMgr.err1 = assert.AnError
236+
mockMgr.err2 = assert.AnError
237237
w = httptest.NewRecorder()
238238
c, _ = gin.CreateTestContext(w)
239239
c.Request = httptest.NewRequest("POST", "/v1/killContainer", bytes.NewBuffer(body))
240240

241241
server.KillContainer(c)
242242

243-
assert.Equal(t, http.StatusBadRequest, w.Code)
243+
assert.Equal(t, http.StatusInternalServerError, w.Code)
244244
}
245245

246246
func TestYarnCopilotServer_KillContainersByResource(t *testing.T) {

0 commit comments

Comments
 (0)