1
0
Fork 0

Added more unit tests

This commit is contained in:
Joao Gilberto Magalhaes 2022-08-25 19:37:02 -05:00
parent 733e73ae58
commit f007f857df
6 changed files with 325 additions and 5 deletions

View file

@ -13,7 +13,7 @@ class ContainerEnv:
def read():
env_vars = {
"customerrors": True if os.getenv("HAPROXY_CUSTOMERRORS") == "true" else False,
"ssl_mode": os.getenv("EASYHAPROXY_SSL_MODE", "default")
"ssl_mode": os.getenv("EASYHAPROXY_SSL_MODE") if os.getenv("EASYHAPROXY_SSL_MODE") else 'default'
}
if os.getenv("HAPROXY_PASSWORD"):
@ -33,6 +33,8 @@ class ContainerEnv:
class ProcessorInterface:
static_file = "/etc/haproxy/easyconfig.yml"
def __init__(self, filename = None):
self.filename = filename
self.refresh()
@ -40,7 +42,7 @@ class ProcessorInterface:
@staticmethod
def factory(mode):
if mode == "static":
return Static("/etc/haproxy/easyconfig.yml")
return Static(ProcessorInterface.static_file)
elif mode == "docker":
return Docker()
elif mode == "swarm":
@ -95,7 +97,6 @@ class ProcessorInterface:
Functions.save("{0}/{1}".format(path, cert), self.get_certs(cert))
class Static(ProcessorInterface):
def inspect_network(self):
self.parsed_object = {}