Skip to content

Commit bdfc95d

Browse files
committed
test: update TestHandleGetSandbox to expect 404 instead of 403 on namespace mismatch
Signed-off-by: Abhinav Singh <abhinavsingh717073@gmail.com>
1 parent e91c9cb commit bdfc95d

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/workloadmanager/handlers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ func (s *Server) handleGetSandbox(c *gin.Context, kind string) {
332332
_, userNamespace, _, _ := extractUserInfo(c)
333333
if sandboxInfo.SandboxNamespace != userNamespace {
334334
klog.Warningf("unauthorized GET attempt to session %s by user in namespace %s", sessionID, userNamespace)
335-
respondError(c, http.StatusForbidden, "access denied to this session")
335+
respondError(c, http.StatusNotFound, fmt.Sprintf("Session ID %s not found", sessionID))
336336
return
337337
}
338338
}

pkg/workloadmanager/handlers_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,8 @@ func TestHandleGetSandbox(t *testing.T) {
539539
SandboxNamespace: "victim-ns",
540540
Kind: types.AgentRuntimeKind,
541541
},
542-
expectStatus: http.StatusForbidden,
543-
expectMessage: "access denied to this session",
542+
expectStatus: http.StatusNotFound,
543+
expectMessage: "Session ID sess-auth-fail not found",
544544
},
545545
{
546546
name: "wrong kind",

0 commit comments

Comments
 (0)