Skip to content

Commit

Permalink
Fix porting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
liuh-80 committed Nov 8, 2024
1 parent 15719d1 commit 7695155
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions gnmi_server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"reflect"
"testing"
"time"
"runtime
"runtime"

"crypto/x509"
"crypto/x509/pkix"
Expand Down Expand Up @@ -4245,29 +4245,28 @@ func (x *MockSetPackageServer) Recv() (*gnoi_system_pb.SetPackageRequest, error)
func TestGnoiAuthorization(t *testing.T) {
s := createServer(t, 8081)
go runServer(t, s)
systemSrv := &SystemServer{Server: s}
mockAuthenticate := gomonkey.ApplyFunc(s.Authenticate, func(ctx context.Context, req *spb_jwt.AuthenticateRequest) (*spb_jwt.AuthenticateResponse, error) {
return nil, nil
})
defer mockAuthenticate.Reset()

err := systemSrv.Ping(new(gnoi_system_pb.PingRequest), new(MockPingServer))
err := s.Ping(new(gnoi_system_pb.PingRequest), new(MockPingServer))
if err == nil {
t.Errorf("Ping should failed, because not implement.")
}

systemSrv.Traceroute(new(gnoi_system_pb.TracerouteRequest), new(MockTracerouteServer))
s.Traceroute(new(gnoi_system_pb.TracerouteRequest), new(MockTracerouteServer))
if err == nil {
t.Errorf("Traceroute should failed, because not implement.")
}

systemSrv.SetPackage(new(MockSetPackageServer))
s.SetPackage(new(MockSetPackageServer))
if err == nil {
t.Errorf("SetPackage should failed, because not implement.")
}

ctx := context.Background()
systemSrv.SwitchControlProcessor(ctx, new(gnoi_system_pb.SwitchControlProcessorRequest))
s.SwitchControlProcessor(ctx, new(gnoi_system_pb.SwitchControlProcessorRequest))
if err == nil {
t.Errorf("SwitchControlProcessor should failed, because not implement.")
}
Expand Down

0 comments on commit 7695155

Please sign in to comment.