Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions docker/mongodb-kubernetes-tests/kubetester/operator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import logging
import time
from typing import Dict, List, Optional

Expand All @@ -18,6 +17,7 @@
helm_upgrade,
)
from tests import test_logger
from tests.constants import LOCAL_HELM_CHART_DIR

OPERATOR_CRDS = (
"mongodb.mongodb.com",
Expand All @@ -43,7 +43,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
2 changes: 1 addition & 1 deletion docker/mongodb-kubernetes-tests/kubetester/opsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
multi_cluster_service_names,
)
from tests.conftest import (
LEGACY_CENTRAL_CLUSTER_NAME,
get_central_cluster_client,
get_member_cluster_api_client,
get_member_cluster_client_map,
is_member_cluster,
read_deployment_state,
)
from tests.constants import LEGACY_CENTRAL_CLUSTER_NAME

logger = test_logger.get_test_logger(__name__)
TRACER = trace.get_tracer("evergreen-agent")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from kubetester.mongodb import MongoDB
from kubetester.phase import Phase
from pytest import fixture, mark
from tests.conftest import OPERATOR_NAME
from tests.constants import OPERATOR_NAME


@fixture(scope="function")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from kubetester.kubetester import fixture as yaml_fixture
from kubetester.opsmanager import MongoDBOpsManager
from tests.common.constants import S3_BLOCKSTORE_NAME, S3_OPLOG_NAME
from tests.conftest import AWS_REGION
from tests.constants import AWS_REGION


def ops_manager_multi_cluster_with_tls_s3_backups(
Expand Down
52 changes: 16 additions & 36 deletions docker/mongodb-kubernetes-tests/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,49 +31,29 @@
from pymongo.errors import ServerSelectionTimeoutError
from pytest import fixture
from tests import test_logger
from tests.constants import (
CLUSTER_HOST_MAPPING,
KUBECONFIG_FILEPATH,
LEGACY_CENTRAL_CLUSTER_NAME,
LEGACY_DEPLOYMENT_STATE_VERSION,
LEGACY_OPERATOR_CHART,
LEGACY_OPERATOR_IMAGE_NAME,
LEGACY_OPERATOR_NAME,
LOCAL_HELM_CHART_DIR,
MCK_HELM_CHART,
MONITOR_APPDB_E2E_DEFAULT,
MULTI_CLUSTER_CONFIG_DIR,
MULTI_CLUSTER_OPERATOR_NAME,
OFFICIAL_OPERATOR_IMAGE_NAME,
OPERATOR_NAME,
)
from tests.multicluster import prepare_multi_cluster_namespaces

try:
kubernetes.config.load_kube_config()
except Exception:
kubernetes.config.load_incluster_config()

AWS_REGION = "us-east-1"

KUBECONFIG_FILEPATH = "/etc/config/kubeconfig"
MULTI_CLUSTER_CONFIG_DIR = "/etc/multicluster"
# AppDB monitoring is disabled by default for e2e tests.
# If monitoring is needed use monitored_appdb_operator_installation_config / operator_with_monitored_appdb
MONITOR_APPDB_E2E_DEFAULT = "true"
CLUSTER_HOST_MAPPING = {
"us-central1-c_central": "https://35.232.85.244",
"us-east1-b_member-1a": "https://35.243.222.230",
"us-east1-c_member-2a": "https://34.75.94.207",
"us-west1-a_member-3a": "https://35.230.121.15",
}

LEGACY_CENTRAL_CLUSTER_NAME: str = "__default"
LEGACY_DEPLOYMENT_STATE_VERSION: str = "1.27.0"

# Helm charts
LEGACY_OPERATOR_CHART = "mongodb/enterprise-operator"
MCK_HELM_CHART = "mongodb/mongodb-kubernetes"
LOCAL_HELM_CHART_DIR = "helm_chart"

OFFICIAL_OPERATOR_IMAGE_NAME = "mongodb-kubernetes"
LEGACY_OPERATOR_IMAGE_NAME = "mongodb-enterprise-operator-ubi"

# Names for operator and RBAC
OPERATOR_NAME = "mongodb-kubernetes-operator"
MULTI_CLUSTER_OPERATOR_NAME = OPERATOR_NAME + "-multi-cluster"
LEGACY_OPERATOR_NAME = "mongodb-enterprise-operator"
LEGACY_MULTI_CLUSTER_OPERATOR_NAME = LEGACY_OPERATOR_NAME + "-multi-cluster"
APPDB_SA_NAME = "mongodb-kubernetes-appdb"
DATABASE_SA_NAME = "mongodb-kubernetes-database-pods"
OM_SA_NAME = "mongodb-kubernetes-ops-manager"
TELEMETRY_CONFIGMAP_NAME = LEGACY_OPERATOR_NAME + "-telemetry"
MULTI_CLUSTER_MEMBER_LIST_CONFIGMAP = OPERATOR_NAME + "-member-list"

logger = test_logger.get_test_logger(__name__)


Expand Down
35 changes: 35 additions & 0 deletions docker/mongodb-kubernetes-tests/tests/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
AWS_REGION = "us-east-1"

KUBECONFIG_FILEPATH = "/etc/config/kubeconfig"
MULTI_CLUSTER_CONFIG_DIR = "/etc/multicluster"
# AppDB monitoring is disabled by default for e2e tests.
# If monitoring is needed use monitored_appdb_operator_installation_config / operator_with_monitored_appdb
MONITOR_APPDB_E2E_DEFAULT = "true"
CLUSTER_HOST_MAPPING = {
"us-central1-c_central": "https://35.232.85.244",
"us-east1-b_member-1a": "https://35.243.222.230",
"us-east1-c_member-2a": "https://34.75.94.207",
"us-west1-a_member-3a": "https://35.230.121.15",
}

LEGACY_CENTRAL_CLUSTER_NAME: str = "__default"
LEGACY_DEPLOYMENT_STATE_VERSION: str = "1.27.0"

# Helm charts
LEGACY_OPERATOR_CHART = "mongodb/enterprise-operator"
MCK_HELM_CHART = "mongodb/mongodb-kubernetes"
LOCAL_HELM_CHART_DIR = "helm_chart"

OFFICIAL_OPERATOR_IMAGE_NAME = "mongodb-kubernetes"
LEGACY_OPERATOR_IMAGE_NAME = "mongodb-enterprise-operator-ubi"

# Names for operator and RBAC
OPERATOR_NAME = "mongodb-kubernetes-operator"
MULTI_CLUSTER_OPERATOR_NAME = OPERATOR_NAME + "-multi-cluster"
LEGACY_OPERATOR_NAME = "mongodb-enterprise-operator"
LEGACY_MULTI_CLUSTER_OPERATOR_NAME = LEGACY_OPERATOR_NAME + "-multi-cluster"
APPDB_SA_NAME = "mongodb-kubernetes-appdb"
DATABASE_SA_NAME = "mongodb-kubernetes-database-pods"
OM_SA_NAME = "mongodb-kubernetes-ops-manager"
TELEMETRY_CONFIGMAP_NAME = LEGACY_OPERATOR_NAME + "-telemetry"
MULTI_CLUSTER_MEMBER_LIST_CONFIGMAP = OPERATOR_NAME + "-member-list"
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.constants 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 @@ -9,10 +9,10 @@
from kubetester.operator import Operator
from kubetester.phase import Phase
from tests.conftest import (
MULTI_CLUSTER_OPERATOR_NAME,
run_kube_config_creation_tool,
run_multi_cluster_recovery_tool,
)
from tests.constants import MULTI_CLUSTER_OPERATOR_NAME
from tests.multicluster.conftest import cluster_spec_list

RESOURCE_NAME = "multi-replica-set"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
from kubetester.phase import Phase
from pytest import fixture, mark
from tests.conftest import (
MULTI_CLUSTER_OPERATOR_NAME,
_install_multi_cluster_operator,
run_kube_config_creation_tool,
)

from ..constants import MULTI_CLUSTER_OPERATOR_NAME
from . import prepare_multi_cluster_namespaces
from .conftest import cluster_spec_list, create_namespace

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
from kubetester.opsmanager import MongoDBOpsManager
from kubetester.phase import Phase
from tests.conftest import (
MULTI_CLUSTER_OPERATOR_NAME,
TELEMETRY_CONFIGMAP_NAME,
get_central_cluster_client,
get_custom_mdb_version,
get_member_cluster_names,
)
from tests.constants import MULTI_CLUSTER_OPERATOR_NAME, TELEMETRY_CONFIGMAP_NAME
from tests.multicluster.conftest import cluster_spec_list


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@
from kubetester.phase import Phase
from pytest import fixture, mark
from tests.conftest import (
MULTI_CLUSTER_OPERATOR_NAME,
OPERATOR_NAME,
_install_multi_cluster_operator,
run_kube_config_creation_tool,
run_multi_cluster_recovery_tool,
)

from ..constants import MULTI_CLUSTER_OPERATOR_NAME, OPERATOR_NAME
from . import prepare_multi_cluster_namespaces
from .conftest import cluster_spec_list, create_service_entries_objects
from .multi_cluster_clusterwide import create_namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
from kubetester.phase import Phase
from pytest import fixture, mark
from tests.conftest import (
MULTI_CLUSTER_OPERATOR_NAME,
get_member_cluster_api_client,
run_multi_cluster_recovery_tool,
)

from ..constants import MULTI_CLUSTER_OPERATOR_NAME
from .conftest import cluster_spec_list, create_service_entries_objects

FAILED_MEMBER_CLUSTER_NAME = "kind-e2e-cluster-3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
from kubetester.multicluster_client import MultiClusterClient
from kubetester.operator import Operator
from kubetester.phase import Phase
from tests.conftest import MULTI_CLUSTER_OPERATOR_NAME, run_kube_config_creation_tool
from tests.conftest import run_kube_config_creation_tool
from tests.constants import MULTI_CLUSTER_OPERATOR_NAME
from tests.multicluster.conftest import cluster_spec_list

RESOURCE_NAME = "multi-replica-set"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
from pytest import fixture, mark
from tests.common.cert.cert_issuer import create_appdb_certs
from tests.conftest import (
MULTI_CLUSTER_MEMBER_LIST_CONFIGMAP,
get_member_cluster_api_client,
)
from tests.constants import MULTI_CLUSTER_MEMBER_LIST_CONFIGMAP
from tests.multicluster.conftest import cluster_spec_list

FAILED_MEMBER_CLUSTER_NAME = "kind-e2e-cluster-3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
from tests.common.ops_manager.multi_cluster import (
ops_manager_multi_cluster_with_tls_s3_backups,
)
from tests.conftest import AWS_REGION, assert_data_got_restored
from tests.conftest import assert_data_got_restored
from tests.constants import AWS_REGION
from tests.multicluster.conftest import cluster_spec_list


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
from tests import test_logger
from tests.common.cert.cert_issuer import create_appdb_certs
from tests.conftest import (
LEGACY_MULTI_CLUSTER_OPERATOR_NAME,
MULTI_CLUSTER_OPERATOR_NAME,
get_central_cluster_name,
get_custom_appdb_version,
install_legacy_deployment_state_meko,
log_deployments_info,
)
from tests.constants import (
LEGACY_MULTI_CLUSTER_OPERATOR_NAME,
MULTI_CLUSTER_OPERATOR_NAME,
)
from tests.multicluster.conftest import cluster_spec_list
from tests.upgrades import downscale_operator_deployment

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from kubetester.phase import Phase
from pytest import fixture, mark
from tests.conftest import (
TELEMETRY_CONFIGMAP_NAME,
assert_data_got_restored,
get_central_cluster_client,
get_member_cluster_clients,
Expand All @@ -39,6 +38,7 @@
from ..common.ops_manager.multi_cluster import (
ops_manager_multi_cluster_with_tls_s3_backups,
)
from ..constants import TELEMETRY_CONFIGMAP_NAME
from ..multicluster.conftest import cluster_spec_list

# This test is for checking networking when OM is deployed without Service Mesh:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
from pytest import fixture, mark
from tests import test_logger
from tests.conftest import (
MULTI_CLUSTER_MEMBER_LIST_CONFIGMAP,
get_central_cluster_client,
get_member_cluster_api_client,
)
from tests.constants import MULTI_CLUSTER_MEMBER_LIST_CONFIGMAP
from tests.multicluster.conftest import cluster_spec_list
from tests.shardedcluster.conftest import (
enable_multi_cluster_deployment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from kubetester.phase import Phase
from pytest import fixture
from tests import test_logger
from tests.conftest import LEGACY_OPERATOR_NAME, OPERATOR_NAME
from tests.constants import LEGACY_OPERATOR_NAME, OPERATOR_NAME
from tests.olm.olm_test_commons import (
get_catalog_image,
get_catalog_source_resource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from kubetester.kubetester import get_default_architecture
from kubetester.mongodb import MongoDB
from kubetester.opsmanager import MongoDBOpsManager
from tests.conftest import OPERATOR_NAME
from tests.constants import OPERATOR_NAME
from tests.olm.olm_test_commons import (
get_catalog_image,
get_catalog_source_resource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from kubetester.opsmanager import MongoDBOpsManager
from kubetester.phase import Phase
from pytest import fixture
from tests.conftest import OPERATOR_NAME
from tests.constants import OPERATOR_NAME
from tests.olm.olm_test_commons import (
get_catalog_image,
get_catalog_source_resource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from kubetester.phase import Phase
from kubetester.test_identifiers import set_test_identifier
from pytest import fixture, mark
from tests.conftest import AWS_REGION, is_multi_cluster
from tests.conftest import is_multi_cluster
from tests.constants import AWS_REGION
from tests.opsmanager.backup_snapshot_schedule_tests import BackupSnapshotScheduleTests
from tests.opsmanager.withMonitoredAppDB.conftest import enable_multi_cluster_deployment

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
from kubetester.opsmanager import MongoDBOpsManager
from kubetester.phase import Phase
from pytest import fixture, mark
from tests.conftest import AWS_REGION, is_multi_cluster
from tests.conftest import is_multi_cluster
from tests.constants import AWS_REGION
from tests.opsmanager.withMonitoredAppDB.conftest import enable_multi_cluster_deployment

HEAD_PATH = "/head/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from pytest import fixture, mark
from tests.common.cert.cert_issuer import create_appdb_certs
from tests.common.constants import S3_BLOCKSTORE_NAME, S3_OPLOG_NAME
from tests.conftest import AWS_REGION, is_multi_cluster
from tests.conftest import is_multi_cluster
from tests.constants import AWS_REGION
from tests.opsmanager.om_ops_manager_backup import create_aws_secret, create_s3_bucket
from tests.opsmanager.withMonitoredAppDB.conftest import enable_multi_cluster_deployment

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from kubetester.opsmanager import MongoDBOpsManager
from kubetester.phase import Phase
from pytest import fixture, mark
from tests.conftest import OPERATOR_NAME, is_multi_cluster
from tests.conftest import is_multi_cluster
from tests.constants import OPERATOR_NAME
from tests.opsmanager.withMonitoredAppDB.conftest import enable_multi_cluster_deployment


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
from kubetester.opsmanager import MongoDBOpsManager
from kubetester.phase import Phase
from pytest import fixture, mark
from tests.conftest import AWS_REGION, is_multi_cluster
from tests.conftest import is_multi_cluster
from tests.constants import AWS_REGION
from tests.opsmanager.om_ops_manager_backup import create_aws_secret, create_s3_bucket
from tests.opsmanager.withMonitoredAppDB.conftest import enable_multi_cluster_deployment

Expand Down
Loading