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

Function TestGenerateNfqueueDropProbeJSON

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

Source from the content-addressed store, hash-verified

554}
555
556func TestGenerateNfqueueDropProbeJSON(t *testing.T) {
557 config := TraceConfig{
558 EnableNfqueueDrops: true,
559 OutputJSON: true,
560 }
561
562 gen := NewScriptGenerator(config)
563 script := gen.Generate()
564
565 // Verify JSON output fields
566 if !strings.Contains(script, `\"type\":\"NFQ_DROP\"`) {
567 t.Error("JSON script missing NFQ_DROP type field")
568 }
569 if !strings.Contains(script, `\"queue\"`) {
570 t.Error("JSON script missing queue field")
571 }
572 if !strings.Contains(script, `\"errno\"`) {
573 t.Error("JSON script missing errno field")
574 }
575 if !strings.Contains(script, `\"probe\":\"__nf_queue\"`) {
576 t.Error("JSON script missing __nf_queue probe field")
577 }
578}
579
580func TestGenerateNfqueueDropProbeWithIPFilter(t *testing.T) {
581 ip := net.ParseIP("10.0.0.1")

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