@@ -43,23 +43,29 @@ func (s *NodesSuite) TestNodesLog() {
4343 }` ))
4444 return
4545 }
46- // Get Empty Log response
47- if req .URL .Path == "/api/v1/nodes/existing-node/proxy/logs/empty.log" {
48- w .Header ().Set ("Content-Type" , "text/plain" )
49- w .WriteHeader (http .StatusOK )
50- _ , _ = w .Write ([]byte (`` ))
51- return
52- }
53- // Get Kubelet Log response
54- if req .URL .Path == "/api/v1/nodes/existing-node/proxy/logs/kubelet.log" {
55- w .Header ().Set ("Content-Type" , "text/plain" )
56- w .WriteHeader (http .StatusOK )
57- logContent := "Line 1\n Line 2\n Line 3\n Line 4\n Line 5\n "
58- if req .URL .Query ().Get ("tailLines" ) != "" {
59- logContent = "Line 4\n Line 5\n "
46+ // Check for log proxy requests based on path and query parameters
47+ if req .URL .Path == "/api/v1/nodes/existing-node/proxy/logs" {
48+ logPath := req .URL .Query ().Get ("query" )
49+
50+ // Get Empty Log response
51+ if logPath == "empty.log" {
52+ w .Header ().Set ("Content-Type" , "text/plain" )
53+ w .WriteHeader (http .StatusOK )
54+ _ , _ = w .Write ([]byte (`` ))
55+ return
56+ }
57+
58+ // Get Kubelet Log response
59+ if logPath == "kubelet.log" {
60+ w .Header ().Set ("Content-Type" , "text/plain" )
61+ w .WriteHeader (http .StatusOK )
62+ logContent := "Line 1\n Line 2\n Line 3\n Line 4\n Line 5\n "
63+ if req .URL .Query ().Get ("tailLines" ) != "" {
64+ logContent = "Line 4\n Line 5\n "
65+ }
66+ _ , _ = w .Write ([]byte (logContent ))
67+ return
6068 }
61- _ , _ = w .Write ([]byte (logContent ))
62- return
6369 }
6470 w .WriteHeader (http .StatusNotFound )
6571 }))
0 commit comments