Skip to content

Commit

Permalink
rptest: Handle tier name before cluster creation
Browse files Browse the repository at this point in the history
  • Loading branch information
savex committed Sep 20, 2023
1 parent 03fd0fa commit c89e1df
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
13 changes: 5 additions & 8 deletions tests/rptest/redpanda_cloud_tests/high_throughput_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from rptest.services.openmessaging_benchmark_configs import \
OMBSampleConfigurations
from rptest.services.producer_swarm import ProducerSwarm
from rptest.services.redpanda_cloud import AdvertisedTierConfigs, CloudTierName
from rptest.services.redpanda_cloud import AdvertisedTierConfigs, CloudTierName, get_tier_name
from rptest.services.redpanda import (RESTART_LOG_ALLOW_LIST, MetricsEndpoint,
SISettings, RedpandaServiceCloud)
from rptest.services.rpk_consumer import RpkConsumer
Expand Down Expand Up @@ -163,13 +163,13 @@ def traffic_generator(context, redpanda, tier_cfg, *args, **kwargs):
) >= tier_cfg.egress_rate, f"Observed consumer throughput {consumer_throughput} too low, expected: {tier_cfg.egress_rate}"


def get_globals_value(globals, key_name, default=None):
def get_cloud_globals(globals, key_name, default=None):
_config = {}
if RedpandaServiceCloud.GLOBAL_CLOUD_CLUSTER_CONFIG in globals:
# Load needed config values from cloud section
# of globals prior to actual cluster creation
_config = globals[RedpandaServiceCloud.GLOBAL_CLOUD_CLUSTER_CONFIG]
return _config.get(key_name, default)
return _config


class HighThroughputTest(RedpandaTest):
Expand All @@ -179,11 +179,8 @@ class HighThroughputTest(RedpandaTest):

def __init__(self, test_ctx: TestContext, *args, **kwargs):
self._ctx = test_ctx
# Get tier value
cloud_tier_str = get_globals_value(self._ctx.globals,
"config_profile_name",
default="tier-1-aws")
cloud_tier = CloudTierName(cloud_tier_str)
# Get tier name
cloud_tier = get_tier_name(get_cloud_globals(self._ctx.globals))
extra_rp_conf = None
num_brokers = None

Expand Down
16 changes: 15 additions & 1 deletion tests/rptest/services/redpanda_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ def load_tier_profiles():
TIER_DEFAULTS = {PROVIDER_AWS: "tier-1-aws", PROVIDER_GCP: "tier-1-gcp"}


def get_tier_name(config):
"""
Gets tier name befor cluster creation
"""
if not config:
return CloudTierName("docker-local")
else:
_provider = config['provider'].upper()
if config['config_profile_name'] == "default":
return CloudTierName(TIER_DEFAULTS[_provider])
else:
return CloudTierName(_provider)


class CloudTierName(Enum):
DOCKER = 'docker-local'
AWS_1 = 'tier-1-aws'
Expand Down Expand Up @@ -397,7 +411,7 @@ def cluster_id(self):
def get_ducktape_meta(self):
"""
Returns instance metadata based on current provider
This is placed in separate function to be able
This is placed in separate function to be able
to add data processing if needed
"""
return self.provider_cli.get_instance_meta()
Expand Down

0 comments on commit c89e1df

Please sign in to comment.