diff options
author | Wolfy-J <[email protected]> | 2018-06-13 22:08:25 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-13 22:08:25 +0300 |
commit | cd86c55f8031b585744d7798979543aeea26d022 (patch) | |
tree | 956c0d74fc467bd15fee9565c2469783b3f0b3ce /service/http/service_test.go | |
parent | 66e0df3fb8d96aa011815256ac91b5eedd6721e0 (diff) |
middleware
Diffstat (limited to 'service/http/service_test.go')
-rw-r--r-- | service/http/service_test.go | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/service/http/service_test.go b/service/http/service_test.go index 94dd64d7..7ade5183 100644 --- a/service/http/service_test.go +++ b/service/http/service_test.go @@ -272,6 +272,65 @@ func Test_Service_Listener(t *testing.T) { assert.True(t, true) } +func Test_Service_Error(t *testing.T) { + logger, _ := test.NewNullLogger() + logger.SetLevel(logrus.DebugLevel) + + c := service.NewContainer(logger) + c.Register(Name, &Service{}) + + assert.NoError(t, c.Init(&testCfg{`{ + "enable": true, + "address": ":6029", + "maxRequest": 1024, + "uploads": { + "dir": ` + tmpDir() + `, + "forbid": [] + }, + "workers":{ + "command": "php ../../php-src/tests/http/client.php echo pipes", + "relay": "---", + "pool": { + "numWorkers": 1, + "allocateTimeout": 10000000, + "destroyTimeout": 10000000 + } + } + }`})) + + assert.Error(t, c.Serve()) +} + +func Test_Service_Error2(t *testing.T) { + logger, _ := test.NewNullLogger() + logger.SetLevel(logrus.DebugLevel) + + c := service.NewContainer(logger) + c.Register(Name, &Service{}) + + assert.NoError(t, c.Init(&testCfg{`{ + "enable": true, + "address": ":6029", + "maxRequest": 1024, + "uploads": { + "dir": ` + tmpDir() + `, + "forbid": [] + }, + "workers":{ + "command": "php ../../php-src/tests/http/client.php broken pipes", + "relay": "pipes", + "pool": { + "numWorkers": 1, + "allocateTimeout": 10000000, + "destroyTimeout": 10000000 + } + } + }`})) + + assert.Error(t, c.Serve()) +} + + func tmpDir() string { p := os.TempDir() r, _ := json.Marshal(p) |