Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/FengPan-Frank/sonic-gnmi
Browse files Browse the repository at this point in the history
…into fenpan_pubsubfix
  • Loading branch information
FengPan-Frank committed Jun 27, 2023
2 parents 219d73d + fd78c42 commit 3286382
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions gnmi_server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3255,12 +3255,12 @@ func TestConnectionsKeepAlive(t *testing.T) {
}
}

func TestConnectionFailure(t *testing.T) {
func TestConnectionRedisFailure(t *testing.T) {
s := createServer(t, 8081)
go runServer(t, s)
defer s.s.Stop()

tt := struct {
test := struct {
desc string
q client.Query
want []client.Notification
Expand All @@ -3284,15 +3284,15 @@ func TestConnectionFailure(t *testing.T) {
defer rclient.Close()

prepareStateDb(t, namespace)
t.Run(tt.desc, func(t *testing.T) {
q := tt.q
t.Run(test.desc, func(t *testing.T) {
q := test.q
q.Addrs = []string{"127.0.0.1:8081"}
c := client.New()

sdc.MockFail = 1
wg := new(sync.WaitGroup)
wg.Add(1)

sdc.MockFail = 1
go func() {
defer wg.Done()
if err := c.Subscribe(context.Background(), q); err != nil {
Expand All @@ -3301,7 +3301,7 @@ func TestConnectionFailure(t *testing.T) {
}()

wg.Wait()

sdc.MockFail = 0
resultMap, err := rclient.HGetAll("TELEMETRY_CONNECTIONS").Result()

if resultMap == nil {
Expand All @@ -3316,7 +3316,7 @@ func TestConnectionFailure(t *testing.T) {
t.Errorf("key is expected to contain correct query, received: %s", key)
}
}
sdc.MockFail = 0

c.Close()
})
}
Expand Down
2 changes: 1 addition & 1 deletion sonic_data_client/db_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ func tableData2Msi(tblPath *tablePath, useKey bool, op *string, msi *map[string]

if MockFail == 1 {
MockFail++
fmt.Println("Mock sleep for redis timeout")
fmt.Printf("mock sleep for redis timeout\n")
time.Sleep(30 * time.Second)
}

Expand Down

0 comments on commit 3286382

Please sign in to comment.