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

Merge branch '99-commit-confirm-mechanic-for-ond-changes' into 'develop'

Commit-Confirm Mechanic for PND

See merge request cocsn/gosdn!147
parents 5e53f43f 78e57d25
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 #69009 passed
......@@ -28,7 +28,6 @@ func TestMain(m *testing.M) {
os.Exit(m.Run())
}
func testSetupIntegration() {
if os.Getenv("GOSDN_LOG") == "nolog" {
log.SetLevel(log.PanicLevel)
......@@ -86,7 +85,7 @@ func testSetupIntegration() {
}
}
func TestCliIntegration(t *testing.T) {
func TestCmdIntegration(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
......@@ -154,7 +153,7 @@ func TestCliIntegration(t *testing.T) {
hostname := guuid.New().String()
if err := cli.HTTPGet(
testAPIEndpoint,
"set",
"update",
"address="+testAddress,
"uuid="+did,
"sbi="+cliSbi,
......
......@@ -23,13 +23,12 @@ func TestGnmi_SetIntegration(t *testing.T) {
}
type args struct {
ctx context.Context
params []interface{}
params []string
}
tests := []struct {
name string
fields fields
args args
want interface{}
wantErr bool
}{
{
......@@ -42,33 +41,28 @@ func TestGnmi_SetIntegration(t *testing.T) {
},
args: args{
ctx: context.Background(),
params: []interface{}{&gnmi.Operation{}},
params: []string{"/system/config/hostname", "ceos3000"},
},
want: nil,
wantErr: true,
},
{
name: "valid update",
fields: fields{opt: opt},
args: args{
ctx: context.Background(),
params: []interface{}{
&gnmi.Operation{
Type: "update",
Origin: "",
Target: "",
Path: []string{
"system",
"config",
"hostname",
},
Val: "ceos3000",
},
},
ctx: context.Background(),
params: []string{"/system/config/hostname", "ceos3000"},
},
want: gnmiMessages["../proto/resp-set-system-config-hostname"],
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) {
......@@ -77,21 +71,11 @@ func TestGnmi_SetIntegration(t *testing.T) {
t.Errorf("NewGnmiTransport() error = %v, wantErr %v", err, tt.wantErr)
return
}
resp, err := g.Set(tt.args.ctx, tt.args.params...)
err = g.Set(tt.args.ctx, tt.args.params)
if (err != nil) != tt.wantErr {
t.Errorf("Set() error = %v, wantErr %v", err, tt.wantErr)
return
}
got, ok := resp.(*gpb.SetResponse)
if !ok {
t.Errorf("want: %v, got %v, error: %v", reflect.TypeOf(&gpb.SetResponse{}), reflect.TypeOf(resp), &nucleus.ErrInvalidTypeAssertion{})
}
if err != nil && tt.wantErr {
return
} else if got.Prefix.Target != testAddress ||
got.Response[0].Op != gpb.UpdateResult_UPDATE {
t.Errorf("Set() got = %v, want %v", got, tt.want)
}
})
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment