diff options
author | Wolfy-J <[email protected]> | 2018-06-05 22:48:27 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-05 22:48:27 +0300 |
commit | 6adaf713b47c9a3ab3a516e21d2d4ecf7f2075d6 (patch) | |
tree | 6bcf1bfea1e2f87a3ae7065612c0df43c90c1cdc /protocol_test.go | |
parent | 3112f9b58c73773cea972fd79f04d33f8f7d7edd (diff) |
breaking the tests
Diffstat (limited to 'protocol_test.go')
-rw-r--r-- | protocol_test.go | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/protocol_test.go b/protocol_test.go deleted file mode 100644 index ed3fe461..00000000 --- a/protocol_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package roadrunner - -import ( - "github.com/pkg/errors" - "github.com/spiral/goridge" - "github.com/stretchr/testify/assert" - "testing" -) - -type relayMock struct { - error bool - payload string -} - -func (r *relayMock) Send(data []byte, flags byte) (err error) { - if r.error { - return errors.New("send error") - } - - return nil -} - -func (r *relayMock) Receive() (data []byte, p goridge.Prefix, err error) { - return []byte(r.payload), goridge.NewPrefix().WithFlag(goridge.PayloadControl), nil -} - -func (r *relayMock) Close() error { - return nil -} - -func Test_Protocol_Errors(t *testing.T) { - err := sendPayload(&relayMock{}, make(chan int)) - assert.Error(t, err) -} - -func Test_Protocol_FetchPID(t *testing.T) { - pid, err := fetchPID(&relayMock{error: false, payload: "{\"pid\":100}"}) - assert.NoError(t, err) - assert.Equal(t, 100, pid) - - _, err = fetchPID(&relayMock{error: true, payload: "{\"pid\":100}"}) - assert.Error(t, err) - - _, err = fetchPID(&relayMock{error: false, payload: "{\"pid:100"}) - assert.Error(t, err) -} |