diff options
author | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-08-06 22:03:01 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-08-06 22:05:09 +0900 |
commit | d9fc69e50aaf7783a845b721f51931eff2069a4b (patch) | |
tree | 34dd1297bc7027420ffa4da37898e13ee6497815 /pkg | |
parent | a22f8cb4c77f3f8ba9f7206b50ba13be09c6164f (diff) |
server: add addpath api leak test
test uuid map leak with implict withdraw.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/server/server_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
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) } |