Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docker/mongodb-kubernetes-tests/kubetester/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
from typing import Dict, List, Optional, Tuple

from tests import test_logger
from tests.conftest import LOCAL_HELM_CHART_DIR

logger = test_logger.get_test_logger(__name__)


def helm_template(
helm_args: Dict,
helm_chart_path: Optional[str] = "helm_chart",
helm_chart_path: Optional[str] = LOCAL_HELM_CHART_DIR,
templates: Optional[str] = None,
helm_options: Optional[List[str]] = None,
) -> str:
Expand All @@ -39,7 +40,7 @@ def helm_install(
name: str,
namespace: str,
helm_args: Dict,
helm_chart_path: Optional[str] = "helm_chart",
helm_chart_path: Optional[str] = LOCAL_HELM_CHART_DIR,
helm_options: Optional[List[str]] = None,
custom_operator_version: Optional[str] = None,
):
Expand Down Expand Up @@ -149,15 +150,15 @@ def helm_upgrade(
name: str,
namespace: str,
helm_args: Dict,
helm_chart_path: Optional[str] = "helm_chart",
helm_chart_path: Optional[str] = LOCAL_HELM_CHART_DIR,
helm_options: Optional[List[str]] = None,
helm_override_path: Optional[bool] = False,
custom_operator_version: Optional[str] = None,
apply_crds_first: bool = False,
):
if not helm_chart_path:
logger.warning("Helm chart path is empty, defaulting to 'helm_chart'")
helm_chart_path = "helm_chart"
helm_chart_path = LOCAL_HELM_CHART_DIR

chart_dir = helm_chart_path if helm_override_path else _helm_chart_dir(helm_chart_path)

Expand Down Expand Up @@ -232,5 +233,5 @@ def _create_helm_args(helm_args: Dict[str, str], helm_options: Optional[List[str
return command_args


def _helm_chart_dir(default: Optional[str] = "helm_chart") -> str:
def _helm_chart_dir(default: Optional[str] = LOCAL_HELM_CHART_DIR) -> str:
return os.environ.get("HELM_CHART_DIR", default)
3 changes: 2 additions & 1 deletion docker/mongodb-kubernetes-tests/kubetester/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
helm_upgrade,
)
from tests import test_logger
from tests.conftest import LOCAL_HELM_CHART_DIR

OPERATOR_CRDS = (
"mongodb.mongodb.com",
Expand All @@ -43,7 +44,7 @@ def __init__(
namespace: str,
helm_args: Optional[Dict] = None,
helm_options: Optional[List[str]] = None,
helm_chart_path: Optional[str] = "helm_chart",
helm_chart_path: Optional[str] = LOCAL_HELM_CHART_DIR,
name: Optional[str] = "mongodb-kubernetes-operator",
api_client: Optional[client.api_client.ApiClient] = None,
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from kubetester.helm import helm_template
from kubetester.multicluster_client import MultiClusterClient
from tests import test_logger
from tests.conftest import LOCAL_HELM_CHART_DIR

logger = test_logger.get_test_logger(__name__)

Expand All @@ -15,7 +16,7 @@ def prepare_multi_cluster_namespaces(
member_cluster_clients: List[MultiClusterClient],
central_cluster_name: str,
skip_central_cluster: bool = True,
helm_chart_path="helm_chart",
helm_chart_path=LOCAL_HELM_CHART_DIR,
):
"""create a new namespace and configures all necessary service accounts there"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from tests.conftest import (
LEGACY_MULTI_CLUSTER_OPERATOR_NAME,
LEGACY_OPERATOR_NAME,
LOCAL_HELM_CHART_DIR,
MULTI_CLUSTER_MEMBER_LIST_CONFIGMAP,
MULTI_CLUSTER_OPERATOR_NAME,
OPERATOR_NAME,
Expand Down Expand Up @@ -142,7 +143,7 @@ def test_upgrade_operator(
operator = Operator(
namespace=namespace,
helm_args=operator_installation_config,
helm_chart_path="helm_chart",
helm_chart_path=LOCAL_HELM_CHART_DIR,
name=OPERATOR_NAME,
)
operator.install()
Expand Down
Loading