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
6d5dbf0b
Commit
6d5dbf0b
authored
6 years ago
by
Daniel Czerwonk
Browse files
Options
Downloads
Patches
Plain Diff
fixed bug in term processing
parent
86f17a1f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
routingtable/filter/term_test.go
+16
-16
16 additions, 16 deletions
routingtable/filter/term_test.go
with
16 additions
and
16 deletions
routingtable/filter/term_test.go
+
16
−
16
View file @
6d5dbf0b
...
@@ -12,11 +12,11 @@ import (
...
@@ -12,11 +12,11 @@ import (
type
mockAction
struct
{
type
mockAction
struct
{
}
}
func
(
*
mockAction
)
Do
(
p
net
.
Prefix
,
pa
*
route
.
Path
)
(
*
route
.
Path
,
bool
)
{
func
(
*
mockAction
)
Do
(
p
net
.
Prefix
,
pa
*
route
.
Path
)
actions
.
Result
{
cp
:=
*
pa
cp
:=
*
pa
cp
.
Type
=
route
.
OSPFPathType
cp
.
Type
=
route
.
OSPFPathType
return
&
cp
,
false
return
actions
.
Result
{
Path
:
&
cp
}
}
}
func
TestProcess
(
t
*
testing
.
T
)
{
func
TestProcess
(
t
*
testing
.
T
)
{
...
@@ -25,7 +25,7 @@ func TestProcess(t *testing.T) {
...
@@ -25,7 +25,7 @@ func TestProcess(t *testing.T) {
prefix
net
.
Prefix
prefix
net
.
Prefix
path
*
route
.
Path
path
*
route
.
Path
from
[]
*
TermCondition
from
[]
*
TermCondition
then
[]
Filter
Action
then
[]
Action
expectReject
bool
expectReject
bool
expectModified
bool
expectModified
bool
}{
}{
...
@@ -34,7 +34,7 @@ func TestProcess(t *testing.T) {
...
@@ -34,7 +34,7 @@ func TestProcess(t *testing.T) {
prefix
:
net
.
NewPfx
(
net
.
IPv4FromOctets
(
100
,
64
,
0
,
1
),
8
),
prefix
:
net
.
NewPfx
(
net
.
IPv4FromOctets
(
100
,
64
,
0
,
1
),
8
),
path
:
&
route
.
Path
{},
path
:
&
route
.
Path
{},
from
:
[]
*
TermCondition
{},
from
:
[]
*
TermCondition
{},
then
:
[]
Filter
Action
{
then
:
[]
Action
{
&
actions
.
AcceptAction
{},
&
actions
.
AcceptAction
{},
},
},
expectReject
:
false
,
expectReject
:
false
,
...
@@ -48,7 +48,7 @@ func TestProcess(t *testing.T) {
...
@@ -48,7 +48,7 @@ func TestProcess(t *testing.T) {
NewTermConditionWithPrefixLists
(
NewTermConditionWithPrefixLists
(
NewPrefixList
(
net
.
NewPfx
(
net
.
IPv4FromOctets
(
100
,
64
,
0
,
1
),
8
))),
NewPrefixList
(
net
.
NewPfx
(
net
.
IPv4FromOctets
(
100
,
64
,
0
,
1
),
8
))),
},
},
then
:
[]
Filter
Action
{
then
:
[]
Action
{
&
actions
.
AcceptAction
{},
&
actions
.
AcceptAction
{},
},
},
expectReject
:
false
,
expectReject
:
false
,
...
@@ -62,7 +62,7 @@ func TestProcess(t *testing.T) {
...
@@ -62,7 +62,7 @@ func TestProcess(t *testing.T) {
NewTermConditionWithPrefixLists
(
NewTermConditionWithPrefixLists
(
NewPrefixList
(
net
.
NewPfx
(
net
.
IPv4
(
0
),
32
))),
NewPrefixList
(
net
.
NewPfx
(
net
.
IPv4
(
0
),
32
))),
},
},
then
:
[]
Filter
Action
{
then
:
[]
Action
{
&
actions
.
AcceptAction
{},
&
actions
.
AcceptAction
{},
},
},
expectReject
:
false
,
expectReject
:
false
,
...
@@ -76,7 +76,7 @@ func TestProcess(t *testing.T) {
...
@@ -76,7 +76,7 @@ func TestProcess(t *testing.T) {
NewTermConditionWithPrefixLists
(
NewTermConditionWithPrefixLists
(
NewPrefixList
(
net
.
NewPfx
(
net
.
IPv4FromOctets
(
100
,
64
,
0
,
1
),
8
))),
NewPrefixList
(
net
.
NewPfx
(
net
.
IPv4FromOctets
(
100
,
64
,
0
,
1
),
8
))),
},
},
then
:
[]
Filter
Action
{
then
:
[]
Action
{
&
mockAction
{},
&
mockAction
{},
},
},
expectReject
:
false
,
expectReject
:
false
,
...
@@ -90,7 +90,7 @@ func TestProcess(t *testing.T) {
...
@@ -90,7 +90,7 @@ func TestProcess(t *testing.T) {
NewTermConditionWithRouteFilters
(
NewTermConditionWithRouteFilters
(
NewRouteFilter
(
net
.
NewPfx
(
net
.
IPv4FromOctets
(
100
,
64
,
0
,
1
),
8
),
Exact
())),
NewRouteFilter
(
net
.
NewPfx
(
net
.
IPv4FromOctets
(
100
,
64
,
0
,
1
),
8
),
Exact
())),
},
},
then
:
[]
Filter
Action
{
then
:
[]
Action
{
&
mockAction
{},
&
mockAction
{},
&
actions
.
AcceptAction
{},
&
actions
.
AcceptAction
{},
},
},
...
@@ -109,7 +109,7 @@ func TestProcess(t *testing.T) {
...
@@ -109,7 +109,7 @@ func TestProcess(t *testing.T) {
},
},
},
},
},
},
then
:
[]
Filter
Action
{
then
:
[]
Action
{
&
actions
.
AcceptAction
{},
&
actions
.
AcceptAction
{},
},
},
expectReject
:
false
,
expectReject
:
false
,
...
@@ -118,18 +118,18 @@ func TestProcess(t *testing.T) {
...
@@ -118,18 +118,18 @@ func TestProcess(t *testing.T) {
}
}
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
t
.
Run
(
test
.
name
,
func
(
t
e
*
testing
.
T
)
{
t
.
Run
(
test
.
name
,
func
(
t
*
testing
.
T
)
{
term
:=
NewTerm
(
test
.
from
,
test
.
then
)
term
:=
NewTerm
(
test
.
from
,
test
.
then
)
pa
,
reject
:=
term
.
Process
(
test
.
prefix
,
test
.
path
)
res
:=
term
.
Process
(
test
.
prefix
,
test
.
path
)
assert
.
Equal
(
t
e
,
test
.
expectReject
,
reject
,
"reject"
)
assert
.
Equal
(
t
,
test
.
expectReject
,
re
s
.
Re
ject
,
"reject"
)
if
pa
!=
test
.
path
&&
!
test
.
expectModified
{
if
res
.
Path
!=
test
.
path
&&
!
test
.
expectModified
{
t
e
.
Fatal
(
"expected path to be not modified but was"
)
t
.
Fatal
(
"expected path to be not modified but was"
)
}
}
if
pa
==
test
.
path
&&
test
.
expectModified
{
if
res
.
Path
==
test
.
path
&&
test
.
expectModified
{
t
e
.
Fatal
(
"expected path to be modified but was same reference"
)
t
.
Fatal
(
"expected path to be modified but was same reference"
)
}
}
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
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