summaryrefslogtreecommitdiff
path: root/transport/pipe/pipe_factory_test.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-10-06 18:04:29 +0300
committerValery Piashchynski <[email protected]>2021-10-06 18:04:29 +0300
commit098e5ea8d869ca60ece4fcdf931e725549a85536 (patch)
tree777fdcb561deb93779afba3d8e78a78526b5c197 /transport/pipe/pipe_factory_test.go
parentc8409d71958d7eba8595ccbe8950c49077a67c4d (diff)
Add test scripts for the pipes and sockets
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'transport/pipe/pipe_factory_test.go')
-rwxr-xr-xtransport/pipe/pipe_factory_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/transport/pipe/pipe_factory_test.go b/transport/pipe/pipe_factory_test.go
index f8198610..b4ba8c87 100755
--- a/transport/pipe/pipe_factory_test.go
+++ b/transport/pipe/pipe_factory_test.go
@@ -179,6 +179,33 @@ func Test_Pipe_Echo(t *testing.T) {
assert.Equal(t, "hello", res.String())
}
+func Test_Pipe_Echo_Script(t *testing.T) {
+ t.Parallel()
+ cmd := exec.Command("sh", "../../tests/pipes_test_script.sh")
+ ctx := context.Background()
+ w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer func() {
+ err = w.Stop()
+ if err != nil {
+ t.Errorf("error stopping the Process: error %v", err)
+ }
+ }()
+
+ sw := worker.From(w)
+
+ res, err := sw.Exec(&payload.Payload{Body: []byte("hello")})
+
+ assert.NoError(t, err)
+ assert.NotNil(t, res)
+ assert.NotNil(t, res.Body)
+ assert.Empty(t, res.Context)
+
+ assert.Equal(t, "hello", res.String())
+}
+
func Test_Pipe_Broken(t *testing.T) {
t.Parallel()
cmd := exec.Command("php", "../../tests/client.php", "broken", "pipes")