Skip to content

Commit

Permalink
Re-anchor comments in server/server.go. (#243)
Browse files Browse the repository at this point in the history
* Re-anchor comments in server/server.go.

* Fix staticcheck errors regarding Print vs. Printf.

* Add `RequiresIPv6` to tests per #244.
  • Loading branch information
robshakir authored Aug 29, 2024
1 parent bc96b24 commit 69cf067
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion chk/chk.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func HasResult(t testing.TB, res []*client.OpResult, want *client.OpResult, opt
for _, r := range res {
buf.WriteString(fmt.Sprintf("\t%s\n", r))
}
t.Fatalf(buf.String())
t.Fatal(buf.String())
}
}

Expand Down
6 changes: 4 additions & 2 deletions compliance/compliance.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,9 @@ var (
},
}, {
In: Test{
Fn: makeTestWithACK(GetIPv6, fluent.InstalledInRIB),
ShortName: "Get for installed IPv6 Entry - RIB ACK",
Fn: makeTestWithACK(GetIPv6, fluent.InstalledInRIB),
ShortName: "Get for installed IPv6 Entry - RIB ACK",
RequiresIPv6: true,
},
}, {
In: Test{
Expand Down Expand Up @@ -404,6 +405,7 @@ var (
Fn: makeTestWithACK(GetIPv6, fluent.InstalledInFIB),
ShortName: "Get for installed IPv6 Entry - FIB ACK",
RequiresFIBACK: true,
RequiresIPv6: true,
},
}, {
In: Test{
Expand Down
4 changes: 2 additions & 2 deletions rib/rib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2558,7 +2558,7 @@ func TestRIBAddEntry(t *testing.T) {
inRIB: func() *RIB {
r := New(defName)
if err := r.AddNetworkInstance("VRF-1"); err != nil {
t.Fatalf(fmt.Sprintf("cannot add network instance, %v", err))
t.Fatalf("cannot add network instance, %v", err)
}

_, fails, err := r.AddEntry(defName, &spb.AFTOperation{
Expand All @@ -2571,7 +2571,7 @@ func TestRIBAddEntry(t *testing.T) {
},
})
if err != nil || len(fails) != 0 {
t.Fatalf(fmt.Sprintf("cannot build test case, cannot add NH, got: %v or failed ops %d", err, len(fails)))
t.Fatalf("cannot build test case, cannot add NH, got: %v or failed ops %d", err, len(fails))
}

_, fails, err = r.AddEntry(defName, &spb.AFTOperation{
Expand Down
3 changes: 2 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,8 @@ func (s *Server) Modify(ms spb.GRIBI_ModifyServer) error {
return
}

// update that we have received at least one message, to detect that we cannot
// now re-set the parameters of the RPC.
gotmsg = true
// write the results to result channel.
if !skipWrite {
Expand All @@ -377,7 +379,6 @@ func (s *Server) Modify(ms spb.GRIBI_ModifyServer) error {
for {
select {
case res := <-resultChan:
// update that we have received at least one message.
if err := ms.Send(res); err != nil {
errCh <- status.Errorf(codes.Internal, "cannot write message to client channel, %s", res)
return
Expand Down
4 changes: 2 additions & 2 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ func TestCheckParams(t *testing.T) {
}

if errS := chkErrDetails(st, tt.wantErrDetails); errS != "" {
t.Fatalf(errS)
t.Fatal(errS)
}

return
Expand Down Expand Up @@ -659,7 +659,7 @@ func TestRunElection(t *testing.T) {
}

if errS := chkErrDetails(st, tt.wantErrDetails); errS != "" {
t.Fatalf(errS)
t.Fatal(errS)
}

return
Expand Down

0 comments on commit 69cf067

Please sign in to comment.