Skip to content

Commit a4e322b

Browse files
Use more routes and expect the stress test to hit the hard cap
Each router should cap at 10 conflicts. Use more routes to get more potentially conflicting writes.
1 parent 617e2c2 commit a4e322b

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

pkg/router/controller/router_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func (c *RouterController) Commit() {
234234

235235
// processRoute logs and propagates a route event to the plugin
236236
func (c *RouterController) processRoute(eventType watch.EventType, route *routeapi.Route) {
237-
glog.V(4).Infof("Processing Route: %s/%s -> %s", route.Namespace, route.Name, route.Spec.To.Name)
237+
glog.V(4).Infof("Processing route: %s/%s -> %s %s", route.Namespace, route.Name, route.Spec.To.Name, route.UID)
238238
glog.V(4).Infof(" Alias: %s", route.Spec.Host)
239239
if len(route.Spec.Path) > 0 {
240240
glog.V(4).Infof(" Path: %s", route.Spec.Path)

pkg/router/controller/status.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ type SimpleContentionTracker struct {
313313
func NewSimpleContentionTracker(interval time.Duration) *SimpleContentionTracker {
314314
return &SimpleContentionTracker{
315315
expires: interval,
316-
maxContentions: 10,
316+
maxContentions: 5,
317317

318318
ids: make(map[string]trackerElement),
319319
}
@@ -397,7 +397,7 @@ func (t *SimpleContentionTracker) IsContended(id string, now time.Time, ingress
397397

398398
// if the object is contended, exit early
399399
if last.state == stateContended {
400-
glog.V(4).Infof("Object %s is being written to by another actor", id)
400+
glog.V(4).Infof("Object %s is being contended by another writer", id)
401401
return true
402402
}
403403

@@ -408,6 +408,7 @@ func (t *SimpleContentionTracker) IsContended(id string, now time.Time, ingress
408408
state: stateContended,
409409
}
410410
t.contentions++
411+
glog.V(4).Infof("Object %s was previously correct and is now incorrect", id)
411412
return true
412413
}
413414

test/extended/router/stress.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ var _ = g.Describe("[Conformance][Area:Networking][Feature:Router]", func() {
160160
break Wait
161161
}
162162
}
163-
o.Expect(writes).To(o.BeNumerically("<", 10))
163+
o.Expect(writes).To(o.BeNumerically("<=", 10))
164164

165165
verifyCommandEquivalent(oc.KubeClient(), rs, "md5sum /var/lib/haproxy/conf/*")
166166
})
@@ -174,7 +174,8 @@ var _ = g.Describe("[Conformance][Area:Networking][Feature:Router]", func() {
174174
[]string{
175175
"--loglevel=4",
176176
fmt.Sprintf("--namespace=%s", ns),
177-
"--resync-interval=2m",
177+
// the contention tracker is resync / 10, so this will give us 2 minutes of contention tracking
178+
"--resync-interval=20m",
178179
"--name=conflicting",
179180
"--override-hostname",
180181
// causes each pod to have a different value
@@ -189,7 +190,7 @@ var _ = g.Describe("[Conformance][Area:Networking][Feature:Router]", func() {
189190
g.By("creating multiple routes")
190191
client := routeclientset.NewForConfigOrDie(oc.AdminConfig()).Route().Routes(ns)
191192
var rv string
192-
for i := 0; i < 10; i++ {
193+
for i := 0; i < 20; i++ {
193194
_, err := client.Create(&routev1.Route{
194195
ObjectMeta: metav1.ObjectMeta{
195196
Name: fmt.Sprintf("%d", i),
@@ -210,7 +211,7 @@ var _ = g.Describe("[Conformance][Area:Networking][Feature:Router]", func() {
210211
if err != nil {
211212
return false, err
212213
}
213-
o.Expect(routes.Items).To(o.HaveLen(10))
214+
o.Expect(routes.Items).To(o.HaveLen(20))
214215
other := 0
215216
conflicting := 0
216217
for _, route := range routes.Items {
@@ -233,7 +234,7 @@ var _ = g.Describe("[Conformance][Area:Networking][Feature:Router]", func() {
233234
}
234235
// if other routers are writing status, wait until we get a complete
235236
// set since we don't have a way to tell other routers to ignore us
236-
if conflicting < 3 && other%10 != 0 {
237+
if conflicting < 3 && other%20 != 0 {
237238
return false, nil
238239
}
239240
outputIngress(routes.Items...)
@@ -248,7 +249,7 @@ var _ = g.Describe("[Conformance][Area:Networking][Feature:Router]", func() {
248249
o.Expect(err).NotTo(o.HaveOccurred())
249250
func() {
250251
defer w.Stop()
251-
timer := time.NewTimer(10 * time.Second)
252+
timer := time.NewTimer(15 * time.Second)
252253
ch := w.ResultChan()
253254
Wait:
254255
for i := 0; ; i++ {
@@ -260,7 +261,8 @@ var _ = g.Describe("[Conformance][Area:Networking][Feature:Router]", func() {
260261
break Wait
261262
}
262263
}
263-
o.Expect(writes).To(o.BeNumerically("<", 10))
264+
// we expect to see no more than 10 writes per router (we should hit the hard limit)
265+
o.Expect(writes).To(o.BeNumerically("<", 30))
264266
}()
265267

266268
// the os_http_be.map file will vary, so only check the haproxy config

0 commit comments

Comments
 (0)