Skip to content

Commit

Permalink
re-enable unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
rlucus committed May 7, 2024
1 parent 427c6f9 commit b08ce09
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions gnmi_server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
sgpb "github.com/sonic-net/sonic-gnmi/proto/gnoi"
sdc "github.com/sonic-net/sonic-gnmi/sonic_data_client"
sdcfg "github.com/sonic-net/sonic-gnmi/sonic_db_config"
// ssc "github.com/sonic-net/sonic-gnmi/sonic_service_client"
ssc "github.com/sonic-net/sonic-gnmi/sonic_service_client"
"github.com/sonic-net/sonic-gnmi/test_utils"
testcert "github.com/sonic-net/sonic-gnmi/testdata/tls"

Expand Down Expand Up @@ -4164,28 +4164,28 @@ func TestMasterArbitration(t *testing.T) {
})
}

// func TestSaveOnSet(t *testing.T) {
// // Fail client creation
// fakeDBC := gomonkey.ApplyFuncReturn(ssc.NewDbusClient, nil, fmt.Errorf("Fail Create"))
// if err := SaveOnSetEnabled(); err == nil {
// t.Error("Expected Client Failure")
// }
// fakeDBC.Reset()

// // Successful Dbus call
// goodDbus := gomonkey.ApplyFuncReturn(ssc.DbusApi, nil)
// if err := SaveOnSetEnabled(); err != nil {
// t.Error("Unexpected DBUS failure")
// }
// goodDbus.Reset()

// // Fail Dbus call
// badDbus := gomonkey.ApplyFuncReturn(ssc.DbusApi, fmt.Errorf("Fail Send"))
// defer badDbus.Reset()
// if err := SaveOnSetEnabled(); err == nil {
// t.Error("Expected DBUS failure")
// }
// }
func TestSaveOnSet(t *testing.T) {
// Fail client creation
fakeDBC := gomonkey.ApplyFuncReturn(ssc.NewDbusClient, nil, fmt.Errorf("Fail Create"))
if err := SaveOnSetEnabled(); err == nil {
t.Error("Expected Client Failure")
}
fakeDBC.Reset()

// Successful Dbus call
goodDbus := gomonkey.ApplyFuncReturn(ssc.DbusApi, nil)
if err := SaveOnSetEnabled(); err != nil {
t.Error("Unexpected DBUS failure")
}
goodDbus.Reset()

// Fail Dbus call
badDbus := gomonkey.ApplyFuncReturn(ssc.DbusApi, fmt.Errorf("Fail Send"))
defer badDbus.Reset()
if err := SaveOnSetEnabled(); err == nil {
t.Error("Expected DBUS failure")
}
}

func init() {
// Enable logs at UT setup
Expand Down

0 comments on commit b08ce09

Please sign in to comment.