Skip to content
Snippets Groups Projects
Commit f316d842 authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

more error handling

parent 034077f1
No related branches found
No related tags found
9 merge requests!246Develop,!245Develop into Master,!244Master into develop2 into master,!219Draft: Testing,!214Test pipelines,!195DO NOT MERGE 2,!194DO NOT MERGE! just for testing,!147Commit-Confirm Mechanic for PND,!138Develop
Pipeline #68991 passed
This commit is part of merge request !147. Comments created here will be created in the context of that merge request.
......@@ -113,6 +113,11 @@ func (g *Gnmi) Set(ctx context.Context, args ...interface{}) error {
v: o,
t: reflect.TypeOf("placeholder"),
}
} else if attrs == nil || len(attrs) == 0 {
return &ErrInvalidParameters{
f: "gnmi.Set()",
r: "no parameters provided",
}
}
opts = append(opts, &gnmi.Operation{
// Hardcoded TransportUpdate until multiple operations are supported
......
......@@ -85,7 +85,7 @@ func testSetupIntegration() {
}
}
func TestCliIntegration(t *testing.T) {
func TestCmdIntegration(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
......
......@@ -41,7 +41,7 @@ func TestGnmi_SetIntegration(t *testing.T) {
},
args: args{
ctx: context.Background(),
params: []string{},
params: []string{"/system/config/hostname", "ceos3000"},
},
wantErr: true,
},
......@@ -54,6 +54,15 @@ func TestGnmi_SetIntegration(t *testing.T) {
},
wantErr: false,
},
{
name: "invalid update",
fields: fields{opt: opt},
args: args{
ctx: context.Background(),
params: nil,
},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment