diff options
Diffstat (limited to 'pkg/transport/pipe')
-rwxr-xr-x | pkg/transport/pipe/pipe_factory.go | 5 | ||||
-rw-r--r-- | pkg/transport/pipe/pipe_factory_spawn_test.go | 10 | ||||
-rwxr-xr-x | pkg/transport/pipe/pipe_factory_test.go | 10 |
3 files changed, 13 insertions, 12 deletions
diff --git a/pkg/transport/pipe/pipe_factory.go b/pkg/transport/pipe/pipe_factory.go index dd7c5841..929043a7 100755 --- a/pkg/transport/pipe/pipe_factory.go +++ b/pkg/transport/pipe/pipe_factory.go @@ -8,6 +8,7 @@ import ( "github.com/spiral/goridge/v3/pkg/pipe" "github.com/spiral/roadrunner/v2/internal" "github.com/spiral/roadrunner/v2/pkg/events" + "github.com/spiral/roadrunner/v2/pkg/states" "github.com/spiral/roadrunner/v2/pkg/worker" "go.uber.org/multierr" ) @@ -92,7 +93,7 @@ func (f *Factory) SpawnWorkerWithTimeout(ctx context.Context, cmd *exec.Cmd, lis } // everything ok, set ready state - w.State().Set(internal.StateReady) + w.State().Set(states.StateReady) // return worker c <- SpawnResult{ @@ -152,7 +153,7 @@ func (f *Factory) SpawnWorker(cmd *exec.Cmd, listeners ...events.Listener) (*wor } // everything ok, set ready state - w.State().Set(internal.StateReady) + w.State().Set(states.StateReady) return w, nil } diff --git a/pkg/transport/pipe/pipe_factory_spawn_test.go b/pkg/transport/pipe/pipe_factory_spawn_test.go index d4949c82..e247324c 100644 --- a/pkg/transport/pipe/pipe_factory_spawn_test.go +++ b/pkg/transport/pipe/pipe_factory_spawn_test.go @@ -8,9 +8,9 @@ import ( "time" "github.com/spiral/errors" - "github.com/spiral/roadrunner/v2/internal" "github.com/spiral/roadrunner/v2/pkg/events" "github.com/spiral/roadrunner/v2/pkg/payload" + "github.com/spiral/roadrunner/v2/pkg/states" "github.com/spiral/roadrunner/v2/pkg/worker" "github.com/stretchr/testify/assert" ) @@ -21,13 +21,13 @@ func Test_GetState2(t *testing.T) { w, err := NewPipeFactory().SpawnWorker(cmd) go func() { assert.NoError(t, w.Wait()) - assert.Equal(t, internal.StateStopped, w.State().Value()) + assert.Equal(t, states.StateStopped, w.State().Value()) }() assert.NoError(t, err) assert.NotNil(t, w) - assert.Equal(t, internal.StateReady, w.State().Value()) + assert.Equal(t, states.StateReady, w.State().Value()) assert.NoError(t, w.Stop()) } @@ -40,13 +40,13 @@ func Test_Kill2(t *testing.T) { go func() { defer wg.Done() assert.Error(t, w.Wait()) - assert.Equal(t, internal.StateErrored, w.State().Value()) + assert.Equal(t, states.StateErrored, w.State().Value()) }() assert.NoError(t, err) assert.NotNil(t, w) - assert.Equal(t, internal.StateReady, w.State().Value()) + assert.Equal(t, states.StateReady, w.State().Value()) err = w.Kill() if err != nil { t.Errorf("error killing the Process: error %v", err) diff --git a/pkg/transport/pipe/pipe_factory_test.go b/pkg/transport/pipe/pipe_factory_test.go index 38166b85..b23af19f 100755 --- a/pkg/transport/pipe/pipe_factory_test.go +++ b/pkg/transport/pipe/pipe_factory_test.go @@ -9,9 +9,9 @@ import ( "time" "github.com/spiral/errors" - "github.com/spiral/roadrunner/v2/internal" "github.com/spiral/roadrunner/v2/pkg/events" "github.com/spiral/roadrunner/v2/pkg/payload" + "github.com/spiral/roadrunner/v2/pkg/states" "github.com/spiral/roadrunner/v2/pkg/worker" "github.com/stretchr/testify/assert" ) @@ -23,13 +23,13 @@ func Test_GetState(t *testing.T) { w, err := NewPipeFactory().SpawnWorkerWithTimeout(ctx, cmd) go func() { assert.NoError(t, w.Wait()) - assert.Equal(t, internal.StateStopped, w.State().Value()) + assert.Equal(t, states.StateStopped, w.State().Value()) }() assert.NoError(t, err) assert.NotNil(t, w) - assert.Equal(t, internal.StateReady, w.State().Value()) + assert.Equal(t, states.StateReady, w.State().Value()) err = w.Stop() if err != nil { t.Errorf("error stopping the Process: error %v", err) @@ -46,13 +46,13 @@ func Test_Kill(t *testing.T) { go func() { defer wg.Done() assert.Error(t, w.Wait()) - assert.Equal(t, internal.StateErrored, w.State().Value()) + assert.Equal(t, states.StateErrored, w.State().Value()) }() assert.NoError(t, err) assert.NotNil(t, w) - assert.Equal(t, internal.StateReady, w.State().Value()) + assert.Equal(t, states.StateReady, w.State().Value()) err = w.Kill() if err != nil { t.Errorf("error killing the Process: error %v", err) |