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
c8db6d4a
Commit
c8db6d4a
authored
2 years ago
by
Fabian Seidl
Browse files
Options
Downloads
Patches
Plain Diff
added test for pnd delete
parent
1df16fbf
No related branches found
No related tags found
No related merge requests found
Pipeline
#144769
passed
2 years ago
Stage: build
Stage: test
Stage: analyze
Stage: integration-test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
controller/northbound/server/pnd_test.go
+45
-0
45 additions, 0 deletions
controller/northbound/server/pnd_test.go
with
45 additions
and
0 deletions
controller/northbound/server/pnd_test.go
+
45
−
0
View file @
c8db6d4a
...
@@ -231,6 +231,51 @@ func Test_Pnd_GetPndList(t *testing.T) {
...
@@ -231,6 +231,51 @@ func Test_Pnd_GetPndList(t *testing.T) {
}
}
}
}
func
Test_Pnd_DeletePnd
(
t
*
testing
.
T
)
{
deleteUUID
:=
uuid
.
NewString
()
type
args
struct
{
ctx
context
.
Context
request
*
ppb
.
DeletePndRequest
}
tests
:=
[]
struct
{
name
string
args
args
want
ppb
.
Status
wantErr
bool
}{
{
name
:
"delete"
,
args
:
args
{
ctx
:
context
.
Background
(),
request
:
&
ppb
.
DeletePndRequest
{
Timestamp
:
time
.
Now
()
.
UnixNano
(),
Pid
:
deleteUUID
,
},
},
want
:
ppb
.
Status_STATUS_OK
,
},
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
s
:=
getTestPndServer
(
t
)
_
=
s
.
pndService
.
Add
(
nucleus
.
NewPND
(
uuid
.
MustParse
(
deleteUUID
),
"toBeDeleted"
,
"something something delete"
))
resp
,
err
:=
s
.
DeletePnd
(
tt
.
args
.
ctx
,
tt
.
args
.
request
)
if
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"pnd.GetPndList() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
return
}
pnds
,
_
:=
s
.
pndService
.
GetAll
()
if
tt
.
want
!=
resp
.
Status
||
len
(
pnds
)
!=
1
{
t
.
Errorf
(
"pnd.DeletePnd() = %v, %v, want %v, %v"
,
resp
.
Status
,
len
(
pnds
),
tt
.
want
,
1
)
}
})
}
}
// func getTestPndServer(t *testing.T) *PndServer {
// func getTestPndServer(t *testing.T) *PndServer {
// var err error
// var err error
// pndUUID, err = uuid.Parse(pndID)
// pndUUID, err = uuid.Parse(pndID)
...
...
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