diff options
author | Wolfy-J <[email protected]> | 2018-06-19 22:26:40 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-19 22:26:40 +0300 |
commit | 126a8f0dbd040c96168a7dc73986fc76f7d661f4 (patch) | |
tree | 9e8f3aebd4a2c6ad9282269243ee176c27297254 /service/http | |
parent | f83c58e52caa3f10b787b8305147cb2c13cdbd4a (diff) |
stricter pool validations
Diffstat (limited to 'service/http')
-rw-r--r-- | service/http/config.go | 4 | ||||
-rw-r--r-- | service/http/config_test.go | 19 |
2 files changed, 23 insertions, 0 deletions
diff --git a/service/http/config.go b/service/http/config.go index fb4574b1..76a0f539 100644 --- a/service/http/config.go +++ b/service/http/config.go @@ -34,6 +34,10 @@ func (cfg *Config) Valid() error { return errors.New("mailformed workers config") } + if cfg.Workers.Pool == nil { + return errors.New("mailformed workers config (pool config is missing)") + } + if !strings.Contains(cfg.Address, ":") { return errors.New("mailformed server address") } diff --git a/service/http/config_test.go b/service/http/config_test.go index 44c58f35..d47934ea 100644 --- a/service/http/config_test.go +++ b/service/http/config_test.go @@ -64,6 +64,25 @@ func Test_Config_NoWorkers(t *testing.T) { assert.Error(t, cfg.Valid()) } + +func Test_Config_NoPool(t *testing.T) { + cfg := &Config{ + Enable: true, + Address: ":8080", + MaxRequest: 1024, + Uploads: &UploadsConfig{ + Dir: os.TempDir(), + Forbid: []string{".go"}, + }, + Workers: &roadrunner.ServerConfig{ + Command: "php php-src/tests/client.php echo pipes", + Relay: "pipes", + }, + } + + assert.Error(t, cfg.Valid()) +} + func Test_Config_InvalidAddress(t *testing.T) { cfg := &Config{ Enable: true, |