@@ -143,6 +143,78 @@ tests:
143143 performance :
144144 maxResponseTime : " 2000ms"
145145
146+ - it : " should respect maxBytes parameter and validate content structure"
147+ request :
148+ jsonrpc : " 2.0"
149+ id : " get-contents-maxbytes-length"
150+ method : " tools/call"
151+ params :
152+ name : " get_log_file_contents"
153+ arguments :
154+ filename : " jobs/ImportCatalog/Job-ImportCatalog-0987654321.log"
155+ maxBytes : 1000
156+ expect :
157+ response :
158+ jsonrpc : " 2.0"
159+ id : " get-contents-maxbytes-length"
160+ result :
161+ content :
162+ match:arrayElements :
163+ type : " text"
164+ text : " match:contains:Log File Contents:" # Should have header
165+ isError : false
166+ stderr : " toBeEmpty"
167+ performance :
168+ maxResponseTime : " 2000ms"
169+
170+ - it : " should handle small maxBytes parameter and include required headers"
171+ request :
172+ jsonrpc : " 2.0"
173+ id : " get-contents-small-maxbytes"
174+ method : " tools/call"
175+ params :
176+ name : " get_log_file_contents"
177+ arguments :
178+ filename : " jobs/ImportCatalog/Job-ImportCatalog-0987654321.log"
179+ maxBytes : 100
180+ expect :
181+ response :
182+ jsonrpc : " 2.0"
183+ id : " get-contents-small-maxbytes"
184+ result :
185+ content :
186+ match:arrayElements :
187+ type : " text"
188+ text : " match:contains:Log File Contents:" # Should still have header even with small maxBytes
189+ isError : false
190+ stderr : " toBeEmpty"
191+ performance :
192+ maxResponseTime : " 2000ms"
193+
194+ - it : " should handle large maxBytes parameter and include content details"
195+ request :
196+ jsonrpc : " 2.0"
197+ id : " get-contents-large-maxbytes"
198+ method : " tools/call"
199+ params :
200+ name : " get_log_file_contents"
201+ arguments :
202+ filename : " jobs/ImportCatalog/Job-ImportCatalog-0987654321.log"
203+ maxBytes : 10000
204+ expect :
205+ response :
206+ jsonrpc : " 2.0"
207+ id : " get-contents-large-maxbytes"
208+ result :
209+ content :
210+ match:arrayElements :
211+ type : " text"
212+ text : " match:contains:Content size:" # Should have substantial content
213+ isError : false
214+ stderr : " toBeEmpty"
215+ performance :
216+ maxResponseTime : " 2000ms"
217+
146218 - it : " should work with tailOnly parameter"
147219 request :
148220 jsonrpc : " 2.0"
@@ -153,6 +225,7 @@ tests:
153225 arguments :
154226 filename : " jobs/ImportCatalog/Job-ImportCatalog-0987654321.log"
155227 tailOnly : true
228+ maxBytes : 10
156229 expect :
157230 response :
158231 jsonrpc : " 2.0"
@@ -192,6 +265,31 @@ tests:
192265 performance :
193266 maxResponseTime : " 2000ms"
194267
268+ - it : " should respect maxBytes limit when combined with tailOnly and validate structure"
269+ request :
270+ jsonrpc : " 2.0"
271+ id : " get-contents-combined-length"
272+ method : " tools/call"
273+ params :
274+ name : " get_log_file_contents"
275+ arguments :
276+ filename : " jobs/ImportCatalog/Job-ImportCatalog-0987654321.log"
277+ maxBytes : 500
278+ tailOnly : true
279+ expect :
280+ response :
281+ jsonrpc : " 2.0"
282+ id : " get-contents-combined-length"
283+ result :
284+ content :
285+ match:arrayElements :
286+ type : " text"
287+ text : " match:contains:Total lines:" # Should have content with line count
288+ isError : false
289+ stderr : " toBeEmpty"
290+ performance :
291+ maxResponseTime : " 2000ms"
292+
195293 # Error handling tests
196294 - it : " should handle non-existent file gracefully"
197295 request :
@@ -350,6 +448,79 @@ tests:
350448 performance :
351449 maxResponseTime : " 2000ms"
352450
451+ # Edge case tests for maxBytes string length validation
452+ - it : " should handle zero maxBytes parameter and return error"
453+ request :
454+ jsonrpc : " 2.0"
455+ id : " get-contents-zero-maxbytes"
456+ method : " tools/call"
457+ params :
458+ name : " get_log_file_contents"
459+ arguments :
460+ filename : " jobs/ImportCatalog/Job-ImportCatalog-0987654321.log"
461+ maxBytes : 0
462+ expect :
463+ response :
464+ jsonrpc : " 2.0"
465+ id : " get-contents-zero-maxbytes"
466+ result :
467+ content :
468+ match:arrayElements :
469+ type : " text"
470+ text : " match:contains:Invalid maxBytes" # Should return validation error
471+ isError : true
472+ stderr : " toBeEmpty"
473+ performance :
474+ maxResponseTime : " 2000ms"
475+
476+ - it : " should handle very small maxBytes parameter and include headers"
477+ request :
478+ jsonrpc : " 2.0"
479+ id : " get-contents-tiny-maxbytes"
480+ method : " tools/call"
481+ params :
482+ name : " get_log_file_contents"
483+ arguments :
484+ filename : " jobs/ImportCatalog/Job-ImportCatalog-0987654321.log"
485+ maxBytes : 10
486+ expect :
487+ response :
488+ jsonrpc : " 2.0"
489+ id : " get-contents-tiny-maxbytes"
490+ result :
491+ content :
492+ match:arrayElements :
493+ type : " text"
494+ text : " \" # Log File Contents: jobs/ImportCatalog/Job-ImportCatalog-0987654321.log (full read)\\ n\\ nTotal lines: 1\\ nContent size: 10 bytes\\ n\\ n---\\ n\\ n[2025-09-1\" " # Should have minimal content with headers
495+ isError : false
496+ stderr : " toBeEmpty"
497+ performance :
498+ maxResponseTime : " 2000ms"
499+
500+ - it : " should validate content quality scales with larger maxBytes parameter"
501+ request :
502+ jsonrpc : " 2.0"
503+ id : " get-contents-scaling-maxbytes"
504+ method : " tools/call"
505+ params :
506+ name : " get_log_file_contents"
507+ arguments :
508+ filename : " jobs/ImportCatalog/Job-ImportCatalog-0987654321.log"
509+ maxBytes : 2000
510+ expect :
511+ response :
512+ jsonrpc : " 2.0"
513+ id : " get-contents-scaling-maxbytes"
514+ result :
515+ content :
516+ match:arrayElements :
517+ type : " text"
518+ text : " match:contains:INFO" # Should have substantial log content with log entries
519+ isError : false
520+ stderr : " toBeEmpty"
521+ performance :
522+ maxResponseTime : " 2000ms"
523+
353524 # Edge case tests
354525 - it : " should handle numeric maxBytes parameter"
355526 request :
@@ -360,7 +531,7 @@ tests:
360531 name : " get_log_file_contents"
361532 arguments :
362533 filename : " jobs/ImportCatalog/Job-ImportCatalog-0987654321.log"
363- maxBytes : 1000
534+ maxBytes : 20
364535 expect :
365536 response :
366537 jsonrpc : " 2.0"
@@ -369,7 +540,7 @@ tests:
369540 content :
370541 match:arrayElements :
371542 type : " text"
372- text : " match:type:string "
543+ text : " \" # Log File Contents: jobs/ImportCatalog/Job-ImportCatalog-0987654321.log (full read) \\ n \\ nTotal lines: 1 \\ nContent size: 20 bytes \\ n \\ n--- \\ n \\ n[2025-09-14 17:18:55 \" "
373544 isError : false
374545 stderr : " toBeEmpty"
375546 performance :
0 commit comments