From d9fc69e50aaf7783a845b721f51931eff2069a4b Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 6 Aug 2019 22:03:01 +0900 Subject: server: add addpath api leak test test uuid map leak with implict withdraw. Signed-off-by: FUJITA Tomonori --- pkg/server/server_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'pkg') diff --git a/pkg/server/server_test.go b/pkg/server/server_test.go index 31eb5414..ba1489f1 100644 --- a/pkg/server/server_test.go +++ b/pkg/server/server_test.go @@ -1411,4 +1411,32 @@ func TestAddDeletePath(t *testing.T) { assert.Nil(t, err) assert.Equal(t, len(listRib()), 0) assert.Equal(t, len(s.uuidMap), 0) + + r, err = s.AddPath(ctx, &api.AddPathRequest{ + TableType: api.TableType_GLOBAL, + Path: p2, + }) + assert.Nil(t, err) + assert.Equal(t, len(listRib()), 1) + assert.Equal(t, len(s.uuidMap), 1) + u := r.Uuid + + asPath, _ := ptypes.MarshalAny(&api.AsPathAttribute{ + Segments: []*api.AsSegment{ + { + Type: 1, // SET + Numbers: []uint32{100, 200, 300}, + }, + }, + }) + + p2.Pattrs = append(p2.Pattrs, asPath) + r, err = s.AddPath(ctx, &api.AddPathRequest{ + TableType: api.TableType_GLOBAL, + Path: p2, + }) + assert.Nil(t, err) + assert.Equal(t, len(listRib()), 1) + assert.Equal(t, len(s.uuidMap), 1) + assert.NotEqual(t, u, r.Uuid) } -- cgit v1.2.3