Tests: using "pass" option instead of deprecated "application".

This commit is contained in:
Valentin Bartenev
2019-04-22 18:20:53 +03:00
parent 48ae47017b
commit c1a3b06d03
13 changed files with 44 additions and 39 deletions

View File

@@ -92,7 +92,7 @@ Connection: close
def test_access_log_ipv6(self): def test_access_log_ipv6(self):
self.load('empty') self.load('empty')
self.conf({"[::1]:7080": {"application": "empty"}}, 'listeners') self.conf({"[::1]:7080": {"pass": "applications/empty"}}, 'listeners')
self.get(sock_type='ipv6') self.get(sock_type='ipv6')
@@ -110,7 +110,7 @@ Connection: close
addr = self.testdir + '/sock' addr = self.testdir + '/sock'
self.conf({"unix:" + addr: {"application": "empty"}}, 'listeners') self.conf({"unix:" + addr: {"pass": "applications/empty"}}, 'listeners')
self.get(sock_type='unix', addr=addr) self.get(sock_type='unix', addr=addr)

View File

@@ -200,7 +200,7 @@ class TestConfiguration(TestControl):
def test_listeners_no_app(self): def test_listeners_no_app(self):
self.assertIn( self.assertIn(
'error', 'error',
self.conf({"*:7080": {"application": "app"}}, 'listeners'), self.conf({"*:7080": {"pass": "applications/app"}}, 'listeners'),
'listeners no app', 'listeners no app',
) )
@@ -209,7 +209,7 @@ class TestConfiguration(TestControl):
'success', 'success',
self.conf( self.conf(
{ {
"listeners": {"*:7080": {"application": "app"}}, "listeners": {"*:7080": {"pass": "applications/app"}},
"applications": { "applications": {
"app": { "app": {
"type": "python", "type": "python",
@@ -228,7 +228,7 @@ class TestConfiguration(TestControl):
'success', 'success',
self.conf( self.conf(
{ {
"listeners": {"127.0.0.1:7080": {"application": "app"}}, "listeners": {"127.0.0.1:7080": {"pass": "applications/app"}},
"applications": { "applications": {
"app": { "app": {
"type": "python", "type": "python",
@@ -247,7 +247,7 @@ class TestConfiguration(TestControl):
'success', 'success',
self.conf( self.conf(
{ {
"listeners": {"[::1]:7080": {"application": "app"}}, "listeners": {"[::1]:7080": {"pass": "applications/app"}},
"applications": { "applications": {
"app": { "app": {
"type": "python", "type": "python",
@@ -274,7 +274,7 @@ class TestConfiguration(TestControl):
'error', 'error',
self.conf( self.conf(
{ {
"listeners": {"127.0.0.1": {"application": "app"}}, "listeners": {"127.0.0.1": {"pass": "applications/app"}},
"applications": { "applications": {
"app": { "app": {
"type": "python", "type": "python",
@@ -295,7 +295,7 @@ class TestConfiguration(TestControl):
'success', 'success',
self.conf( self.conf(
{ {
"listeners": {"*:7080": {"application": name}}, "listeners": {"*:7080": {"pass": "applications/" + name}},
"applications": { "applications": {
name: { name: {
"type": "python", "type": "python",
@@ -327,7 +327,7 @@ class TestConfiguration(TestControl):
for a in range(apps) for a in range(apps)
}, },
"listeners": { "listeners": {
"*:" + str(7000 + a): {"application": "app-" + str(a)} "*:" + str(7000 + a): {"pass": "applications/app-" + str(a)}
for a in range(apps) for a in range(apps)
}, },
} }
@@ -350,7 +350,7 @@ class TestConfiguration(TestControl):
} }
for a in range(999) for a in range(999)
}, },
"listeners": {"*:7001": {"application": "app-1"}}, "listeners": {"*:7001": {"pass": "applications/app-1"}},
} }
self.assertIn('success', self.conf(conf)) self.assertIn('success', self.conf(conf))

View File

@@ -14,7 +14,7 @@ class TestPHPBasic(TestControl):
} }
conf_basic = { conf_basic = {
"listeners": {"*:7080": {"application": "app"}}, "listeners": {"*:7080": {"pass": "applications/app"}},
"applications": conf_app, "applications": conf_app,
} }
@@ -82,7 +82,7 @@ class TestPHPBasic(TestControl):
self.assertEqual( self.assertEqual(
self.conf_get()['listeners'], self.conf_get()['listeners'],
{"*:7080": {"application": "app"}}, {"*:7080": {"pass": "applications/app"}},
'listeners', 'listeners',
) )
@@ -91,7 +91,7 @@ class TestPHPBasic(TestControl):
self.assertEqual( self.assertEqual(
self.conf_get('listeners'), self.conf_get('listeners'),
{"*:7080": {"application": "app"}}, {"*:7080": {"pass": "applications/app"}},
'listeners prefix', 'listeners prefix',
) )
@@ -100,29 +100,29 @@ class TestPHPBasic(TestControl):
self.assertEqual( self.assertEqual(
self.conf_get('listeners/*:7080'), self.conf_get('listeners/*:7080'),
{"application": "app"}, {"pass": "applications/app"},
'listeners prefix 2', 'listeners prefix 2',
) )
def test_php_change_listener(self): def test_php_change_listener(self):
self.conf(self.conf_basic) self.conf(self.conf_basic)
self.conf({"*:7081": {"application": "app"}}, 'listeners') self.conf({"*:7081": {"pass": "applications/app"}}, 'listeners')
self.assertEqual( self.assertEqual(
self.conf_get('listeners'), self.conf_get('listeners'),
{"*:7081": {"application": "app"}}, {"*:7081": {"pass": "applications/app"}},
'change listener', 'change listener',
) )
def test_php_add_listener(self): def test_php_add_listener(self):
self.conf(self.conf_basic) self.conf(self.conf_basic)
self.conf({"application": "app"}, 'listeners/*:7082') self.conf({"pass": "applications/app"}, 'listeners/*:7082')
self.assertEqual( self.assertEqual(
self.conf_get('listeners'), self.conf_get('listeners'),
{ {
"*:7080": {"application": "app"}, "*:7080": {"pass": "applications/app"},
"*:7082": {"application": "app"}, "*:7082": {"pass": "applications/app"},
}, },
'add listener', 'add listener',
) )

View File

@@ -14,7 +14,7 @@ class TestPythonBasic(TestControl):
} }
conf_basic = { conf_basic = {
"listeners": {"*:7080": {"application": "app"}}, "listeners": {"*:7080": {"pass": "applications/app"}},
"applications": conf_app, "applications": conf_app,
} }
@@ -95,7 +95,7 @@ class TestPythonBasic(TestControl):
self.assertEqual( self.assertEqual(
self.conf_get()['listeners'], self.conf_get()['listeners'],
{"*:7080": {"application": "app"}}, {"*:7080": {"pass": "applications/app"}},
'listeners', 'listeners',
) )
@@ -104,7 +104,7 @@ class TestPythonBasic(TestControl):
self.assertEqual( self.assertEqual(
self.conf_get('listeners'), self.conf_get('listeners'),
{"*:7080": {"application": "app"}}, {"*:7080": {"pass": "applications/app"}},
'listeners prefix', 'listeners prefix',
) )
@@ -113,29 +113,29 @@ class TestPythonBasic(TestControl):
self.assertEqual( self.assertEqual(
self.conf_get('listeners/*:7080'), self.conf_get('listeners/*:7080'),
{"application": "app"}, {"pass": "applications/app"},
'listeners prefix 2', 'listeners prefix 2',
) )
def test_python_change_listener(self): def test_python_change_listener(self):
self.conf(self.conf_basic) self.conf(self.conf_basic)
self.conf({"*:7081": {"application": "app"}}, 'listeners') self.conf({"*:7081": {"pass": "applications/app"}}, 'listeners')
self.assertEqual( self.assertEqual(
self.conf_get('listeners'), self.conf_get('listeners'),
{"*:7081": {"application": "app"}}, {"*:7081": {"pass": "applications/app"}},
'change listener', 'change listener',
) )
def test_python_add_listener(self): def test_python_add_listener(self):
self.conf(self.conf_basic) self.conf(self.conf_basic)
self.conf({"application": "app"}, 'listeners/*:7082') self.conf({"pass": "applications/app"}, 'listeners/*:7082')
self.assertEqual( self.assertEqual(
self.conf_get('listeners'), self.conf_get('listeners'),
{ {
"*:7080": {"application": "app"}, "*:7080": {"pass": "applications/app"},
"*:7082": {"application": "app"}, "*:7082": {"pass": "applications/app"},
}, },
'add listener', 'add listener',
) )

View File

@@ -18,12 +18,17 @@ class TestTLS(TestApplicationTLS):
def add_tls(self, application='empty', cert='default', port=7080): def add_tls(self, application='empty', cert='default', port=7080):
self.conf( self.conf(
{"application": application, "tls": {"certificate": cert}}, {
"pass": "applications/" + application,
"tls": {"certificate": cert}
},
'listeners/*:' + str(port), 'listeners/*:' + str(port),
) )
def remove_tls(self, application='empty', port=7080): def remove_tls(self, application='empty', port=7080):
self.conf({"application": application}, 'listeners/*:' + str(port)) self.conf(
{"pass": "applications/" + application}, 'listeners/*:' + str(port)
)
def test_tls_listener_option_add(self): def test_tls_listener_option_add(self):
self.load('empty') self.load('empty')
@@ -482,7 +487,7 @@ basicConstraints = critical,CA:TRUE"""
read_timeout=1, read_timeout=1,
) )
self.conf({"application": "empty"}, 'listeners/*:7080') self.conf({"pass": "applications/empty"}, 'listeners/*:7080')
self.conf_delete('/certificates/default') self.conf_delete('/certificates/default')
try: try:

View File

@@ -27,7 +27,7 @@ class TestApplicationGo(TestApplicationProto):
self.conf( self.conf(
{ {
"listeners": {"*:7080": {"application": script}}, "listeners": {"*:7080": {"pass": "applications/" + script}},
"applications": { "applications": {
script: { script: {
"type": "external", "type": "external",

View File

@@ -60,7 +60,7 @@ class TestApplicationJava(TestApplicationProto):
self.conf( self.conf(
{ {
"listeners": {"*:7080": {"application": script}}, "listeners": {"*:7080": {"pass": "applications/" + script}},
"applications": { "applications": {
script: { script: {
"unit_jars": self.pardir + '/build', "unit_jars": self.pardir + '/build',

View File

@@ -21,7 +21,7 @@ class TestApplicationNode(TestApplicationProto):
self.conf( self.conf(
{ {
"listeners": {"*:7080": {"application": script}}, "listeners": {"*:7080": {"pass": "applications/" + script}},
"applications": { "applications": {
script: { script: {
"type": "external", "type": "external",

View File

@@ -7,7 +7,7 @@ class TestApplicationPerl(TestApplicationProto):
self.conf( self.conf(
{ {
"listeners": {"*:7080": {"application": script}}, "listeners": {"*:7080": {"pass": "applications/" + script}},
"applications": { "applications": {
script: { script: {
"type": "perl", "type": "perl",

View File

@@ -7,7 +7,7 @@ class TestApplicationPHP(TestApplicationProto):
self.conf( self.conf(
{ {
"listeners": {"*:7080": {"application": script}}, "listeners": {"*:7080": {"pass": "applications/" + script}},
"applications": { "applications": {
script: { script: {
"type": "php", "type": "php",

View File

@@ -10,7 +10,7 @@ class TestApplicationPython(TestApplicationProto):
self.conf( self.conf(
{ {
"listeners": {"*:7080": {"application": name}}, "listeners": {"*:7080": {"pass": "applications/" + name}},
"applications": { "applications": {
name: { name: {
"type": "python", "type": "python",

View File

@@ -7,7 +7,7 @@ class TestApplicationRuby(TestApplicationProto):
self.conf( self.conf(
{ {
"listeners": {"*:7080": {"application": script}}, "listeners": {"*:7080": {"pass": "applications/" + script}},
"applications": { "applications": {
script: { script: {
"type": "ruby", "type": "ruby",

View File

@@ -78,7 +78,7 @@ distinguished_name = req_distinguished_name
self.conf( self.conf(
{ {
"listeners": {"*:7080": {"application": name}}, "listeners": {"*:7080": {"pass": "applications/" + name}},
"applications": { "applications": {
name: { name: {
"type": "python", "type": "python",