File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,14 @@ func (cfg *Config) Valid() error {
34
34
return errors .New ("mailformed workers config" )
35
35
}
36
36
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
+
37
45
if ! strings .Contains (cfg .Address , ":" ) {
38
46
return errors .New ("mailformed server address" )
39
47
}
Original file line number Diff line number Diff line change @@ -64,6 +64,47 @@ func Test_Config_NoWorkers(t *testing.T) {
64
64
assert .Error (t , cfg .Valid ())
65
65
}
66
66
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
+
67
108
func Test_Config_InvalidAddress (t * testing.T ) {
68
109
cfg := & Config {
69
110
Enable : true ,
You can’t perform that action at this time.
0 commit comments