Further fixes to the Kubernetes config provider, and a new set of proper unit tests

This commit is contained in:
Joseph Schorr 2018-05-10 16:44:18 +03:00
parent babb7bb803
commit 2ae69dc651
8 changed files with 181 additions and 107 deletions

View file

@ -89,20 +89,17 @@ class BaseProvider(object):
""" Returns whether the config override volume exists. """
@abstractmethod
def volume_file_exists(self, filename):
""" Returns whether the file with the given name exists under the config override volume. """
def volume_file_exists(self, relative_file_path):
""" Returns whether the file with the given relative path exists under the config override
volume. """
@abstractmethod
def get_volume_file(self, filename, mode='r'):
""" Returns a Python file referring to the given name under the config override volume. """
def get_volume_file(self, relative_file_path, mode='r'):
""" Returns a Python file referring to the given path under the config override volume. """
@abstractmethod
def write_volume_file(self, filename, contents):
""" Writes the given contents to the config override volumne, with the given filename. """
@abstractmethod
def remove_volume_file(self, filename):
""" Removes the config override volume file with the given filename. """
def remove_volume_file(self, relative_file_path):
""" Removes the config override volume file with the given path. """
@abstractmethod
def list_volume_directory(self, path):
@ -111,9 +108,9 @@ class BaseProvider(object):
"""
@abstractmethod
def save_volume_file(self, filename, flask_file):
def save_volume_file(self, flask_file, relative_file_path):
""" Saves the given flask file to the config override volume, with the given
filename.
relative path.
"""
@abstractmethod
@ -124,5 +121,5 @@ class BaseProvider(object):
@abstractmethod
def get_volume_path(self, directory, filename):
""" Helper for constructing file paths, which may differ between providers. For example,
kubernetes can't have subfolders in configmaps """
""" Helper for constructing relative file paths, which may differ between providers.
For example, kubernetes can't have subfolders in configmaps """