From e76536ce9310552547bdae3ad46ebd08dbd2bb4a Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Thu, 5 Nov 2020 17:10:10 +0300 Subject: Move magic string to the constants (test) --- plugins/app/tests/plugin_pipes.go | 7 ++++--- plugins/app/tests/plugin_sockets.go | 6 +++--- plugins/app/tests/plugin_tcp.go | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'plugins/app') diff --git a/plugins/app/tests/plugin_pipes.go b/plugins/app/tests/plugin_pipes.go index 704ec988..fc999718 100644 --- a/plugins/app/tests/plugin_pipes.go +++ b/plugins/app/tests/plugin_pipes.go @@ -11,6 +11,7 @@ import ( ) const ConfigSection = "app" +const Response = "test" var testPoolConfig = roadrunner.Config{ NumWorkers: 10, @@ -44,7 +45,7 @@ func (f *Foo) Serve() chan error { // test payload for echo r := roadrunner.Payload{ Context: nil, - Body: []byte("test"), + Body: []byte(Response), } errCh := make(chan error, 1) @@ -88,7 +89,7 @@ func (f *Foo) Serve() chan error { return errCh } - if string(rsp.Body) != "test" { + if string(rsp.Body) != Response { errCh <- errors.E("response from worker is wrong", errors.Errorf("response: %s", rsp.Body)) return errCh } @@ -115,7 +116,7 @@ func (f *Foo) Serve() chan error { } // echo of the "test" should be -> test - if string(rsp.Body) != "test" { + if string(rsp.Body) != Response { errCh <- errors.E("response from worker is wrong", errors.Errorf("response: %s", rsp.Body)) return errCh } diff --git a/plugins/app/tests/plugin_sockets.go b/plugins/app/tests/plugin_sockets.go index 2b7da312..585264f6 100644 --- a/plugins/app/tests/plugin_sockets.go +++ b/plugins/app/tests/plugin_sockets.go @@ -30,7 +30,7 @@ func (f *Foo2) Serve() chan error { // test payload for echo r := roadrunner.Payload{ Context: nil, - Body: []byte("test"), + Body: []byte(Response), } err = f.configProvider.UnmarshalKey(ConfigSection, conf) @@ -70,7 +70,7 @@ func (f *Foo2) Serve() chan error { return errCh } - if string(rsp.Body) != "test" { + if string(rsp.Body) != Response { errCh <- errors.E("response from worker is wrong", errors.Errorf("response: %s", rsp.Body)) return errCh } @@ -97,7 +97,7 @@ func (f *Foo2) Serve() chan error { } // echo of the "test" should be -> test - if string(rsp.Body) != "test" { + if string(rsp.Body) != Response { errCh <- errors.E("response from worker is wrong", errors.Errorf("response: %s", rsp.Body)) return errCh } diff --git a/plugins/app/tests/plugin_tcp.go b/plugins/app/tests/plugin_tcp.go index 1a236db0..6abc533d 100644 --- a/plugins/app/tests/plugin_tcp.go +++ b/plugins/app/tests/plugin_tcp.go @@ -30,7 +30,7 @@ func (f *Foo3) Serve() chan error { // test payload for echo r := roadrunner.Payload{ Context: nil, - Body: []byte("test"), + Body: []byte(Response), } err = f.configProvider.UnmarshalKey(ConfigSection, conf) @@ -70,7 +70,7 @@ func (f *Foo3) Serve() chan error { return errCh } - if string(rsp.Body) != "test" { + if string(rsp.Body) != Response { errCh <- errors.E("response from worker is wrong", errors.Errorf("response: %s", rsp.Body)) return errCh } @@ -97,7 +97,7 @@ func (f *Foo3) Serve() chan error { } // echo of the "test" should be -> test - if string(rsp.Body) != "test" { + if string(rsp.Body) != Response { errCh <- errors.E("response from worker is wrong", errors.Errorf("response: %s", rsp.Body)) return errCh } -- cgit v1.2.3