Fix com duplicated name in tests
This commit is contained in:
parent
9d97d568ec
commit
d8049f331f
2 changed files with 12 additions and 7 deletions
|
|
@ -22,7 +22,7 @@ def test_daemonize_haproxy_get_haproxy_command_reload():
|
||||||
command = daemon.get_haproxy_command(DaemonizeHAProxy.HAPROXY_RELOAD)
|
command = daemon.get_haproxy_command(DaemonizeHAProxy.HAPROXY_RELOAD)
|
||||||
assert command == "/usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -x /var/run/haproxy.sock -sf "
|
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():
|
def test_daemonize_haproxy2_check_config():
|
||||||
daemon = DaemonizeHAProxy(os.path.abspath(os.path.dirname(__file__)) + '/fixtures')
|
daemon = DaemonizeHAProxy(os.path.abspath(os.path.dirname(__file__)) + '/fixtures')
|
||||||
filed = daemon.get_custom_config_files()
|
filed = daemon.get_custom_config_files()
|
||||||
assert filed == {
|
assert filed == {
|
||||||
|
|
@ -30,13 +30,13 @@ def test_daemonize_haproxy_check_config():
|
||||||
os.path.dirname(__file__) + "/fixtures/10_haproxy.cfg": os.path.getmtime(os.path.dirname(__file__) + "/fixtures/10_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():
|
def test_daemonize_haproxy2_get_haproxy_command_start():
|
||||||
daemon = DaemonizeHAProxy(os.path.abspath(os.path.dirname(__file__)) + '/fixtures')
|
daemon = DaemonizeHAProxy(os.path.abspath(os.path.dirname(__file__)) + '/fixtures')
|
||||||
command = daemon.get_haproxy_command(DaemonizeHAProxy.HAPROXY_START)
|
command = daemon.get_haproxy_command(DaemonizeHAProxy.HAPROXY_START)
|
||||||
assert command == "/usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -f %s -p /run/haproxy.pid -S /var/run/haproxy.sock" % (os.path.dirname(__file__) + "/fixtures")
|
assert command == "/usr/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -f %s -p /run/haproxy.pid -S /var/run/haproxy.sock" % (os.path.dirname(__file__) + "/fixtures")
|
||||||
|
|
||||||
|
|
||||||
def test_daemonize_haproxy_get_haproxy_command_reload():
|
def test_daemonize_haproxy2_get_haproxy_command_reload():
|
||||||
tmp_pid_file = "/tmp/tmp_pid.txt"
|
tmp_pid_file = "/tmp/tmp_pid.txt"
|
||||||
Functions.save(tmp_pid_file, "10")
|
Functions.save(tmp_pid_file, "10")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,9 @@ def test_functions_run_bash_return():
|
||||||
def test_functions_run_bash_log_and_return_output():
|
def test_functions_run_bash_log_and_return_output():
|
||||||
print()
|
print()
|
||||||
try:
|
try:
|
||||||
return_code, result = Functions.run_bash(loggerDebug, "echo 'test run 4'", log_output=True, return_result=True)
|
return_code, result = Functions.run_bash(loggerDebug, "echo 'test run 4'",
|
||||||
|
log_output=True,
|
||||||
|
return_result=True)
|
||||||
assert return_code == 0
|
assert return_code == 0
|
||||||
assert "".join(result) == 'test run 4'
|
assert "".join(result) == 'test run 4'
|
||||||
log_value = log_stream.getvalue().strip("\x00")
|
log_value = log_stream.getvalue().strip("\x00")
|
||||||
|
|
@ -100,7 +102,8 @@ def test_functions_run_bash_log_and_return_output():
|
||||||
def test_functions_run_bash_ok():
|
def test_functions_run_bash_ok():
|
||||||
print()
|
print()
|
||||||
try:
|
try:
|
||||||
return_code, result = Functions.run_bash(loggerDebug, "%s/fixtures/run_bash.sh" % os.path.dirname(__file__), log_output=True,
|
return_code, result = Functions.run_bash(loggerDebug, "%s/fixtures/run_bash.sh" % os.path.dirname(__file__),
|
||||||
|
log_output=True,
|
||||||
return_result=False)
|
return_result=False)
|
||||||
assert return_code == 0
|
assert return_code == 0
|
||||||
assert result == []
|
assert result == []
|
||||||
|
|
@ -114,7 +117,8 @@ def test_functions_run_bash_ok():
|
||||||
def test_functions_run_bash_fail():
|
def test_functions_run_bash_fail():
|
||||||
print()
|
print()
|
||||||
try:
|
try:
|
||||||
return_code, result = Functions.run_bash(loggerDebug, "%s/fixtures/run_bash.sh 15" % os.path.dirname(__file__), log_output=True,
|
return_code, result = Functions.run_bash(loggerDebug, "%s/fixtures/run_bash.sh 15" % os.path.dirname(__file__),
|
||||||
|
log_output=True,
|
||||||
return_result=False)
|
return_result=False)
|
||||||
assert return_code == 15
|
assert return_code == 15
|
||||||
assert result == []
|
assert result == []
|
||||||
|
|
@ -128,7 +132,8 @@ def test_functions_run_bash_fail():
|
||||||
def test_functions_run_command_not_found():
|
def test_functions_run_command_not_found():
|
||||||
print()
|
print()
|
||||||
try:
|
try:
|
||||||
return_code, result = Functions.run_bash(loggerDebug, "no_command_here", log_output=True,
|
return_code, result = Functions.run_bash(loggerDebug, "no_command_here",
|
||||||
|
log_output=True,
|
||||||
return_result=False)
|
return_result=False)
|
||||||
assert return_code == -99
|
assert return_code == -99
|
||||||
assert str(result) == "[Errno 2] No such file or directory: 'no_command_here'"
|
assert str(result) == "[Errno 2] No such file or directory: 'no_command_here'"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue