Load custom config files
This commit is contained in:
parent
7b61be60d8
commit
c2beff08fc
5 changed files with 74 additions and 7 deletions
2
src/tests/fixtures/00_haproxy.cfg
vendored
Normal file
2
src/tests/fixtures/00_haproxy.cfg
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
global
|
||||
maxconn 4000
|
||||
2
src/tests/fixtures/10_haproxy.cfg
vendored
Normal file
2
src/tests/fixtures/10_haproxy.cfg
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
global
|
||||
maxconn 5000
|
||||
44
src/tests/test_daemonize.py
Normal file
44
src/tests/test_daemonize.py
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import json
|
||||
import pytest
|
||||
import os
|
||||
import re
|
||||
import random
|
||||
import string
|
||||
from functions import DaemonizeHAProxy
|
||||
|
||||
def test_daemonize_haproxy():
|
||||
daemon = DaemonizeHAProxy()
|
||||
assert daemon is not None
|
||||
|
||||
def test_daemonize_haproxy_check_config():
|
||||
daemon = DaemonizeHAProxy()
|
||||
filed = daemon.get_custom_config_files()
|
||||
assert filed == {}
|
||||
|
||||
def test_daemonize_haproxy_get_haproxy_command_start():
|
||||
daemon = DaemonizeHAProxy()
|
||||
command = daemon.get_haproxy_command("start")
|
||||
assert command == "/usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /var/run/haproxy.sock"
|
||||
|
||||
def test_daemonize_haproxy_get_haproxy_command_reload():
|
||||
daemon = DaemonizeHAProxy()
|
||||
command = daemon.get_haproxy_command("reload")
|
||||
assert command == "/usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -x /var/run/haproxy.sock -sf "
|
||||
|
||||
def test_daemonize_haproxy_check_config():
|
||||
daemon = DaemonizeHAProxy(os.path.abspath(os.path.dirname(__file__)) + '/fixtures')
|
||||
filed = daemon.get_custom_config_files()
|
||||
assert filed == {
|
||||
os.path.dirname(__file__) + "/fixtures/00_haproxy.cfg": os.path.getmtime(os.path.dirname(__file__) + "/fixtures/00_haproxy.cfg"),
|
||||
os.path.dirname(__file__) + "/fixtures/10_haproxy.cfg": os.path.getmtime(os.path.dirname(__file__) + "/fixtures/10_haproxy.cfg")
|
||||
}
|
||||
|
||||
def test_daemonize_haproxy_get_haproxy_command_start():
|
||||
daemon = DaemonizeHAProxy(os.path.abspath(os.path.dirname(__file__)) + '/fixtures')
|
||||
command = daemon.get_haproxy_command("start")
|
||||
assert command == "/usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -f %s/00_haproxy.cfg -f %s/10_haproxy.cfg -p /run/haproxy.pid -S /var/run/haproxy.sock" % (os.path.dirname(__file__) + "/fixtures", os.path.dirname(__file__) + "/fixtures")
|
||||
|
||||
def test_daemonize_haproxy_get_haproxy_command_reload():
|
||||
daemon = DaemonizeHAProxy(os.path.abspath(os.path.dirname(__file__)) + '/fixtures')
|
||||
command = daemon.get_haproxy_command("reload")
|
||||
assert command == "/usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -f %s/00_haproxy.cfg -f %s/10_haproxy.cfg -p /run/haproxy.pid -x /var/run/haproxy.sock -sf " % (os.path.dirname(__file__) + "/fixtures", os.path.dirname(__file__) + "/fixtures")
|
||||
Loading…
Add table
Add a link
Reference in a new issue