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

Function TestGenerateDropScript

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

Source from the content-addressed store, hash-verified

111}
112
113func TestGenerateDropScript(t *testing.T) {
114 config := TraceConfig{
115 EnableDrops: true,
116 EnableRST: true,
117 EnableErrors: true,
118 EnableRetransmits: true,
119 }
120
121 gen := NewScriptGenerator(config)
122 script := gen.Generate()
123
124 // Verify script structure
125 if !strings.Contains(script, "#!/usr/bin/env bpftrace") {
126 t.Error("script missing shebang")
127 }
128 if !strings.Contains(script, "tracepoint:skb:kfree_skb") {
129 t.Error("script missing kfree_skb tracepoint")
130 }
131 if !strings.Contains(script, "BEGIN {") {
132 t.Error("script missing BEGIN block")
133 }
134 if !strings.Contains(script, "END {") {
135 t.Error("script missing END block")
136 }
137 if !strings.Contains(script, "$reason") {
138 t.Error("script missing reason variable")
139 }
140 if !strings.Contains(script, "DROP") {
141 t.Error("script missing DROP output")
142 }
143}
144
145func TestGenerateDropScriptNoFilter(t *testing.T) {
146 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