MCPcopy Create free account
hub / github.com/zalando/skipper / TestShadow

Function TestShadow

proxy/shadow_test.go:107–399  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

105}
106
107func TestShadow(t *testing.T) {
108 for _, tt := range []struct {
109 name string
110 routes string
111 timeout time.Duration
112 mainFunc func()
113 shadowFunc func()
114 check func(va *httptest.VegetaAttacker) error
115 debug bool
116 }{
117 {
118 name: "50%",
119 routes: `
120main: PathSubtree("/")
121 -> "%s";
122split: PathSubtree("/") && Traffic(0.5)
123 -> teeLoopback("test")
124 -> "%s";
125shadow: PathSubtree("/") && Tee("test") && True()
126 -> "%s";
127 `,
128 debug: true,
129 },
130 {
131 name: "50% with fifo",
132 routes: `
133main: PathSubtree("/")
134 -> fifo(10, 5, "1s")
135 -> "%s";
136split: PathSubtree("/") && Traffic(0.5)
137 -> fifo(10, 5, "1s")
138 -> teeLoopback("test")
139 -> "%s";
140shadow: PathSubtree("/") && Tee("test") && True()
141 -> fifo(10, 5, "1s")
142 -> "%s";
143 `,
144 debug: true,
145 },
146 {
147 name: "50% with fifo and slow shadow",
148 routes: `
149main: PathSubtree("/")
150 -> fifo(10, 5, "1s")
151 -> "%s";
152split: PathSubtree("/") && Traffic(0.5)
153 -> fifo(10, 5, "1s")
154 -> teeLoopback("test")
155 -> "%s";
156shadow: PathSubtree("/") && Tee("test") && True()
157 -> fifo(10, 5, "1s")
158 -> "%s";
159 `,
160 shadowFunc: func() { time.Sleep(500 * time.Millisecond) },
161 debug: true,
162 },
163 {
164 name: "50% with fifo and shadow times out",

Callers

nothing calls this directly

Calls 15

CountStatusMethod · 0.95
TotalRequestsMethod · 0.95
AttackMethod · 0.95
NewDocFunction · 0.92
NewFunction · 0.92
NewTrueFunction · 0.92
NewFunction · 0.92
NewVegetaAttackerFunction · 0.92
RegisterMethod · 0.80
NewMethod · 0.80
FirstLoadMethod · 0.80
WithParamsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…