MCPcopy
hub / github.com/microsoft/retina / TestGenerateNfqueueDropProbe

Function TestGenerateNfqueueDropProbe

shell/tracescript_test.go:509–554  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

507}
508
509func TestGenerateNfqueueDropProbe(t *testing.T) {
510 config := TraceConfig{
511 EnableNfqueueDrops: true,
512 }
513
514 gen := NewScriptGenerator(config)
515 script := gen.Generate()
516
517 // Verify fexit probe is present
518 if !strings.Contains(script, "fexit:vmlinux:__nf_queue") {
519 t.Error("script missing fexit:vmlinux:__nf_queue probe")
520 }
521
522 // Verify it checks return value
523 if !strings.Contains(script, "retval") {
524 t.Error("script missing retval check")
525 }
526
527 // Verify it accesses args->skb
528 if !strings.Contains(script, "args->skb") {
529 t.Error("script missing args->skb access")
530 }
531
532 // Verify it reads queue number
533 if !strings.Contains(script, "args->queuenum") {
534 t.Error("script missing args->queuenum access")
535 }
536
537 // Verify NFQ_DROP event type in table output
538 if !strings.Contains(script, "NFQ_DROP") {
539 t.Error("script missing NFQ_DROP event type")
540 }
541
542 // Verify __nf_queue probe name in output
543 if !strings.Contains(script, "__nf_queue") {
544 t.Error("script missing __nf_queue probe name in output")
545 }
546
547 // Verify errno decoding
548 if !strings.Contains(script, "ESRCH") {
549 t.Error("script missing ESRCH errno name")
550 }
551 if !strings.Contains(script, "ENOMEM") {
552 t.Error("script missing ENOMEM errno name")
553 }
554}
555
556func TestGenerateNfqueueDropProbeJSON(t *testing.T) {
557 config := TraceConfig{

Callers

nothing calls this directly

Calls 4

GenerateMethod · 0.95
NewScriptGeneratorFunction · 0.85
ContainsMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected