Skip to content

Commit 0e2cbb7

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 8b4ae04 + 6d9559f commit 0e2cbb7

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

service/http/config.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ func (cfg *Config) Valid() error {
3434
return errors.New("mailformed workers config")
3535
}
3636

37+
if cfg.Workers.Pool == nil {
38+
return errors.New("mailformed workers config (pool config is missing)")
39+
}
40+
41+
if err := cfg.Workers.Pool.Valid(); err != nil {
42+
return err
43+
}
44+
3745
if !strings.Contains(cfg.Address, ":") {
3846
return errors.New("mailformed server address")
3947
}

service/http/config_test.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,47 @@ func Test_Config_NoWorkers(t *testing.T) {
6464
assert.Error(t, cfg.Valid())
6565
}
6666

67+
func Test_Config_NoPool(t *testing.T) {
68+
cfg := &Config{
69+
Enable: true,
70+
Address: ":8080",
71+
MaxRequest: 1024,
72+
Uploads: &UploadsConfig{
73+
Dir: os.TempDir(),
74+
Forbid: []string{".go"},
75+
},
76+
Workers: &roadrunner.ServerConfig{
77+
Command: "php php-src/tests/client.php echo pipes",
78+
Relay: "pipes",
79+
Pool: &roadrunner.Config{
80+
NumWorkers: 0,
81+
AllocateTimeout: time.Second,
82+
DestroyTimeout: time.Second,
83+
},
84+
},
85+
}
86+
87+
assert.Error(t, cfg.Valid())
88+
}
89+
90+
func Test_Config_DeadPool(t *testing.T) {
91+
cfg := &Config{
92+
Enable: true,
93+
Address: ":8080",
94+
MaxRequest: 1024,
95+
Uploads: &UploadsConfig{
96+
Dir: os.TempDir(),
97+
Forbid: []string{".go"},
98+
},
99+
Workers: &roadrunner.ServerConfig{
100+
Command: "php php-src/tests/client.php echo pipes",
101+
Relay: "pipes",
102+
},
103+
}
104+
105+
assert.Error(t, cfg.Valid())
106+
}
107+
67108
func Test_Config_InvalidAddress(t *testing.T) {
68109
cfg := &Config{
69110
Enable: true,

0 commit comments

Comments
 (0)