diff options
author | Wolfy-J <[email protected]> | 2018-06-13 22:13:12 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-13 22:13:12 +0300 |
commit | 376547add61b3900711d33f6a20f395f7d1f4aea (patch) | |
tree | 15f3c133a896ec042934611f20a7f9598cace8f3 /service/http/service_test.go | |
parent | 426d0034ea8c07b9303b82275934c35db77398ed (diff) |
more tests
Diffstat (limited to 'service/http/service_test.go')
-rw-r--r-- | service/http/service_test.go | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/service/http/service_test.go b/service/http/service_test.go index 7ade5183..27d05783 100644 --- a/service/http/service_test.go +++ b/service/http/service_test.go @@ -23,8 +23,7 @@ func (cfg *testCfg) Get(name string) service.Config { return nil } func (cfg *testCfg) Unmarshal(out interface{}) error { - json.Unmarshal([]byte(cfg.httpCfg), out) - return nil + return json.Unmarshal([]byte(cfg.httpCfg), out) } func Test_Service_NoConfig(t *testing.T) { @@ -330,6 +329,32 @@ func Test_Service_Error2(t *testing.T) { assert.Error(t, c.Serve()) } +func Test_Service_Error3(t *testing.T) { + logger, _ := test.NewNullLogger() + logger.SetLevel(logrus.DebugLevel) + + c := service.NewContainer(logger) + c.Register(Name, &Service{}) + + assert.Error(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 + } + } + }`})) +} func tmpDir() string { p := os.TempDir() |