diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-13 07:07:16 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-13 07:07:16 +0000 |
commit | f18e7f6920590ee6f2e59be508518b70a4611638 (patch) | |
tree | 2f80c427e740c2c6f7f2a47be2b869b6d9847e58 /static_pool_test.go | |
parent | 5dc83ef5eee77f4d1ef557e5f8b566e75892680d (diff) | |
parent | bbfcd4fb6eb138c616dab01ea610fbf6ed15985b (diff) |
Merge #472
472: feat(http): Distinct app and internal error codes in the handleError function r=48d90782 a=48d90782
This PR introduces distinct error codes for the app and internal RR errors.
Errors:
```go
roadrunner.ErrNoAssociatedPool
roadrunner.ErrAllocateWorker
roadrunner.ErrWorkerNotReady
roadrunner.ErrEmptyPayload
roadrunner.ErrPoolStopped
roadrunner.ErrWorkerAllocateTimeout
roadrunner.ErrAllWorkersAreDead
```
now associated with the internal error codes. All other errors are application errors.
Some types of errors are impossible to distinguish in the RR1, for example `json.Unmarshall` internal error or similar.
The `.rr.yaml` now contain two more options for the errors.
```yaml
http:
internalErrorCode: 502,
appErrorCode: 502
```
Default behavior unchanged (500 error code as before), but now might be overridden.
closes #471
Co-authored-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'static_pool_test.go')
-rw-r--r-- | static_pool_test.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/static_pool_test.go b/static_pool_test.go index 59822186..e2181292 100644 --- a/static_pool_test.go +++ b/static_pool_test.go @@ -1,7 +1,6 @@ package roadrunner import ( - "github.com/stretchr/testify/assert" "log" "os/exec" "runtime" @@ -10,6 +9,8 @@ import ( "sync" "testing" "time" + + "github.com/stretchr/testify/assert" ) var cfg = Config{ @@ -172,7 +173,6 @@ func Test_StaticPool_Broken_Replace(t *testing.T) { p.Destroy() } - func Test_StaticPool_Broken_FromOutside(t *testing.T) { p, err := NewPool( func() *exec.Cmd { return exec.Command("php", "tests/client.php", "echo", "pipes") }, @@ -238,7 +238,6 @@ func Test_StaticPool_AllocateTimeout(t *testing.T) { } }() - // to ensure that worker is already busy time.Sleep(time.Millisecond * 10) @@ -246,7 +245,7 @@ func Test_StaticPool_AllocateTimeout(t *testing.T) { if err == nil { t.Fatal("Test_StaticPool_AllocateTimeout exec should raise error") } - assert.Contains(t, err.Error(), "worker timeout") + assert.Contains(t, err.Error(), "unable to allocate worker") <-done p.Destroy() |