Defining Log Level
This commit is contained in:
parent
dcdccb9236
commit
2ddf276919
8 changed files with 141 additions and 42 deletions
|
|
@ -1,12 +1,20 @@
|
|||
import pytest
|
||||
import os
|
||||
|
||||
from functions import Functions
|
||||
from processor import ContainerEnv
|
||||
|
||||
|
||||
def test_container_env_empty():
|
||||
assert {
|
||||
"customerrors": False,
|
||||
"ssl_mode": "default",
|
||||
"lookup_label": "easyhaproxy"
|
||||
"lookup_label": "easyhaproxy",
|
||||
"logLevel": {
|
||||
"easyhaproxy": Functions.DEBUG,
|
||||
"haproxy": Functions.INFO,
|
||||
"certbot": Functions.DEBUG,
|
||||
},
|
||||
} == ContainerEnv.read()
|
||||
|
||||
# os.environ['CERTBOT_LOG_LEVEL'] = 'warn'
|
||||
|
|
@ -17,7 +25,12 @@ def test_container_env_customerrors():
|
|||
assert {
|
||||
"customerrors": True,
|
||||
"ssl_mode": "default",
|
||||
"lookup_label": "easyhaproxy"
|
||||
"lookup_label": "easyhaproxy",
|
||||
"logLevel": {
|
||||
"easyhaproxy": Functions.DEBUG,
|
||||
"haproxy": Functions.INFO,
|
||||
"certbot": Functions.DEBUG,
|
||||
},
|
||||
} == ContainerEnv.read()
|
||||
finally:
|
||||
os.environ['HAPROXY_CUSTOMERRORS'] = ''
|
||||
|
|
@ -28,7 +41,12 @@ def test_container_env_sslmode():
|
|||
assert {
|
||||
"customerrors": False,
|
||||
"ssl_mode": "strict",
|
||||
"lookup_label": "easyhaproxy"
|
||||
"lookup_label": "easyhaproxy",
|
||||
"logLevel": {
|
||||
"easyhaproxy": Functions.DEBUG,
|
||||
"haproxy": Functions.INFO,
|
||||
"certbot": Functions.DEBUG,
|
||||
},
|
||||
} == ContainerEnv.read()
|
||||
finally:
|
||||
os.environ['EASYHAPROXY_SSL_MODE'] = ''
|
||||
|
|
@ -41,6 +59,11 @@ def test_container_env_stats():
|
|||
"customerrors": False,
|
||||
"ssl_mode": "default",
|
||||
"lookup_label": "easyhaproxy",
|
||||
"logLevel": {
|
||||
"easyhaproxy": Functions.DEBUG,
|
||||
"haproxy": Functions.INFO,
|
||||
"certbot": Functions.DEBUG,
|
||||
},
|
||||
} == ContainerEnv.read()
|
||||
finally:
|
||||
os.environ['HAPROXY_USERNAME'] = ''
|
||||
|
|
@ -58,7 +81,12 @@ def test_container_env_stats_password():
|
|||
"password": "xyz",
|
||||
"port": "1936"
|
||||
|
||||
}
|
||||
},
|
||||
"logLevel": {
|
||||
"easyhaproxy": Functions.DEBUG,
|
||||
"haproxy": Functions.INFO,
|
||||
"certbot": Functions.DEBUG,
|
||||
},
|
||||
} == ContainerEnv.read()
|
||||
finally:
|
||||
os.environ['HAPROXY_PASSWORD'] = ''
|
||||
|
|
@ -78,7 +106,12 @@ def test_container_env_stats_password():
|
|||
"password": "xyz",
|
||||
"port": "2101"
|
||||
|
||||
}
|
||||
},
|
||||
"logLevel": {
|
||||
"easyhaproxy": Functions.DEBUG,
|
||||
"haproxy": Functions.INFO,
|
||||
"certbot": Functions.DEBUG,
|
||||
},
|
||||
} == ContainerEnv.read()
|
||||
finally:
|
||||
os.environ['HAPROXY_USERNAME'] = ''
|
||||
|
|
@ -96,7 +129,12 @@ def test_container_env_stats_password():
|
|||
"letsencrypt": {
|
||||
"email": "acme@example.org",
|
||||
"server": False
|
||||
}
|
||||
},
|
||||
"logLevel": {
|
||||
"easyhaproxy": Functions.DEBUG,
|
||||
"haproxy": Functions.INFO,
|
||||
"certbot": Functions.DEBUG,
|
||||
},
|
||||
} == ContainerEnv.read()
|
||||
finally:
|
||||
os.environ['EASYHAPROXY_LETSENCRYPT_EMAIL'] = ''
|
||||
|
|
@ -112,7 +150,32 @@ def test_container_env_letsencrypt():
|
|||
"letsencrypt": {
|
||||
"email": "acme@example.org",
|
||||
"server": True
|
||||
}
|
||||
},
|
||||
"logLevel": {
|
||||
"easyhaproxy": Functions.DEBUG,
|
||||
"haproxy": Functions.INFO,
|
||||
"certbot": Functions.DEBUG,
|
||||
},
|
||||
} == ContainerEnv.read()
|
||||
finally:
|
||||
os.environ['EASYHAPROXY_LETSENCRYPT_EMAIL'] = ''
|
||||
os.environ['EASYHAPROXY_LETSENCRYPT_EMAIL'] = ''
|
||||
|
||||
def test_container_log_level():
|
||||
os.environ['CERTBOT_LOG_LEVEL'] = Functions.TRACE
|
||||
os.environ['EASYHAPROXY_LOG_LEVEL'] = Functions.ERROR
|
||||
os.environ['HAPROXY_LOG_LEVEL'] = Functions.FATAL
|
||||
try:
|
||||
assert {
|
||||
"customerrors": False,
|
||||
"ssl_mode": "default",
|
||||
"lookup_label": "easyhaproxy",
|
||||
"logLevel": {
|
||||
"easyhaproxy": Functions.ERROR,
|
||||
"haproxy": Functions.FATAL,
|
||||
"certbot": Functions.TRACE,
|
||||
},
|
||||
} == ContainerEnv.read()
|
||||
finally:
|
||||
os.environ['CERTBOT_LOG_LEVEL'] = ''
|
||||
os.environ['EASYHAPROXY_LOG_LEVEL'] = ''
|
||||
os.environ['HAPROXY_LOG_LEVEL'] = ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue