summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorTiago Natel <t.nateldemoura@f5.com>2019-11-11 14:35:29 +0000
committerTiago Natel <t.nateldemoura@f5.com>2019-11-11 14:35:29 +0000
commitabbad122bb48cb1d8b650158a3e6180dbe5ee9e5 (patch)
treeac2199ac78c6902eb6c674600fc5c5ee718076fc /test
parent417cc7be7c0c6f6e62f0916f671bbf0a4460226b (diff)
downloadunit-abbad122bb48cb1d8b650158a3e6180dbe5ee9e5.tar.gz
unit-abbad122bb48cb1d8b650158a3e6180dbe5ee9e5.tar.bz2
Tests: added support for testing "user" and "group".
Diffstat (limited to 'test')
-rw-r--r--test/unit/applications/lang/go.py5
-rw-r--r--test/unit/applications/lang/java.py5
-rw-r--r--test/unit/applications/lang/node.py5
-rw-r--r--test/unit/applications/lang/perl.py5
-rw-r--r--test/unit/applications/lang/php.py5
-rw-r--r--test/unit/applications/lang/python.py5
-rw-r--r--test/unit/applications/lang/ruby.py5
-rw-r--r--test/unit/applications/proto.py14
8 files changed, 34 insertions, 15 deletions
diff --git a/test/unit/applications/lang/go.py b/test/unit/applications/lang/go.py
index 18345828..b1da8071 100644
--- a/test/unit/applications/lang/go.py
+++ b/test/unit/applications/lang/go.py
@@ -44,7 +44,7 @@ class TestApplicationGo(TestApplicationProto):
return process
- def load(self, script, name='app'):
+ def load(self, script, name='app', **kwargs):
self.prepare_env(script, name)
self._load_conf(
@@ -60,5 +60,6 @@ class TestApplicationGo(TestApplicationProto):
"executable": self.testdir + "/go/" + name,
}
},
- }
+ },
+ **kwargs
)
diff --git a/test/unit/applications/lang/java.py b/test/unit/applications/lang/java.py
index bcf87f59..a370d96b 100644
--- a/test/unit/applications/lang/java.py
+++ b/test/unit/applications/lang/java.py
@@ -6,7 +6,7 @@ from unit.applications.proto import TestApplicationProto
class TestApplicationJava(TestApplicationProto):
- def load(self, script, name='app'):
+ def load(self, script, name='app', **kwargs):
app_path = self.testdir + '/java'
web_inf_path = app_path + '/WEB-INF/'
classes_path = web_inf_path + 'classes/'
@@ -82,5 +82,6 @@ class TestApplicationJava(TestApplicationProto):
"webapp": app_path,
}
},
- }
+ },
+ **kwargs
)
diff --git a/test/unit/applications/lang/node.py b/test/unit/applications/lang/node.py
index f2752321..d818298f 100644
--- a/test/unit/applications/lang/node.py
+++ b/test/unit/applications/lang/node.py
@@ -15,7 +15,7 @@ class TestApplicationNode(TestApplicationProto):
return unit if not complete_check else unit.complete()
- def load(self, script, name='app.js'):
+ def load(self, script, name='app.js', **kwargs):
# copy application
shutil.copytree(
@@ -42,5 +42,6 @@ class TestApplicationNode(TestApplicationProto):
"executable": name,
}
},
- }
+ },
+ **kwargs
)
diff --git a/test/unit/applications/lang/perl.py b/test/unit/applications/lang/perl.py
index 79df2cfa..d32aca33 100644
--- a/test/unit/applications/lang/perl.py
+++ b/test/unit/applications/lang/perl.py
@@ -4,7 +4,7 @@ from unit.applications.proto import TestApplicationProto
class TestApplicationPerl(TestApplicationProto):
application_type = "perl"
- def load(self, script, name='psgi.pl'):
+ def load(self, script, name='psgi.pl', **kwargs):
script_path = self.current_dir + '/perl/' + script
self._load_conf(
@@ -18,5 +18,6 @@ class TestApplicationPerl(TestApplicationProto):
"script": script_path + '/' + name,
}
},
- }
+ },
+ **kwargs
)
diff --git a/test/unit/applications/lang/php.py b/test/unit/applications/lang/php.py
index 9c54368d..6b1677e6 100644
--- a/test/unit/applications/lang/php.py
+++ b/test/unit/applications/lang/php.py
@@ -4,7 +4,7 @@ from unit.applications.proto import TestApplicationProto
class TestApplicationPHP(TestApplicationProto):
application_type = "php"
- def load(self, script, name='index.php'):
+ def load(self, script, name='index.php', **kwargs):
script_path = self.current_dir + '/php/' + script
self._load_conf(
@@ -19,5 +19,6 @@ class TestApplicationPHP(TestApplicationProto):
"index": name,
}
},
- }
+ },
+ **kwargs
)
diff --git a/test/unit/applications/lang/python.py b/test/unit/applications/lang/python.py
index ded76cb6..fdda024a 100644
--- a/test/unit/applications/lang/python.py
+++ b/test/unit/applications/lang/python.py
@@ -4,7 +4,7 @@ from unit.applications.proto import TestApplicationProto
class TestApplicationPython(TestApplicationProto):
application_type = "python"
- def load(self, script, name=None):
+ def load(self, script, name=None, **kwargs):
if name is None:
name = script
@@ -22,5 +22,6 @@ class TestApplicationPython(TestApplicationProto):
"module": "wsgi",
}
},
- }
+ },
+ **kwargs
)
diff --git a/test/unit/applications/lang/ruby.py b/test/unit/applications/lang/ruby.py
index d30735ad..8c8acecc 100644
--- a/test/unit/applications/lang/ruby.py
+++ b/test/unit/applications/lang/ruby.py
@@ -4,7 +4,7 @@ from unit.applications.proto import TestApplicationProto
class TestApplicationRuby(TestApplicationProto):
application_type = "ruby"
- def load(self, script, name='config.ru'):
+ def load(self, script, name='config.ru', **kwargs):
script_path = self.current_dir + '/ruby/' + script
self._load_conf(
@@ -18,5 +18,6 @@ class TestApplicationRuby(TestApplicationProto):
"script": script_path + '/' + name,
}
},
- }
+ },
+ **kwargs
)
diff --git a/test/unit/applications/proto.py b/test/unit/applications/proto.py
index 4105473f..ae1af354 100644
--- a/test/unit/applications/proto.py
+++ b/test/unit/applications/proto.py
@@ -25,7 +25,19 @@ class TestApplicationProto(TestControl):
return found
- def _load_conf(self, conf):
+ def _load_conf(self, conf, **kwargs):
+ if 'applications' in conf:
+ for app in conf['applications'].keys():
+ app_conf = conf['applications'][app]
+ if 'user' in kwargs:
+ app_conf['user'] = kwargs['user']
+
+ if 'group' in kwargs:
+ app_conf['group'] = kwargs['group']
+
+ if 'isolation' in kwargs:
+ app_conf['isolation'] = kwargs['isolation']
+
self.assertIn(
'success', self.conf(conf), 'load application configuration'
)