Skip to content

Commit

Permalink
remove testing code
Browse files Browse the repository at this point in the history
Change-Id: I3e6265735ae6f5859b23cbe1d585931ecff8a69b
  • Loading branch information
VinozzZ committed Mar 18, 2020
1 parent b51eb39 commit 1d0d8da
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 72 deletions.
38 changes: 0 additions & 38 deletions internal/integration/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ import (
"context"
"io"
"net"
"strconv"

"github.com/spacemonkeygo/monkit/v3"
"github.com/zeebo/errs"

drpc "storj.io/drpc"
"storj.io/drpc/drpcconn"
"storj.io/drpc/drpcctx"
"storj.io/drpc/drpcerr"
"storj.io/drpc/drpcmetadata"
"storj.io/drpc/drpcmux"
"storj.io/drpc/drpcserver"
"storj.io/drpc/drpcsignal"
Expand Down Expand Up @@ -48,39 +44,6 @@ func createConnection(server DRPCServiceServer) (DRPCServiceClient, func()) {
}
}

type streamWrapper struct {
drpc.Stream
ctx context.Context
}

func (s *streamWrapper) Context() context.Context { return s.ctx }

type handler struct {
mu *drpcmux.Mux
}

func (handler *handler) HandleRPC(stream drpc.Stream, rpc string) (err error) {
streamCtx := stream.Context()
metadata, ok := drpcmetadata.Get(streamCtx)
if ok {
parentID, err := strconv.ParseInt(metadata[INVOKE_HEADER_PARENTID], 10, 64)
if err != nil {
return errs.New("parse error")
}

traceID, err := strconv.ParseInt(metadata[INVOKE_HEADER_TRACEID], 10, 64)
if err != nil {
return errs.New("parse error")
}
newTrace := monkit.NewTrace(traceID)
newTrace.Set(2, parentID)
f := mon.Func()
defer f.RemoteTrace(&streamCtx, monkit.NewId(), newTrace)(&err)
}

return handler.mu.HandleRPC(&streamWrapper{Stream: stream, ctx: streamCtx}, rpc)
}

//
// server impl
//
Expand Down Expand Up @@ -114,7 +77,6 @@ func (i impl) Method4(stream DRPCService_Method4Stream) error {

var standardImpl = impl{
Method1Fn: func(ctx context.Context, in *In) (*Out, error) {
defer mon.Task()(&ctx)(nil)
if in.In != 1 {
return nil, drpcerr.WithCode(errs.New("test"), uint64(in.In))
}
Expand Down
19 changes: 1 addition & 18 deletions internal/integration/service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions internal/integration/simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,19 @@ package integration
import (
"context"
"io"
"net/http"
"testing"
"time"

"github.com/spacemonkeygo/monkit/v3"
"github.com/spacemonkeygo/monkit/v3/present"
"github.com/zeebo/assert"

"storj.io/drpc/drpcctx"
"storj.io/drpc/drpcerr"
jaeger "storj.io/monkit-jaeger"
)

var mon = monkit.Package()

func TestSimple(t *testing.T) {
go http.ListenAndServe("localhost:9000", present.HTTP(monkit.Default))
collector, err := jaeger.NewUDPCollector("localhost:5775", 250, "test")
if err != nil {
panic(err)
}
jaeger.RegisterJaeger(monkit.Default, collector, jaeger.Options{
Fraction: 1})

tracker := drpcctx.NewTracker(context.Background())
defer mon.Task()(&tracker.Context)(nil)
defer tracker.Wait()
defer tracker.Cancel()

Expand Down Expand Up @@ -90,7 +77,4 @@ func TestSimple(t *testing.T) {
assert.Error(t, err)
assert.Equal(t, drpcerr.Code(err), 5)
}

time.Sleep(5 * time.Second)

}

0 comments on commit 1d0d8da

Please sign in to comment.