From bca69d968ef76a6260956bc169cb07996fbb7724 Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Thu, 5 Nov 2020 15:45:18 +0300 Subject: App test --- plugins/app/plugin.go | 11 ++- plugins/app/tests/.rr.yaml | 2 +- plugins/app/tests/factory_test.go | 10 +-- plugins/app/tests/hello.php | 3 +- plugins/app/tests/plugin.go | 98 ++++++++++++++++++++++ plugins/app/tests/plugin_1.go | 55 ------------ plugins/app/tests/plugin_2.go | 88 ------------------- plugins/logger/encoder.go | 2 +- plugins/logger/plugin.go | 65 ++++++++++++++ plugins/logger/tests/plugin1.go | 25 ++++++ plugins/logger/zap_logger.go | 68 --------------- plugins/rpc/plugin.go | 171 +++++++++++++++++++++++++++++++++++++ plugins/rpc/rpc.go | 172 -------------------------------------- plugins/rpc/tests/plugin2.go | 3 - 14 files changed, 371 insertions(+), 402 deletions(-) create mode 100644 plugins/app/tests/plugin.go delete mode 100644 plugins/app/tests/plugin_1.go delete mode 100644 plugins/app/tests/plugin_2.go create mode 100644 plugins/logger/plugin.go delete mode 100644 plugins/logger/zap_logger.go create mode 100755 plugins/rpc/plugin.go delete mode 100755 plugins/rpc/rpc.go (limited to 'plugins') diff --git a/plugins/app/plugin.go b/plugins/app/plugin.go index 2ef851e8..839685bd 100644 --- a/plugins/app/plugin.go +++ b/plugins/app/plugin.go @@ -7,10 +7,9 @@ import ( "os/exec" "strings" - "go.uber.org/zap" - "github.com/spiral/errors" "github.com/spiral/roadrunner/v2" + "github.com/spiral/roadrunner/v2/log" "github.com/spiral/roadrunner/v2/plugins/config" "github.com/spiral/roadrunner/v2/util" ) @@ -29,12 +28,12 @@ type WorkerFactory interface { // Plugin manages worker type Plugin struct { cfg Config - log *zap.Logger + log log.Logger factory roadrunner.Factory } // Init application provider. -func (app *Plugin) Init(cfg config.Configurer, log *zap.Logger) error { +func (app *Plugin) Init(cfg config.Configurer, log log.Logger) error { err := cfg.UnmarshalKey(ServiceName, &app.cfg) if err != nil { return err @@ -170,9 +169,9 @@ func (app *Plugin) collectLogs(event interface{}) { if we, ok := event.(roadrunner.WorkerEvent); ok { switch we.Event { case roadrunner.EventWorkerError: - app.log.Error(we.Payload.(error).Error(), zap.Int64("pid", we.Worker.Pid())) + app.log.Error(we.Payload.(error).Error(), "pid", we.Worker.Pid()) case roadrunner.EventWorkerLog: - app.log.Debug(strings.TrimRight(string(we.Payload.([]byte)), " \n\t"), zap.Int64("pid", we.Worker.Pid())) + app.log.Debug(strings.TrimRight(string(we.Payload.([]byte)), " \n\t"), "pid", we.Worker.Pid()) } } } diff --git a/plugins/app/tests/.rr.yaml b/plugins/app/tests/.rr.yaml index c9d1bd40..171f51dc 100644 --- a/plugins/app/tests/.rr.yaml +++ b/plugins/app/tests/.rr.yaml @@ -1,5 +1,5 @@ app: - command: "php plugins/app/tests/hello.php hello_echo" + command: "php hello.php" user: "" group: "" env: diff --git a/plugins/app/tests/factory_test.go b/plugins/app/tests/factory_test.go index 969c361c..878050a8 100644 --- a/plugins/app/tests/factory_test.go +++ b/plugins/app/tests/factory_test.go @@ -20,7 +20,7 @@ func TestFactory(t *testing.T) { } // config plugin vp := &config.Viper{} - vp.Path = "plugins/app/tests/.rr.yaml" + vp.Path = ".rr.yaml" vp.Prefix = "rr" err = container.Register(vp) if err != nil { @@ -37,11 +37,6 @@ func TestFactory(t *testing.T) { t.Fatal(err) } - err = container.Register(&Foo2{}) - if err != nil { - t.Fatal(err) - } - err = container.Register(&logger.ZapLogger{}) if err != nil { t.Fatal(err) @@ -61,7 +56,8 @@ func TestFactory(t *testing.T) { c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt) - tt := time.NewTicker(time.Second * 200) + // stop after 10 seconds + tt := time.NewTicker(time.Second * 10) for { select { diff --git a/plugins/app/tests/hello.php b/plugins/app/tests/hello.php index 4219dcf4..2591b77f 100644 --- a/plugins/app/tests/hello.php +++ b/plugins/app/tests/hello.php @@ -6,8 +6,9 @@ use Spiral\Goridge; use Spiral\RoadRunner; -require "/vendor_php/autoload.php"; +require dirname(__DIR__) . "/../../vendor_php/autoload.php"; +$relay = new Goridge\StreamRelay(STDIN, STDOUT); $rr = new RoadRunner\Worker($relay); while ($in = $rr->receive($ctx)) { diff --git a/plugins/app/tests/plugin.go b/plugins/app/tests/plugin.go new file mode 100644 index 00000000..e37aca01 --- /dev/null +++ b/plugins/app/tests/plugin.go @@ -0,0 +1,98 @@ +package tests + +import ( + "context" + "time" + + "github.com/spiral/errors" + "github.com/spiral/roadrunner/v2" + "github.com/spiral/roadrunner/v2/plugins/app" + "github.com/spiral/roadrunner/v2/plugins/config" +) + +const ConfigSection = "app" + +var testPoolConfig = roadrunner.Config{ + NumWorkers: 10, + MaxJobs: 100, + AllocateTimeout: time.Second * 10, + DestroyTimeout: time.Second * 10, + Supervisor: &roadrunner.SupervisorConfig{ + WatchTick: 60, + TTL: 1000, + IdleTTL: 10, + ExecTTL: 10, + MaxWorkerMemory: 1000, + }, +} + +type Foo struct { + configProvider config.Configurer + wf app.WorkerFactory + pool roadrunner.Pool +} + +func (f *Foo) Init(p config.Configurer, workerFactory app.WorkerFactory) error { + f.configProvider = p + f.wf = workerFactory + return nil +} + +func (f *Foo) Serve() chan error { + const op = errors.Op("serve") + errCh := make(chan error, 1) + + conf := &app.Config{} + var err error + err = f.configProvider.UnmarshalKey(ConfigSection, conf) + if err != nil { + errCh <- err + return errCh + } + + // test CMDFactory + cmd, err := f.wf.CmdFactory(nil) + if err != nil { + errCh <- err + return errCh + } + if cmd == nil { + errCh <- errors.E(op, "command is nil") + return errCh + } + + // test worker creation + _, err = f.wf.NewWorker(context.Background(), nil) + if err != nil { + errCh <- err + return errCh + } + + f.pool, err = f.wf.NewWorkerPool(context.Background(), testPoolConfig, nil) + if err != nil { + errCh <- err + return errCh + } + + r := roadrunner.Payload{ + Context: nil, + Body: []byte("test"), + } + rsp, err := f.pool.Exec(r) + if err != nil { + errCh <- err + return errCh + } + + if string(rsp.Body) != "test" { + errCh <- errors.E("response from worker is wrong", errors.Errorf("response: %s", rsp.Body)) + return errCh + } + + return errCh +} + +func (f *Foo) Stop() error { + f.pool.Destroy(context.Background()) + return nil +} diff --git a/plugins/app/tests/plugin_1.go b/plugins/app/tests/plugin_1.go deleted file mode 100644 index c6287f5c..00000000 --- a/plugins/app/tests/plugin_1.go +++ /dev/null @@ -1,55 +0,0 @@ -package tests - -import ( - "errors" - "fmt" - - "github.com/spiral/roadrunner/v2/plugins/app" - "github.com/spiral/roadrunner/v2/plugins/config" -) - -type Foo struct { - configProvider config.Configurer - spawner app.WorkerFactory -} - -func (f *Foo) Init(p config.Configurer, spw app.WorkerFactory) error { - f.configProvider = p - f.spawner = spw - return nil -} - -func (f *Foo) Serve() chan error { - errCh := make(chan error, 1) - - r := &app.Config{} - err := f.configProvider.UnmarshalKey("app", r) - if err != nil { - errCh <- err - return errCh - } - - cmd, err := f.spawner.CmdFactory(nil) - if err != nil { - errCh <- err - return errCh - } - if cmd == nil { - errCh <- errors.New("command is nil") - return errCh - } - a := cmd() - out, err := a.Output() - if err != nil { - errCh <- err - return errCh - } - - fmt.Println(string(out)) - - return errCh -} - -func (f *Foo) Stop() error { - return nil -} diff --git a/plugins/app/tests/plugin_2.go b/plugins/app/tests/plugin_2.go deleted file mode 100644 index 51fb83a4..00000000 --- a/plugins/app/tests/plugin_2.go +++ /dev/null @@ -1,88 +0,0 @@ -package tests - -import ( - "context" - "errors" - "fmt" - "time" - - "github.com/spiral/roadrunner/v2" - "github.com/spiral/roadrunner/v2/plugins/app" - "github.com/spiral/roadrunner/v2/plugins/config" -) - -type Foo2 struct { - configProvider config.Configurer - wf app.WorkerFactory -} - -func (f *Foo2) Init(p config.Configurer, workerFactory app.WorkerFactory) error { - f.configProvider = p - f.wf = workerFactory - return nil -} - -func (f *Foo2) Serve() chan error { - errCh := make(chan error, 1) - - r := &app.Config{} - err := f.configProvider.UnmarshalKey("app", r) - if err != nil { - errCh <- err - return errCh - } - - cmd, err := f.wf.CmdFactory(nil) - if err != nil { - errCh <- err - return errCh - } - if cmd == nil { - errCh <- errors.New("command is nil") - return errCh - } - a := cmd() - out, err := a.Output() - if err != nil { - errCh <- err - return errCh - } - - w, err := f.wf.NewWorker(context.Background(), nil) - if err != nil { - errCh <- err - return errCh - } - - _ = w - - poolConfig := roadrunner.Config{ - NumWorkers: 10, - MaxJobs: 100, - AllocateTimeout: time.Second * 10, - DestroyTimeout: time.Second * 10, - Supervisor: &roadrunner.SupervisorConfig{ - WatchTick: 60, - TTL: 1000, - IdleTTL: 10, - ExecTTL: 10, - MaxWorkerMemory: 1000, - }, - } - - pool, err := f.wf.NewWorkerPool(context.Background(), poolConfig, nil) - if err != nil { - errCh <- err - return errCh - } - - _ = pool - - fmt.Println(string(out)) - - return errCh -} - -func (f *Foo2) Stop() error { - return nil -} diff --git a/plugins/logger/encoder.go b/plugins/logger/encoder.go index 66cd84f1..4ff583c4 100644 --- a/plugins/logger/encoder.go +++ b/plugins/logger/encoder.go @@ -61,6 +61,6 @@ func UTCTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder) { // returns string hash func stringHash(name string, base int) int { h := fnv.New32a() - h.Write([]byte(name)) + _, _ = h.Write([]byte(name)) return int(h.Sum32()) % base } diff --git a/plugins/logger/plugin.go b/plugins/logger/plugin.go new file mode 100644 index 00000000..f05d0ff0 --- /dev/null +++ b/plugins/logger/plugin.go @@ -0,0 +1,65 @@ +package logger + +import ( + "github.com/spiral/endure" + "github.com/spiral/roadrunner/v2/log" + "github.com/spiral/roadrunner/v2/plugins/config" + "go.uber.org/zap" +) + +// ServiceName declares service name. +const ServiceName = "logs" + +// ZapLogger manages zap logger. +type ZapLogger struct { + base *zap.Logger + cfg Config + channels ChannelConfig +} + +// Init logger service. +func (z *ZapLogger) Init(cfg config.Configurer) error { + err := cfg.UnmarshalKey(ServiceName, &z.cfg) + if err != nil { + return err + } + + err = cfg.UnmarshalKey(ServiceName, &z.channels) + if err != nil { + return err + } + + z.base, err = z.cfg.BuildLogger() + return err +} + +// DefaultLogger returns default logger. +func (z *ZapLogger) DefaultLogger() (log.Logger, error) { + return log.NewZapAdapter(z.base), nil +} + +// NamedLogger returns logger dedicated to the specific channel. Similar to Named() but also reads the core params. +func (z *ZapLogger) NamedLogger(name string) (log.Logger, error) { + if cfg, ok := z.channels.Channels[name]; ok { + l, err := cfg.BuildLogger() + if err != nil { + return nil, err + } + return log.NewZapAdapter(l), nil + } + + return log.NewZapAdapter(z.base.Named(name)), nil +} + +// NamedLogger returns logger dedicated to the specific channel. Similar to Named() but also reads the core params. +func (z *ZapLogger) ServiceLogger(n endure.Named) (log.Logger, error) { + return z.NamedLogger(n.Name()) +} + +// Provides declares factory methods. +func (z *ZapLogger) Provides() []interface{} { + return []interface{}{ + z.ServiceLogger, + z.DefaultLogger, + } +} diff --git a/plugins/logger/tests/plugin1.go b/plugins/logger/tests/plugin1.go index ca8701d2..c4ca1371 100644 --- a/plugins/logger/tests/plugin1.go +++ b/plugins/logger/tests/plugin1.go @@ -1 +1,26 @@ package tests + +import ( + "github.com/spiral/roadrunner/v2/plugins/config" + "github.com/spiral/roadrunner/v2/plugins/logger" +) + +type Plugin1 struct { + config config.Configurer + log *logger.ZapLogger +} + +func (p1 *Plugin1) Init(cfg config.Configurer, log *logger.ZapLogger) error { + p1.config = cfg + p1.log = log + return nil +} + +func (p1 *Plugin1) Serve() chan error { + errCh := make(chan error, 1) + return errCh +} + +func (p1 *Plugin1) Stop() error { + return nil +} diff --git a/plugins/logger/zap_logger.go b/plugins/logger/zap_logger.go deleted file mode 100644 index a22cdb22..00000000 --- a/plugins/logger/zap_logger.go +++ /dev/null @@ -1,68 +0,0 @@ -package logger - -import ( - "github.com/spiral/endure" - "github.com/spiral/roadrunner/v2/plugins/config" - "go.uber.org/zap" -) - -// ServiceName declares service name. -const ServiceName = "logs" - -type LogFactory interface { - // GlobalLogger returns global log instance. - GlobalLogger() *zap.Logger - - // NamedLogger returns logger dedicated to the specific channel. Similar to Named() but also reads the core params. - NamedLogger(name string) *zap.Logger -} - -// ZapLogger manages zap logger. -type ZapLogger struct { - base *zap.Logger - cfg Config - channels ChannelConfig -} - -// Init logger service. -func (z *ZapLogger) Init(cfg config.Configurer) (err error) { - err = cfg.UnmarshalKey(ServiceName, &z.cfg) - if err != nil { - return err - } - - err = cfg.UnmarshalKey(ServiceName, &z.channels) - if err != nil { - return err - } - - z.base, err = z.cfg.BuildLogger() - return err -} - -// DefaultLogger returns default logger. -func (z *ZapLogger) DefaultLogger() (*zap.Logger, error) { - return z.base, nil -} - -// NamedLogger returns logger dedicated to the specific channel. Similar to Named() but also reads the core params. -func (z *ZapLogger) NamedLogger(name string) (*zap.Logger, error) { - if cfg, ok := z.channels.Channels[name]; ok { - return cfg.BuildLogger() - } - - return z.base.Named(name), nil -} - -// NamedLogger returns logger dedicated to the specific channel. Similar to Named() but also reads the core params. -func (z *ZapLogger) ServiceLogger(n endure.Named) (*zap.Logger, error) { - return z.NamedLogger(n.Name()) -} - -// Provides declares factory methods. -func (z *ZapLogger) Provides() []interface{} { - return []interface{}{ - z.DefaultLogger, - z.ServiceLogger, - } -} diff --git a/plugins/rpc/plugin.go b/plugins/rpc/plugin.go new file mode 100755 index 00000000..6401c0e2 --- /dev/null +++ b/plugins/rpc/plugin.go @@ -0,0 +1,171 @@ +package rpc + +import ( + "net" + "net/rpc" + "sync/atomic" + + "github.com/spiral/endure" + "github.com/spiral/errors" + "github.com/spiral/goridge/v2" + "github.com/spiral/roadrunner/v2/log" + "github.com/spiral/roadrunner/v2/plugins/config" +) + +// Pluggable declares the ability to create set of public RPC methods. +type Pluggable interface { + endure.Named + + // Provides RPC methods for the given service. + RPCService() (interface{}, error) +} + +// ServiceName contains default service name. +const ServiceName = "RPC" + +// Plugin is RPC service. +type Plugin struct { + cfg Config + log log.Logger + rpc *rpc.Server + services []Pluggable + listener net.Listener + closed *uint32 +} + +// Init rpc service. Must return true if service is enabled. +func (s *Plugin) Init(cfg config.Configurer, log log.Logger) error { + const op = errors.Op("RPC Init") + if !cfg.Has(ServiceName) { + return errors.E(op, errors.Disabled) + } + + err := cfg.UnmarshalKey(ServiceName, &s.cfg) + if err != nil { + return err + } + s.cfg.InitDefaults() + + if s.cfg.Disabled { + return errors.E(op, errors.Disabled) + } + + s.log = log + state := uint32(0) + s.closed = &state + atomic.StoreUint32(s.closed, 0) + + return s.cfg.Valid() +} + +// Serve serves the service. +func (s *Plugin) Serve() chan error { + const op = errors.Op("register service") + errCh := make(chan error, 1) + + s.rpc = rpc.NewServer() + + services := make([]string, 0, len(s.services)) + + // Attach all services + for i := 0; i < len(s.services); i++ { + svc, err := s.services[i].RPCService() + if err != nil { + errCh <- errors.E(op, err) + return errCh + } + + err = s.Register(s.services[i].Name(), svc) + if err != nil { + errCh <- errors.E(op, err) + return errCh + } + + services = append(services, s.services[i].Name()) + } + + var err error + s.listener, err = s.cfg.Listener() + if err != nil { + errCh <- err + return errCh + } + + s.log.Debug("Started RPC service", "address", s.cfg.Listen, "services", services) + + go func() { + for { + conn, err := s.listener.Accept() + if err != nil { + if atomic.LoadUint32(s.closed) == 1 { + // just log and continue, this is not a critical issue, we just called Stop + s.log.Error("listener accept error, connection closed", "error", err) + return + } + + s.log.Error("listener accept error", "error", err) + errCh <- errors.E(errors.Op("listener accept"), errors.Serve, err) + return + } + + go s.rpc.ServeCodec(goridge.NewCodec(conn)) + } + }() + + return errCh +} + +// Stop stops the service. +func (s *Plugin) Stop() error { + // store closed state + atomic.StoreUint32(s.closed, 1) + err := s.listener.Close() + if err != nil { + return errors.E(errors.Op("stop RPC socket"), err) + } + return nil +} + +// Name contains service name. +func (s *Plugin) Name() string { + return ServiceName +} + +// Depends declares services to collect for RPC. +func (s *Plugin) Collects() []interface{} { + return []interface{}{ + s.RegisterPlugin, + } +} + +// RegisterPlugin registers RPC service plugin. +func (s *Plugin) RegisterPlugin(p Pluggable) error { + s.services = append(s.services, p) + return nil +} + +// Register publishes in the server the set of methods of the +// receiver value that satisfy the following conditions: +// - exported method of exported type +// - two arguments, both of exported type +// - the second argument is a pointer +// - one return value, of type error +// It returns an error if the receiver is not an exported type or has +// no suitable methods. It also logs the error using package log. +func (s *Plugin) Register(name string, svc interface{}) error { + if s.rpc == nil { + return errors.E("RPC service is not configured") + } + + return s.rpc.RegisterName(name, svc) +} + +// Client creates new RPC client. +func (s *Plugin) Client() (*rpc.Client, error) { + conn, err := s.cfg.Dialer() + if err != nil { + return nil, err + } + + return rpc.NewClientWithCodec(goridge.NewClientCodec(conn)), nil +} diff --git a/plugins/rpc/rpc.go b/plugins/rpc/rpc.go deleted file mode 100755 index 5203fc65..00000000 --- a/plugins/rpc/rpc.go +++ /dev/null @@ -1,172 +0,0 @@ -package rpc - -import ( - "net" - "net/rpc" - "sync/atomic" - - "go.uber.org/zap" - - "github.com/spiral/endure" - "github.com/spiral/errors" - "github.com/spiral/goridge/v2" - "github.com/spiral/roadrunner/v2/plugins/config" -) - -// Pluggable declares the ability to create set of public RPC methods. -type Pluggable interface { - endure.Named - - // Provides RPC methods for the given service. - RPCService() (interface{}, error) -} - -// ServiceName contains default service name. -const ServiceName = "rpc" - -// Plugin is RPC service. -type Plugin struct { - cfg Config - log *zap.Logger - rpc *rpc.Server - services []Pluggable - listener net.Listener - closed *uint32 -} - -// Init rpc service. Must return true if service is enabled. -func (s *Plugin) Init(cfg config.Configurer, log *zap.Logger) error { - const op = errors.Op("RPC Init") - if !cfg.Has(ServiceName) { - return errors.E(op, errors.Disabled) - } - - err := cfg.UnmarshalKey(ServiceName, &s.cfg) - if err != nil { - return err - } - s.cfg.InitDefaults() - - if s.cfg.Disabled { - return errors.E(op, errors.Disabled) - } - - s.log = log - state := uint32(0) - s.closed = &state - atomic.StoreUint32(s.closed, 0) - - return s.cfg.Valid() -} - -// Serve serves the service. -func (s *Plugin) Serve() chan error { - const op = errors.Op("register service") - errCh := make(chan error, 1) - - s.rpc = rpc.NewServer() - - services := make([]string, 0, len(s.services)) - - // Attach all services - for i := 0; i < len(s.services); i++ { - svc, err := s.services[i].RPCService() - if err != nil { - errCh <- errors.E(op, err) - return errCh - } - - err = s.Register(s.services[i].Name(), svc) - if err != nil { - errCh <- errors.E(op, err) - return errCh - } - - services = append(services, s.services[i].Name()) - } - - var err error - s.listener, err = s.cfg.Listener() - if err != nil { - errCh <- err - return errCh - } - - s.log.Debug("Started RPC service", zap.String("address", s.cfg.Listen), zap.Any("services", services)) - - go func() { - for { - conn, err := s.listener.Accept() - if err != nil { - if atomic.LoadUint32(s.closed) == 1 { - // just log and continue, this is not a critical issue, we just called Stop - s.log.Error("listener accept error, connection closed", zap.Error(err)) - return - } - - s.log.Error("listener accept error", zap.Error(err)) - errCh <- errors.E(errors.Op("listener accept"), errors.Serve, err) - return - } - - go s.rpc.ServeCodec(goridge.NewCodec(conn)) - } - }() - - return errCh -} - -// Stop stops the service. -func (s *Plugin) Stop() error { - // store closed state - atomic.StoreUint32(s.closed, 1) - err := s.listener.Close() - if err != nil { - return errors.E(errors.Op("stop RPC socket"), err) - } - return nil -} - -// Name contains service name. -func (s *Plugin) Name() string { - return ServiceName -} - -// Depends declares services to collect for RPC. -func (s *Plugin) Collects() []interface{} { - return []interface{}{ - s.RegisterPlugin, - } -} - -// RegisterPlugin registers RPC service plugin. -func (s *Plugin) RegisterPlugin(p Pluggable) error { - s.services = append(s.services, p) - return nil -} - -// Register publishes in the server the set of methods of the -// receiver value that satisfy the following conditions: -// - exported method of exported type -// - two arguments, both of exported type -// - the second argument is a pointer -// - one return value, of type error -// It returns an error if the receiver is not an exported type or has -// no suitable methods. It also logs the error using package log. -func (s *Plugin) Register(name string, svc interface{}) error { - if s.rpc == nil { - return errors.E("RPC service is not configured") - } - - return s.rpc.RegisterName(name, svc) -} - -// Client creates new RPC client. -func (s *Plugin) Client() (*rpc.Client, error) { - conn, err := s.cfg.Dialer() - if err != nil { - return nil, err - } - - return rpc.NewClientWithCodec(goridge.NewClientCodec(conn)), nil -} diff --git a/plugins/rpc/tests/plugin2.go b/plugins/rpc/tests/plugin2.go index 2a0ae1a8..854bf097 100644 --- a/plugins/rpc/tests/plugin2.go +++ b/plugins/rpc/tests/plugin2.go @@ -1,7 +1,6 @@ package tests import ( - "fmt" "net" "net/rpc" "time" @@ -38,8 +37,6 @@ func (p2 *Plugin2) Serve() chan error { errCh <- err return } - fmt.Println("--------------") - fmt.Println(ret) if ret != "Hello, username: Valery" { errCh <- errors.E("wrong response") return -- cgit v1.2.3