Skip to content

Commit

Permalink
[CLOUDP-113527] make mongo image and repo configurable for e2e tests (#…
Browse files Browse the repository at this point in the history
…1208)

* [CLOUDP-113527] make mongo image and repo configurable for e2e tests
  • Loading branch information
nammn committed Jan 30, 2023
1 parent 1990312 commit 2fcd8ae
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 3 deletions.
2 changes: 2 additions & 0 deletions scripts/ci/config.json
@@ -1,6 +1,8 @@
{
"namespace": "default",
"repo_url": "quay.io/mongodb",
"mongodb_image_repo_url": "docker.io",
"mongodb_image_name": "mongo",
"operator_image": "mongodb-kubernetes-operator",
"operator_image_dev": "community-operator-dev",
"e2e_image": "community-operator-e2e",
Expand Down
8 changes: 8 additions & 0 deletions scripts/dev/dev_config.py
Expand Up @@ -107,6 +107,14 @@ def test_data_dir(self) -> str:
def readiness_probe_image_dev(self) -> str:
return self._get_dev_image("readiness_probe_image_dev", "readiness_probe_image")

@property
def mongodb_image_name(self) -> str:
return self._config.get("mongodb_image_name", "mongo")

@property
def mongodb_image_repo_url(self) -> str:
return self._config.get("mongodb_image_repo_url", "docker.io")

@property
def agent_dev_image_ubi(self) -> str:
return self._get_dev_image("agent_image_ubi_dev", "agent_image_ubi")
Expand Down
8 changes: 8 additions & 0 deletions scripts/dev/e2e.py
Expand Up @@ -120,6 +120,14 @@ def create_test_pod(args: argparse.Namespace, dev_config: DevConfig) -> None:
"name": "READINESS_PROBE_IMAGE",
"value": f"{dev_config.repo_url}/{dev_config.readiness_probe_image_dev}:{args.tag}",
},
{
"name": "MONGODB_IMAGE",
"value": f"{dev_config.mongodb_image_name}",
},
{
"name": "MONGODB_REPO_URL",
"value": f"{dev_config.mongodb_image_repo_url}",
},
{
"name": "PERFORM_CLEANUP",
"value": f"{args.perform_cleanup}",
Expand Down
4 changes: 2 additions & 2 deletions scripts/dev/get_e2e_env_vars.py
Expand Up @@ -29,8 +29,8 @@ def _get_e2e_test_envs(dev_config: DevConfig) -> Dict[str, str]:
"READINESS_PROBE_IMAGE": f"{dev_config.repo_url}/{dev_config.readiness_probe_image}",
"PERFORM_CLEANUP": "true" if cleanup else "false",
"WATCH_NAMESPACE": dev_config.namespace,
"MONGODB_IMAGE": "mongo",
"MONGODB_REPO_URL": "docker.io",
"MONGODB_IMAGE": dev_config.mongodb_image_name,
"MONGODB_REPO_URL": dev_config.mongodb_image_repo_url,
"HELM_CHART_PATH": os.path.abspath("./helm-charts/charts/community-operator"),
}

Expand Down
Expand Up @@ -9,7 +9,7 @@ import (

e2eutil "github.com/mongodb/mongodb-kubernetes-operator/test/e2e"
"github.com/mongodb/mongodb-kubernetes-operator/test/e2e/mongodbtests"
setup "github.com/mongodb/mongodb-kubernetes-operator/test/e2e/setup"
"github.com/mongodb/mongodb-kubernetes-operator/test/e2e/setup"
"github.com/stretchr/objx"
)

Expand Down
3 changes: 3 additions & 0 deletions test/e2e/setup/setup.go
Expand Up @@ -157,6 +157,9 @@ func getHelmArgs(testConfig TestConfig, watchNamespace string, resourceName stri
helmArgs["agent.version"] = agentVersion
helmArgs["agent.name"] = agentName

helmArgs["mongodb.name"] = testConfig.MongoDBImage
helmArgs["mongodb.repo"] = testConfig.MongoDBRepoUrl

helmArgs["registry.versionUpgradeHook"] = versionUpgradeHookRegistry
helmArgs["registry.operator"] = operatorRegistry
helmArgs["registry.agent"] = agentRegistry
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/setup/test_config.go
Expand Up @@ -26,6 +26,8 @@ type TestConfig struct {
AgentImage string
ReadinessProbeImage string
HelmChartPath string
MongoDBImage string
MongoDBRepoUrl string
}

func LoadTestConfigFromEnv() TestConfig {
Expand All @@ -34,6 +36,8 @@ func LoadTestConfigFromEnv() TestConfig {
CertManagerNamespace: envvar.GetEnvOrDefault(testCertManagerNamespaceEnvName, "cert-manager"),
CertManagerVersion: envvar.GetEnvOrDefault(testCertManagerVersionEnvName, "v1.5.3"),
OperatorImage: envvar.GetEnvOrDefault(operatorImageEnvName, "quay.io/mongodb/community-operator-dev:latest"),
MongoDBImage: envvar.GetEnvOrDefault(construct.MongodbName, "mongo"),
MongoDBRepoUrl: envvar.GetEnvOrDefault(construct.MongodbRepoUrl, "docker.io"),
VersionUpgradeHookImage: envvar.GetEnvOrDefault(construct.VersionUpgradeHookImageEnv, "quay.io/mongodb/mongodb-kubernetes-operator-version-upgrade-post-start-hook:1.0.2"),
AgentImage: envvar.GetEnvOrDefault(construct.AgentImageEnv, "quay.io/mongodb/mongodb-agent:10.29.0.6830-1"), // TODO: better way to decide default agent image.
ClusterWide: envvar.ReadBool(clusterWideEnvName),
Expand Down

0 comments on commit 2fcd8ae

Please sign in to comment.