Example #1
0
class BaseCli:
    def __init__(self,
                 microservice,
                 containers_namespace="backend-tests",
                 container_manager=None):
        if isK8S():
            self.container_manager = KubernetesNamespace()
            base_filter = microservice
        elif container_manager is None:
            self.container_manager = DockerNamespace(containers_namespace)
            base_filter = microservice + "[_-]1"
        else:
            self.container_manager = container_manager
            base_filter = microservice + "[_-]1"

        self.cid = self.container_manager.getid([base_filter])

    def choose_binary_and_config_paths(self, service_flavours: List[str],
                                       service_name: str):
        """Choose binary and configuration paths depending on service flavour. """
        for service in service_flavours:
            try:
                self.container_manager.execute(self.cid,
                                               [service.bin_path, "--help"])
                self.service = service
                break
            except:
                continue
        else:
            raise RuntimeError(f"no runnable binary found in {service_name}")
Example #2
0
    def __init__(self, microservice, containers_namespace, container_manager):
        if container_manager is None:
            self.container_manager = DockerNamespace(containers_namespace)
        else:
            self.container_manager = container_manager

        base_filter = microservice + "_1"
        self.cid = self.container_manager.getid([base_filter])
Example #3
0
    def __init__(self, microservice, containers_namespace, container_manager):
        if isK8S():
            self.container_manager = KubernetesNamespace()
            base_filter = microservice
        elif container_manager is None:
            self.container_manager = DockerNamespace(containers_namespace)
            base_filter = microservice + "_1"
        else:
            self.container_manager = container_manager
            base_filter = microservice + "_1"

        self.cid = self.container_manager.getid([base_filter])