Skip to content

Commit 65e37ee

Browse files
ivanmatmatioktalz
authored andcommitted
TEST: make mapupdate test resilient to starting number of maps entries
1 parent 528e70a commit 65e37ee

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

deploy/tests/e2e/map-updates/update_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,23 @@ import (
2424

2525
func (suite *MapUpdateSuite) Test_Update() {
2626
suite.Run("Update", func() {
27-
suite.tmplData.Paths = make([]string, 0, 700)
28-
for i := 0; i < 700; i++ {
27+
n := 700
28+
suite.tmplData.Paths = make([]string, 0, n)
29+
for i := 0; i < n; i++ {
2930
suite.tmplData.Paths = append(suite.tmplData.Paths, strconv.Itoa(i))
3031
}
3132
oldInfo, err := e2e.GetGlobalHAProxyInfo()
33+
oldCount, err := e2e.GetHAProxyMapCount("path-prefix")
3234
suite.NoError(err)
3335
suite.NoError(suite.test.Apply("config/ingress.yaml.tmpl", suite.test.GetNS(), suite.tmplData))
3436
suite.Require().Eventually(func() bool {
3537
newInfo, err := e2e.GetGlobalHAProxyInfo()
3638
suite.NoError(err)
3739
count, err := e2e.GetHAProxyMapCount("path-prefix")
3840
suite.NoError(err)
39-
suite.T().Logf("oldInfo.Pid(%s) == newInfo.Pid(%s) && count(%d) == 702", oldInfo.Pid, newInfo.Pid, count)
40-
return oldInfo.Pid == newInfo.Pid && count == 702 // 700 + default_http-echo_http + pprof
41+
numOfAddedEntries := count - oldCount + 1 // We add one because there's already an entry at the begining which will be removed
42+
suite.T().Logf("oldInfo.Pid(%s) == newInfo.Pid(%s) && additional path-prefix.count(%d) == %d", oldInfo.Pid, newInfo.Pid, numOfAddedEntries, n)
43+
return oldInfo.Pid == newInfo.Pid && numOfAddedEntries == n
4144
}, e2e.WaitDuration, e2e.TickDuration)
4245
})
4346
}

0 commit comments

Comments
 (0)