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
26562af0
Commit
26562af0
authored
4 years ago
by
Manuel Kieweg
Browse files
Options
Downloads
Patches
Plain Diff
added tests to CI and removed unused go.mod entries
parent
8f44a697
No related branches found
No related tags found
2 merge requests
!101
Resolve "Increase test coverage"
,
!90
Develop
Pipeline
#65255
passed with warnings
4 years ago
Stage: test
Stage: deploy
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+2
-1
2 additions, 1 deletion
.gitlab-ci.yml
build/ci/.test.yml
+26
-0
26 additions, 0 deletions
build/ci/.test.yml
go.mod
+0
-3
0 additions, 3 deletions
go.mod
nucleus/southbound_test.go
+0
-248
0 additions, 248 deletions
nucleus/southbound_test.go
with
28 additions
and
252 deletions
.gitlab-ci.yml
+
2
−
1
View file @
26562af0
...
@@ -13,4 +13,5 @@ include:
...
@@ -13,4 +13,5 @@ include:
-
local
:
'
/build/ci/.code-quality-ci.yml'
-
local
:
'
/build/ci/.code-quality-ci.yml'
-
local
:
'
/build/ci/.documentation-ci.yml'
-
local
:
'
/build/ci/.documentation-ci.yml'
-
local
:
'
/build/ci/.security-and-compliance-ci.yml'
-
local
:
'
/build/ci/.security-and-compliance-ci.yml'
-
local
:
'
/build/ci/.build-container.yml'
-
local
:
'
/build/ci/.build-container.yml'
\ No newline at end of file
-
local
:
'
/build/ci/.test.yml'
\ No newline at end of file
This diff is collapsed.
Click to expand it.
build/ci/.test.yml
0 → 100644
+
26
−
0
View file @
26562af0
unit-test-master
:
image
:
golang/golang:1.14
stage
:
test
rules
:
-
if
:
$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
-
if
:
$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script
:
-
go test -coverprofile=coverage.txt -covermode count ./nucleus
-
gocover-cobertura < coverage.txt > coverage.xml
artifacts
:
reports
:
cobertura
:
coverage.xml
unit-test
:
image
:
golang/golang:1.14
stage
:
test
allow_failure
:
true
rules
:
-
if
:
$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH
script
:
-
go test -coverprofile=coverage.txt -covermode count ./nucleus
-
gocover-cobertura < coverage.txt > coverage.xml
artifacts
:
reports
:
cobertura
:
coverage.xml
This diff is collapsed.
Click to expand it.
go.mod
+
0
−
3
View file @
26562af0
...
@@ -6,7 +6,6 @@ require (
...
@@ -6,7 +6,6 @@ require (
code.fbi.h-da.de/cocsn/swagger/apis
v0.0.0-20200924152423-61030cab7b88
code.fbi.h-da.de/cocsn/swagger/apis
v0.0.0-20200924152423-61030cab7b88
code.fbi.h-da.de/cocsn/yang-models
v0.0.4
code.fbi.h-da.de/cocsn/yang-models
v0.0.4
github.com/aristanetworks/goarista
v0.0.0-20201120222254-94a892eb0c6a
github.com/aristanetworks/goarista
v0.0.0-20201120222254-94a892eb0c6a
github.com/gdamore/tcell/v2
v2.0.1-0.20201017141208-acf90d56d591
github.com/go-openapi/runtime
v0.19.22
github.com/go-openapi/runtime
v0.19.22
github.com/go-openapi/strfmt
v0.19.5
github.com/go-openapi/strfmt
v0.19.5
github.com/golang/glog
v0.0.0-20160126235308-23def4e6c14b
github.com/golang/glog
v0.0.0-20160126235308-23def4e6c14b
...
@@ -16,9 +15,7 @@ require (
...
@@ -16,9 +15,7 @@ require (
github.com/neo4j/neo4j-go-driver
v1.8.3
github.com/neo4j/neo4j-go-driver
v1.8.3
github.com/openconfig/gnmi
v0.0.0-20200617225440-d2b4e6a45802
github.com/openconfig/gnmi
v0.0.0-20200617225440-d2b4e6a45802
github.com/openconfig/goyang
v0.2.3
github.com/openconfig/goyang
v0.2.3
github.com/openconfig/reference
v0.0.0-20190727015836-8dfd928c9696
github.com/openconfig/ygot
v0.10.0
github.com/openconfig/ygot
v0.10.0
github.com/rivo/tview
v0.0.0-20201018122409-d551c850a743
github.com/sirupsen/logrus
v1.4.2
github.com/sirupsen/logrus
v1.4.2
github.com/spf13/viper
v1.7.1
github.com/spf13/viper
v1.7.1
github.com/stretchr/testify
v1.6.1
github.com/stretchr/testify
v1.6.1
...
...
This diff is collapsed.
Click to expand it.
nucleus/southbound_test.go
+
0
−
248
View file @
26562af0
package
nucleus
package
nucleus
import
(
gpb
"github.com/openconfig/gnmi/proto/gnmi"
"github.com/openconfig/goyang/pkg/yang"
"github.com/openconfig/ygot/ytypes"
"reflect"
"testing"
)
func
TestAristaOC_SbiIdentifier
(
t
*
testing
.
T
)
{
type
fields
struct
{
transport
Transport
schema
*
ytypes
.
Schema
}
tests
:=
[]
struct
{
name
string
fields
fields
want
string
}{
// TODO: Add test cases.
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
oc
:=
&
AristaOC
{
transport
:
tt
.
fields
.
transport
,
schema
:
tt
.
fields
.
schema
,
}
if
got
:=
oc
.
SbiIdentifier
();
got
!=
tt
.
want
{
t
.
Errorf
(
"SbiIdentifier() = %v, want %v"
,
got
,
tt
.
want
)
}
})
}
}
func
TestAristaOC_Schema
(
t
*
testing
.
T
)
{
type
fields
struct
{
transport
Transport
schema
*
ytypes
.
Schema
}
tests
:=
[]
struct
{
name
string
fields
fields
want
*
ytypes
.
Schema
}{
// TODO: Add test cases.
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
oc
:=
&
AristaOC
{
transport
:
tt
.
fields
.
transport
,
schema
:
tt
.
fields
.
schema
,
}
if
got
:=
oc
.
Schema
();
!
reflect
.
DeepEqual
(
got
,
tt
.
want
)
{
t
.
Errorf
(
"Schema() = %v, want %v"
,
got
,
tt
.
want
)
}
})
}
}
func
TestAristaOC_SetNode
(
t
*
testing
.
T
)
{
type
fields
struct
{
transport
Transport
schema
*
ytypes
.
Schema
}
tests
:=
[]
struct
{
name
string
fields
fields
want
func
(
schema
*
yang
.
Entry
,
root
interface
{},
path
*
gpb
.
Path
,
val
interface
{},
opts
...
ytypes
.
SetNodeOpt
)
error
}{
// TODO: Add test cases.
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
oc
:=
&
AristaOC
{
transport
:
tt
.
fields
.
transport
,
schema
:
tt
.
fields
.
schema
,
}
if
got
:=
oc
.
SetNode
();
!
reflect
.
DeepEqual
(
got
,
tt
.
want
)
{
t
.
Errorf
(
"SetNode() = %v, want %v"
,
got
,
tt
.
want
)
}
})
}
}
func
TestOpenConfig_SbiIdentifier
(
t
*
testing
.
T
)
{
type
fields
struct
{
transport
Transport
schema
*
ytypes
.
Schema
}
tests
:=
[]
struct
{
name
string
fields
fields
want
string
}{
// TODO: Add test cases.
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
oc
:=
&
OpenConfig
{
transport
:
tt
.
fields
.
transport
,
schema
:
tt
.
fields
.
schema
,
}
if
got
:=
oc
.
SbiIdentifier
();
got
!=
tt
.
want
{
t
.
Errorf
(
"SbiIdentifier() = %v, want %v"
,
got
,
tt
.
want
)
}
})
}
}
func
TestOpenConfig_Schema
(
t
*
testing
.
T
)
{
type
fields
struct
{
transport
Transport
schema
*
ytypes
.
Schema
}
tests
:=
[]
struct
{
name
string
fields
fields
want
*
ytypes
.
Schema
}{
// TODO: Add test cases.
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
oc
:=
&
OpenConfig
{
transport
:
tt
.
fields
.
transport
,
schema
:
tt
.
fields
.
schema
,
}
if
got
:=
oc
.
Schema
();
!
reflect
.
DeepEqual
(
got
,
tt
.
want
)
{
t
.
Errorf
(
"Schema() = %v, want %v"
,
got
,
tt
.
want
)
}
})
}
}
func
TestOpenConfig_SetNode
(
t
*
testing
.
T
)
{
type
fields
struct
{
transport
Transport
schema
*
ytypes
.
Schema
}
tests
:=
[]
struct
{
name
string
fields
fields
want
func
(
schema
*
yang
.
Entry
,
root
interface
{},
path
*
gpb
.
Path
,
val
interface
{},
opts
...
ytypes
.
SetNodeOpt
)
error
}{
// TODO: Add test cases.
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
oc
:=
&
OpenConfig
{
transport
:
tt
.
fields
.
transport
,
schema
:
tt
.
fields
.
schema
,
}
if
got
:=
oc
.
SetNode
();
!
reflect
.
DeepEqual
(
got
,
tt
.
want
)
{
t
.
Errorf
(
"SetNode() = %v, want %v"
,
got
,
tt
.
want
)
}
})
}
}
func
Test_sbiStorage_Sbi
(
t
*
testing
.
T
)
{
type
args
struct
{
name
string
}
tests
:=
[]
struct
{
name
string
s
sbiStorage
args
args
want
SouthboundInterface
wantErr
bool
}{
// TODO: Add test cases.
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
got
,
err
:=
tt
.
s
.
Sbi
(
tt
.
args
.
name
)
if
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"Sbi() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
return
}
if
!
reflect
.
DeepEqual
(
got
,
tt
.
want
)
{
t
.
Errorf
(
"Sbi() got = %v, want %v"
,
got
,
tt
.
want
)
}
})
}
}
func
Test_sbiStorage_add
(
t
*
testing
.
T
)
{
type
args
struct
{
sbi
SouthboundInterface
}
tests
:=
[]
struct
{
name
string
s
sbiStorage
args
args
wantErr
bool
}{
// TODO: Add test cases.
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
if
err
:=
tt
.
s
.
add
(
tt
.
args
.
sbi
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"add() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
}
})
}
}
func
Test_sbiStorage_delete
(
t
*
testing
.
T
)
{
type
args
struct
{
name
string
}
tests
:=
[]
struct
{
name
string
s
sbiStorage
args
args
wantErr
bool
}{
// TODO: Add test cases.
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
if
err
:=
tt
.
s
.
delete
(
tt
.
args
.
name
);
(
err
!=
nil
)
!=
tt
.
wantErr
{
t
.
Errorf
(
"delete() error = %v, wantErr %v"
,
err
,
tt
.
wantErr
)
}
})
}
}
func
Test_sbiStorage_exists
(
t
*
testing
.
T
)
{
type
args
struct
{
name
string
}
tests
:=
[]
struct
{
name
string
s
sbiStorage
args
args
want
bool
}{
// TODO: Add test cases.
}
for
_
,
tt
:=
range
tests
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
if
got
:=
tt
.
s
.
exists
(
tt
.
args
.
name
);
got
!=
tt
.
want
{
t
.
Errorf
(
"exists() = %v, want %v"
,
got
,
tt
.
want
)
}
})
}
}
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