summaryrefslogtreecommitdiffhomepage
path: root/test/test_configuration.py
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2018-01-29 16:17:36 +0300
committerMax Romanov <max.romanov@nginx.com>2018-01-29 16:17:36 +0300
commit9cd4fdbdb78e035254e8094b5cff2155857ab764 (patch)
tree6de4ee721996740cbeda8647e11b8b2aa18e704f /test/test_configuration.py
parenta36babddef203d79dc37736661e1a042df4064f8 (diff)
downloadunit-9cd4fdbdb78e035254e8094b5cff2155857ab764.tar.gz
unit-9cd4fdbdb78e035254e8094b5cff2155857ab764.tar.bz2
Introducing extended app process management.
- Pre-fork 'processes.spare' application processes; - fork more processes to keep 'processes.spare' idle processes; - fork on-demand up to 'processes.max' count; - scale down idle application processes above 'processes.spare' after 'processes.idle_timeout'; - number of concurrently started application processes also limited by 'processes.spare' (or 1, if spare is 0).
Diffstat (limited to '')
-rw-r--r--test/test_configuration.py30
1 files changed, 14 insertions, 16 deletions
diff --git a/test/test_configuration.py b/test/test_configuration.py
index f7490069..700e4aa1 100644
--- a/test/test_configuration.py
+++ b/test/test_configuration.py
@@ -14,7 +14,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
{
"ap\u0070": {
"type": "\u0070ython",
- "workers": 1,
+ "processes": { "spare": 0 },
"path": "\u002Fapp",
"module": "wsgi"
}
@@ -25,7 +25,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
self.assertIn('success', self.conf({
"приложение": {
"type": "python",
- "workers": 1,
+ "processes": { "spare": 0 },
"path": "/app",
"module": "wsgi"
}
@@ -36,7 +36,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
{
"app": {
"type": "python",
- "workers": \u0031,
+ "processes": { "spare": \u0030 },
"path": "/app",
"module": "wsgi"
}
@@ -49,18 +49,16 @@ class TestUnitConfiguration(unit.TestUnitControl):
def test_applications_string(self):
self.assertIn('error', self.conf('"{}"', '/applications'), 'string')
- @unittest.expectedFailure
- def test_negative_workers(self):
+ def test_negative_spare(self):
self.assertIn('error', self.conf({
"app": {
"type": "python",
- "workers": -1,
+ "processes": { "spare": -1 },
"path": "/app",
"module": "wsgi"
}
- }, '/applications'), 'negative workers')
+ }, '/applications'), 'negative spare')
- @unittest.expectedFailure
def test_applications_type_only(self):
self.assertIn('error', self.conf({
"app": {
@@ -73,7 +71,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
{
app": {
"type": "python",
- "workers": 1,
+ "processes": { "spare": 0 },
"path": "/app",
"module": "wsgi"
}
@@ -85,7 +83,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
{
"app" {
"type": "python",
- "workers": 1,
+ "processes": { "spare": 0 },
"path": "/app",
"module": "wsgi"
}
@@ -97,7 +95,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
{
"app": {
"type": "python"
- "workers": 1,
+ "processes": { "spare": 0 },
"path": "/app",
"module": "wsgi"
}
@@ -112,7 +110,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
self.assertIn('success', self.conf({
"app": {
"type": "python",
- "workers": 1,
+ "processes": { "spare": 0 },
"path": "../app",
"module": "wsgi"
}
@@ -137,7 +135,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
"applications": {
"app": {
"type": "python",
- "workers": 1,
+ "processes": { "spare": 0 },
"path": "/app",
"module": "wsgi"
}
@@ -154,7 +152,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
"applications": {
"app": {
"type": "python",
- "workers": 1,
+ "processes": { "spare": 0 },
"path": "/app",
"module": "wsgi"
}
@@ -171,7 +169,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
"applications": {
"app": {
"type": "python",
- "workers": 1,
+ "processes": { "spare": 0 },
"path": "/app",
"module": "wsgi"
}
@@ -188,7 +186,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
"applications": {
"app": {
"type": "python",
- "workers": 1,
+ "processes": { "spare": 0 },
"path": "/app",
"module": "wsgi"
}