Skip to content

Commit b08ce09

Browse files
committed
re-enable unit test
1 parent 427c6f9 commit b08ce09

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

gnmi_server/server_test.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
sgpb "github.com/sonic-net/sonic-gnmi/proto/gnoi"
2525
sdc "github.com/sonic-net/sonic-gnmi/sonic_data_client"
2626
sdcfg "github.com/sonic-net/sonic-gnmi/sonic_db_config"
27-
// ssc "github.com/sonic-net/sonic-gnmi/sonic_service_client"
27+
ssc "github.com/sonic-net/sonic-gnmi/sonic_service_client"
2828
"github.com/sonic-net/sonic-gnmi/test_utils"
2929
testcert "github.com/sonic-net/sonic-gnmi/testdata/tls"
3030

@@ -4164,28 +4164,28 @@ func TestMasterArbitration(t *testing.T) {
41644164
})
41654165
}
41664166

4167-
// func TestSaveOnSet(t *testing.T) {
4168-
// // Fail client creation
4169-
// fakeDBC := gomonkey.ApplyFuncReturn(ssc.NewDbusClient, nil, fmt.Errorf("Fail Create"))
4170-
// if err := SaveOnSetEnabled(); err == nil {
4171-
// t.Error("Expected Client Failure")
4172-
// }
4173-
// fakeDBC.Reset()
4174-
4175-
// // Successful Dbus call
4176-
// goodDbus := gomonkey.ApplyFuncReturn(ssc.DbusApi, nil)
4177-
// if err := SaveOnSetEnabled(); err != nil {
4178-
// t.Error("Unexpected DBUS failure")
4179-
// }
4180-
// goodDbus.Reset()
4181-
4182-
// // Fail Dbus call
4183-
// badDbus := gomonkey.ApplyFuncReturn(ssc.DbusApi, fmt.Errorf("Fail Send"))
4184-
// defer badDbus.Reset()
4185-
// if err := SaveOnSetEnabled(); err == nil {
4186-
// t.Error("Expected DBUS failure")
4187-
// }
4188-
// }
4167+
func TestSaveOnSet(t *testing.T) {
4168+
// Fail client creation
4169+
fakeDBC := gomonkey.ApplyFuncReturn(ssc.NewDbusClient, nil, fmt.Errorf("Fail Create"))
4170+
if err := SaveOnSetEnabled(); err == nil {
4171+
t.Error("Expected Client Failure")
4172+
}
4173+
fakeDBC.Reset()
4174+
4175+
// Successful Dbus call
4176+
goodDbus := gomonkey.ApplyFuncReturn(ssc.DbusApi, nil)
4177+
if err := SaveOnSetEnabled(); err != nil {
4178+
t.Error("Unexpected DBUS failure")
4179+
}
4180+
goodDbus.Reset()
4181+
4182+
// Fail Dbus call
4183+
badDbus := gomonkey.ApplyFuncReturn(ssc.DbusApi, fmt.Errorf("Fail Send"))
4184+
defer badDbus.Reset()
4185+
if err := SaveOnSetEnabled(); err == nil {
4186+
t.Error("Expected DBUS failure")
4187+
}
4188+
}
41894189

41904190
func init() {
41914191
// Enable logs at UT setup

0 commit comments

Comments
 (0)