summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-19 22:44:50 +0300
committerWolfy-J <[email protected]>2018-06-19 22:44:50 +0300
commit0e2cbb7b9c3e138a9551ddcab9399769ee68eaa1 (patch)
tree8f1706fe99a113d4c43702f4dda02dfbbde3c3b0
parent8b4ae04b8a4db20b96965a39de97857708c58d5b (diff)
parent6d9559fabb53d9121163ca43c50ee3270bb7d558 (diff)
Merge remote-tracking branch 'origin/master'
-rw-r--r--service/http/config.go8
-rw-r--r--service/http/config_test.go41
2 files changed, 49 insertions, 0 deletions
diff --git a/service/http/config.go b/service/http/config.go
index fb4574b1..19a2e71d 100644
--- a/service/http/config.go
+++ b/service/http/config.go
@@ -34,6 +34,14 @@ 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 err := cfg.Workers.Pool.Valid(); err != nil {
+ return err
+ }
+
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..cb804f4a 100644
--- a/service/http/config_test.go
+++ b/service/http/config_test.go
@@ -64,6 +64,47 @@ 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",
+ Pool: &roadrunner.Config{
+ NumWorkers: 0,
+ AllocateTimeout: time.Second,
+ DestroyTimeout: time.Second,
+ },
+ },
+ }
+
+ assert.Error(t, cfg.Valid())
+}
+
+func Test_Config_DeadPool(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,