Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
goSDN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
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
goSDN
Commits
7923de92
Commit
7923de92
authored
3 years ago
by
Fabian Seidl
Browse files
Options
Downloads
Patches
Plain Diff
fixed get Pnd test to fit new api
parent
be26ce24
No related branches found
No related tags found
1 merge request
!238
Stfaseid http refactor
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
northbound/server/pnd_test.go
+48
-52
48 additions, 52 deletions
northbound/server/pnd_test.go
with
48 additions
and
52 deletions
northbound/server/pnd_test.go
+
48
−
52
View file @
7923de92
package
server
package
server
import
(
import
(
"context"
"os"
"os"
"reflect"
"testing"
"testing"
"time"
"time"
pb
"code.fbi.h-da.de/danet/api/go/gosdn/core"
ppb
"code.fbi.h-da.de/danet/api/go/gosdn/pnd"
ppb
"code.fbi.h-da.de/danet/api/go/gosdn/pnd"
spb
"code.fbi.h-da.de/danet/api/go/gosdn/southbound"
spb
"code.fbi.h-da.de/danet/api/go/gosdn/southbound"
"code.fbi.h-da.de/danet/api/go/gosdn/transport"
"code.fbi.h-da.de/danet/api/go/gosdn/transport"
...
@@ -171,59 +174,52 @@ func TestMain(m *testing.M) {
...
@@ -171,59 +174,52 @@ func TestMain(m *testing.M) {
func
Test_pnd_Get
(
t
*
testing
.
T
)
{
func
Test_pnd_Get
(
t
*
testing
.
T
)
{
removeExistingStores
()
removeExistingStores
()
// type args struct {
type
args
struct
{
// ctx context.Context
ctx
context
.
Context
// request *ppb.GetRequest
request
*
pb
.
GetPndRequest
// }
}
// tests := []struct {
tests
:=
[]
struct
{
// name string
name
string
// args args
args
args
// want []string
want
pb
.
GetPndResponse
// wantErr bool
wantErr
bool
// }{
}{
// {
{
// name: "get pnd",
name
:
"get pnd"
,
// args: args{
args
:
args
{
// ctx: context.Background(),
ctx
:
context
.
Background
(),
// request: &ppb.GetRequest{
request
:
&
pb
.
GetPndRequest
{
// Request: &ppb.GetRequest_Pnd{
Pid
:
[]
string
{
// Pnd: &ppb.GetPnd{},
pndID
},
// },
},
// Pid: pndID,
},
// },
want
:
pb
.
GetPndResponse
{
// },
Pnd
:
[]
*
ppb
.
PrincipalNetworkDomain
{
// want: []string{
{
Id
:
pndID
,
// pndID,
Name
:
"test"
,
// ondID,
Description
:
"test"
},
// sbiID,
},
// // pendingChangeID,
},
// // committedChangeID,
},
// },
}
// },
for
_
,
tt
:=
range
tests
{
// }
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
// for _, tt := range tests {
p
:=
core
{
// t.Run(tt.name, func(t *testing.T) {
UnimplementedCoreServiceServer
:
pb
.
UnimplementedCoreServiceServer
{},
// p := pndServer{
}
// UnimplementedPndServiceServer: ppb.UnimplementedPndServiceServer{},
resp
,
err
:=
p
.
GetPnd
(
tt
.
args
.
ctx
,
tt
.
args
.
request
)
// }
if
(
err
!=
nil
)
!=
tt
.
wantErr
{
// resp, err := p.Get(tt.args.ctx, tt.args.request)
t
.
Errorf
(
"Get() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
// if (err != nil) != tt.wantErr {
return
// t.Errorf("Get() error = %v, wantErr %v", err, tt.wantErr)
}
// return
// }
// got := []string{
got
:=
resp
.
GetPnd
()
// resp.Pnd.Id,
// resp.Pnd.Ond[0].Id,
if
!
reflect
.
DeepEqual
(
got
,
tt
.
want
.
Pnd
)
{
// resp.Pnd.Sbi[0].Id,
t
.
Errorf
(
"Get() got = %v, want %v"
,
got
,
tt
.
want
.
Pnd
)
// // resp.Pnd.Change[0].Id,
}
// // resp.Pnd.Change[1].Id,
})
// }
}
// if !reflect.DeepEqual(got, tt.want) {
// t.Errorf("Get() got = %v, want %v", got, tt.want)
// }
// })
// }
}
}
func
Test_pnd_Set
(
t
*
testing
.
T
)
{
func
Test_pnd_Set
(
t
*
testing
.
T
)
{
...
...
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