Fixed configuration checks for "max" property.

This commit is contained in:
Andrey Zelenkov
2018-02-06 20:31:48 +03:00
parent 5c35d30cc8
commit b4e467e669
2 changed files with 16 additions and 16 deletions

View File

@@ -544,8 +544,6 @@ nxt_conf_vldt_processes(nxt_conf_validation_t *vldt, nxt_conf_value_t *value,
nxt_int_t ret; nxt_int_t ret;
nxt_conf_vldt_processes_conf_t proc; nxt_conf_vldt_processes_conf_t proc;
static nxt_str_t max_str = nxt_string("max");
if (nxt_conf_type(value) == NXT_CONF_INTEGER) { if (nxt_conf_type(value) == NXT_CONF_INTEGER) {
int_value = nxt_conf_get_integer(value); int_value = nxt_conf_get_integer(value);
@@ -589,8 +587,6 @@ nxt_conf_vldt_processes(nxt_conf_validation_t *vldt, nxt_conf_value_t *value,
"not exceed %d.", NXT_INT32_T_MAX); "not exceed %d.", NXT_INT32_T_MAX);
} }
if (nxt_conf_get_object_member(value, &max_str, NULL) != NULL) {
if (proc.max < 1) { if (proc.max < 1) {
return nxt_conf_vldt_error(vldt, "The \"max\" number must be equal " return nxt_conf_vldt_error(vldt, "The \"max\" number must be equal "
"to or greater than 1."); "to or greater than 1.");
@@ -605,7 +601,6 @@ nxt_conf_vldt_processes(nxt_conf_validation_t *vldt, nxt_conf_value_t *value,
return nxt_conf_vldt_error(vldt, "The \"spare\" number must be " return nxt_conf_vldt_error(vldt, "The \"spare\" number must be "
"lower than \"max\"."); "lower than \"max\".");
} }
}
if (proc.idle_timeout < 0) { if (proc.idle_timeout < 0) {
return nxt_conf_vldt_error(vldt, "The \"idle_timeout\" number must not " return nxt_conf_vldt_error(vldt, "The \"idle_timeout\" number must not "

View File

@@ -67,6 +67,11 @@ def application(env, start_response):
self.assertIn('error', self.conf_get('/applications/' + self.app_name + self.assertIn('error', self.conf_get('/applications/' + self.app_name +
'/processes/idle_timeout'), 'idle_timeout no access') '/processes/idle_timeout'), 'idle_timeout no access')
def test_python_processes_spare_gt_max_default(self):
self.assertIn('error', self.conf({"spare": 2},
'/applications/' + self.app_name + '/processes'),
'spare greater than max default')
def test_python_processes_spare_gt_max(self): def test_python_processes_spare_gt_max(self):
self.assertIn('error', self.conf({ self.assertIn('error', self.conf({
"spare": 2, "spare": 2,