Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bio-rd
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
bio-rd
Commits
c27a029b
Commit
c27a029b
authored
6 years ago
by
Oliver Herms
Browse files
Options
Downloads
Patches
Plain Diff
Fixing client manager
parent
c92109a9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
route/route.go
+1
-1
1 addition, 1 deletion
route/route.go
routingtable/client_manager.go
+2
-1
2 additions, 1 deletion
routingtable/client_manager.go
routingtable/client_manager_test.go
+66
-0
66 additions, 0 deletions
routingtable/client_manager_test.go
with
69 additions
and
2 deletions
route/route.go
+
1
−
1
View file @
c27a029b
...
...
@@ -80,7 +80,7 @@ func (r *Route) AddPath(p *Path) {
r
.
paths
=
append
(
r
.
paths
,
p
)
}
// RemovePath removes path `
rm
` from route `r`. Returns length of path list after removing path `rm`
// RemovePath removes path `
p
` from route `r`. Returns length of path list after removing path `rm`
func
(
r
*
Route
)
RemovePath
(
p
*
Path
)
int
{
if
p
==
nil
{
return
len
(
r
.
paths
)
...
...
This diff is collapsed.
Click to expand it.
routingtable/client_manager.go
+
2
−
1
View file @
c27a029b
...
...
@@ -32,7 +32,8 @@ func (c *ClientManager) Unregister(client RouteTableClient) {
}
// Clients returns a list of registered clients
func
(
c
*
ClientManager
)
Clients
()
(
ret
[]
RouteTableClient
)
{
func
(
c
*
ClientManager
)
Clients
()
[]
RouteTableClient
{
ret
:=
make
([]
RouteTableClient
,
0
)
for
rtc
:=
range
c
.
clients
{
ret
=
append
(
ret
,
rtc
)
}
...
...
This diff is collapsed.
Click to expand it.
routingtable/client_manager_test.go
0 → 100644
+
66
−
0
View file @
c27a029b
package
routingtable
import
(
"testing"
"github.com/stretchr/testify/assert"
"github.com/bio-routing/bio-rd/net"
"github.com/bio-routing/bio-rd/route"
)
type
MockClient
struct
{
foo
int
}
func
(
m
MockClient
)
AddPath
(
net
.
Prefix
,
*
route
.
Path
)
error
{
return
nil
}
func
(
m
MockClient
)
RemovePath
(
net
.
Prefix
,
*
route
.
Path
)
bool
{
return
false
}
func
(
m
MockClient
)
UpdateNewClient
(
RouteTableClient
)
error
{
return
nil
}
func
TestClients
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
name
string
clients
[]
MockClient
expected
[]
RouteTableClient
}{
{
name
:
"No clients"
,
clients
:
[]
MockClient
{},
expected
:
[]
RouteTableClient
{},
},
{
name
:
"No clients"
,
clients
:
[]
MockClient
{
MockClient
{
foo
:
1
,
},
MockClient
{
foo
:
2
,
},
},
expected
:
[]
RouteTableClient
{
MockClient
{
foo
:
1
,
},
MockClient
{
foo
:
2
,
},
},
},
}
for
_
,
test
:=
range
tests
{
cm
:=
NewClientManager
(
MockClient
{})
for
_
,
client
:=
range
test
.
clients
{
cm
.
Register
(
client
)
}
ret
:=
cm
.
Clients
()
assert
.
Equal
(
t
,
test
.
expected
,
ret
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment