Skip to content

Commit

Permalink
tests: replace RedpandaService with make_redpanda_service
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhsu committed May 26, 2023
1 parent 9bb2287 commit 0e8a31d
Show file tree
Hide file tree
Showing 17 changed files with 100 additions and 106 deletions.
17 changes: 8 additions & 9 deletions tests/rptest/scale_tests/cloud_storage_compaction_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from rptest.clients.rpk import RpkTool, RpkException
from rptest.clients.types import TopicSpec
from rptest.services.cluster import cluster
from rptest.services.redpanda import CloudStorageType, RedpandaService, MetricsEndpoint, SISettings, get_cloud_storage_type
from rptest.services.redpanda import CloudStorageType, make_redpanda_service, MetricsEndpoint, SISettings, get_cloud_storage_type
from rptest.tests.end_to_end import EndToEndTest
from rptest.util import wait_until
from ducktape.mark import matrix
Expand Down Expand Up @@ -90,11 +90,11 @@ def _init_redpanda(self, test_context, extra_rp_conf, environment):
self.configuration["max_compacted_log_segment_size"],
})

self.redpanda = RedpandaService(context=self.test_context,
num_brokers=3,
si_settings=self.si_settings,
extra_rp_conf=extra_rp_conf,
environment=environment)
self.redpanda = make_redpanda_service(context=self.test_context,
num_brokers=3,
si_settings=self.si_settings,
extra_rp_conf=extra_rp_conf,
environment=environment)

def setUp(self):
assert self.redpanda
Expand Down Expand Up @@ -136,9 +136,8 @@ def _init_redpanda_read_replica(self):
cloud_storage_segment_max_upload_interval_sec=self.
configuration["cloud_storage_segment_max_upload_interval_sec"])
self.rr_si_settings.load_context(self.logger, self.test_context)
self.rr_cluster = RedpandaService(self.test_context,
num_brokers=3,
si_settings=self.rr_si_settings)
self.rr_cluster = make_redpanda_service(
self.test_context, num_brokers=3, si_settings=self.rr_si_settings)

def _create_read_repica_topic_success(self):
try:
Expand Down
6 changes: 3 additions & 3 deletions tests/rptest/tests/availability_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from rptest.services.cluster import cluster
from rptest.clients.types import TopicSpec
from rptest.services.failure_injector import FailureSpec
from rptest.services.redpanda import RedpandaService, CHAOS_LOG_ALLOW_LIST
from rptest.services.redpanda import make_redpanda_service, CHAOS_LOG_ALLOW_LIST
from rptest.tests.e2e_finjector import EndToEndFinjectorTest


Expand All @@ -35,7 +35,7 @@ def validate_records(self):

@cluster(num_nodes=5, log_allow_list=CHAOS_LOG_ALLOW_LIST)
def test_availability_when_one_node_failed(self):
self.redpanda = RedpandaService(
self.redpanda = make_redpanda_service(
self.test_context,
3,
extra_rp_conf={
Expand Down Expand Up @@ -66,7 +66,7 @@ def test_availability_when_one_node_failed(self):
@cluster(num_nodes=5, log_allow_list=CHAOS_LOG_ALLOW_LIST)
def test_recovery_after_catastrophic_failure(self):

self.redpanda = RedpandaService(
self.redpanda = make_redpanda_service(
self.test_context,
3,
extra_rp_conf={
Expand Down
4 changes: 2 additions & 2 deletions tests/rptest/tests/cluster_view_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
from rptest.services.cluster import cluster
from ducktape.utils.util import wait_until
from rptest.services.admin import Admin
from rptest.services.redpanda import RedpandaService
from rptest.services.redpanda import make_redpanda_service
from rptest.tests.end_to_end import EndToEndTest


class ClusterViewTest(EndToEndTest):
@cluster(num_nodes=3)
def test_view_changes_on_add(self):
self.redpanda = RedpandaService(self.test_context, 3)
self.redpanda = make_redpanda_service(self.test_context, 3)
# start single node cluster
self.redpanda.start(nodes=[self.redpanda.nodes[0]])

Expand Down
4 changes: 2 additions & 2 deletions tests/rptest/tests/controller_upgrade_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from rptest.services.admin import Admin
from rptest.services.admin_ops_fuzzer import AdminOperationsFuzzer, RedpandaAdminOperation
from rptest.services.cluster import cluster
from rptest.services.redpanda import RESTART_LOG_ALLOW_LIST, RedpandaService
from rptest.services.redpanda import RESTART_LOG_ALLOW_LIST, make_redpanda_service
from rptest.services.redpanda_installer import RedpandaInstaller
from rptest.tests.end_to_end import EndToEndTest

Expand Down Expand Up @@ -46,7 +46,7 @@ def test_updating_cluster_when_executing_operations(self):
Validates that cluster is operational when upgrading controller log
'''

self.redpanda = RedpandaService(self.test_context, 5)
self.redpanda = make_redpanda_service(self.test_context, 5)
installer = self.redpanda._installer
prev_version = installer.highest_from_prior_feature_version(
RedpandaInstaller.HEAD)
Expand Down
12 changes: 6 additions & 6 deletions tests/rptest/tests/e2e_shadow_indexing_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from rptest.services.cluster import cluster
from rptest.services.kgo_verifier_services import KgoVerifierProducer, KgoVerifierRandomConsumer, KgoVerifierSeqConsumer
from rptest.services.metrics_check import MetricCheck
from rptest.services.redpanda import RedpandaService, CHAOS_LOG_ALLOW_LIST
from rptest.services.redpanda import make_redpanda_service, CHAOS_LOG_ALLOW_LIST
from rptest.services.redpanda import SISettings, get_cloud_storage_type
from rptest.tests.end_to_end import EndToEndTest
from rptest.tests.prealloc_nodes import PreallocNodesTest
Expand Down Expand Up @@ -71,11 +71,11 @@ def __init__(self,
self.si_settings.load_context(self.logger, test_context)
self.scale = Scale(test_context)

self.redpanda = RedpandaService(context=self.test_context,
num_brokers=self.num_brokers,
si_settings=self.si_settings,
extra_rp_conf=extra_rp_conf,
environment=environment)
self.redpanda = make_redpanda_service(context=self.test_context,
num_brokers=self.num_brokers,
si_settings=self.si_settings,
extra_rp_conf=extra_rp_conf,
environment=environment)
self.kafka_tools = KafkaCliTools(self.redpanda)
self.rpk = RpkTool(self.redpanda)

Expand Down
15 changes: 8 additions & 7 deletions tests/rptest/tests/end_to_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from typing import Optional
from ducktape.tests.test import Test
from ducktape.utils.util import wait_until
from rptest.services.redpanda import RedpandaService
from rptest.services.redpanda import RedpandaService, make_redpanda_service
from rptest.services.redpanda_installer import InstallOptions
from rptest.services.redpanda_installer import RedpandaInstaller
from rptest.clients.default import DefaultClient
Expand Down Expand Up @@ -97,12 +97,13 @@ def start_redpanda(self,
self._extra_rp_conf = {**self._extra_rp_conf, **extra_rp_conf}
assert self.redpanda is None

self.redpanda = RedpandaService(self.test_context,
num_nodes,
extra_rp_conf=self._extra_rp_conf,
extra_node_conf=self._extra_node_conf,
si_settings=self.si_settings,
environment=environment)
self.redpanda = make_redpanda_service(
self.test_context,
num_nodes,
extra_rp_conf=self._extra_rp_conf,
extra_node_conf=self._extra_node_conf,
si_settings=self.si_settings,
environment=environment)
if new_bootstrap:
seeds = [
self.redpanda.nodes[i]
Expand Down
8 changes: 4 additions & 4 deletions tests/rptest/tests/mirror_maker_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from rptest.services.kafka import KafkaServiceAdapter
from rptest.services.mirror_maker2 import MirrorMaker2

from rptest.services.redpanda import RedpandaService
from rptest.services.redpanda import make_redpanda_service
from rptest.tests.end_to_end import EndToEndTest
from rptest.services.verifiable_producer import VerifiableProducer, is_int_with_prefix
from rptest.services.verifiable_consumer import VerifiableConsumer
Expand Down Expand Up @@ -68,8 +68,8 @@ def tearDown(self):

def start_brokers(self, source_type=kafka_source):
if source_type == TestMirrorMakerService.redpanda_source:
self.source_broker = RedpandaService(self.test_context,
num_brokers=3)
self.source_broker = make_redpanda_service(self.test_context,
num_brokers=3)
else:
self.source_broker = KafkaServiceAdapter(
self.test_context,
Expand All @@ -78,7 +78,7 @@ def start_brokers(self, source_type=kafka_source):
zk=self.zk,
version=V_3_0_0))

self.redpanda = RedpandaService(self.test_context, num_brokers=3)
self.redpanda = make_redpanda_service(self.test_context, num_brokers=3)
self.source_broker.start()
self.redpanda.start()

Expand Down
4 changes: 2 additions & 2 deletions tests/rptest/tests/nodes_decommissioning_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from rptest.clients.types import TopicSpec
from rptest.tests.end_to_end import EndToEndTest
from rptest.services.admin import Admin
from rptest.services.redpanda import CHAOS_LOG_ALLOW_LIST, RESTART_LOG_ALLOW_LIST, RedpandaService
from rptest.services.redpanda import CHAOS_LOG_ALLOW_LIST, RESTART_LOG_ALLOW_LIST, RedpandaService, make_redpanda_service
from rptest.utils.node_operations import NodeDecommissionWaiter


Expand Down Expand Up @@ -514,7 +514,7 @@ def records_to_wait(self):
@parametrize(shutdown_decommissioned=False)
def test_decommissioning_rebalancing_node(self, shutdown_decommissioned):
# start redpanda with disabled rebalancing
self.redpanda = RedpandaService(
self.redpanda = make_redpanda_service(
self.test_context,
4,
extra_rp_conf={"partition_autobalancing_mode": "node_add"})
Expand Down
16 changes: 8 additions & 8 deletions tests/rptest/tests/partition_balancer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from rptest.util import wait_until_result
from rptest.utils.mode_checks import skip_debug_mode
from rptest.clients.default import DefaultClient
from rptest.services.redpanda import RedpandaService, CHAOS_LOG_ALLOW_LIST, MetricsEndpoint
from rptest.services.redpanda import make_redpanda_service, CHAOS_LOG_ALLOW_LIST, MetricsEndpoint
from rptest.services.failure_injector import FailureInjector, FailureSpec
from rptest.services.admin_ops_fuzzer import AdminOperationsFuzzer
from rptest.services.kgo_verifier_services import KgoVerifierProducer
Expand Down Expand Up @@ -457,9 +457,9 @@ def check_rack_placement(self, topic, rack_layout):
@cluster(num_nodes=8, log_allow_list=CHAOS_LOG_ALLOW_LIST)
def test_rack_awareness(self):
extra_rp_conf = self._extra_rp_conf | {"enable_rack_awareness": True}
self.redpanda = RedpandaService(self.test_context,
num_brokers=6,
extra_rp_conf=extra_rp_conf)
self.redpanda = make_redpanda_service(self.test_context,
num_brokers=6,
extra_rp_conf=extra_rp_conf)

rack_layout = "AABBCC"
for ix, node in enumerate(self.redpanda.nodes):
Expand Down Expand Up @@ -502,9 +502,9 @@ def test_rack_constraint_repair(self):
"""

extra_rp_conf = self._extra_rp_conf | {"enable_rack_awareness": True}
self.redpanda = RedpandaService(self.test_context,
num_brokers=5,
extra_rp_conf=extra_rp_conf)
self.redpanda = make_redpanda_service(self.test_context,
num_brokers=5,
extra_rp_conf=extra_rp_conf)

rack_layout = "ABBCC"
for ix, node in enumerate(self.redpanda.nodes):
Expand Down Expand Up @@ -641,7 +641,7 @@ def test_full_nodes(self):
if skip_reason:
self.logger.warn("skipping test: " + skip_reason)
# avoid the "Test requested 6 nodes, used only 0" error
self.redpanda = RedpandaService(self.test_context, 0)
self.redpanda = make_redpanda_service(self.test_context, 0)
self.test_context.cluster.alloc(ClusterSpec.simple_linux(6))
return

Expand Down
12 changes: 5 additions & 7 deletions tests/rptest/tests/read_replica_e2e_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ducktape.mark import matrix
from ducktape.tests.test import TestContext

from rptest.services.redpanda import CloudStorageType, RedpandaService, get_cloud_storage_type
from rptest.services.redpanda import CloudStorageType, RedpandaService, get_cloud_storage_type, make_redpanda_service
from rptest.services.redpanda_installer import InstallOptions, RedpandaInstaller
from rptest.tests.end_to_end import EndToEndTest
from rptest.utils.expect_rate import ExpectRate, RateTarget
Expand Down Expand Up @@ -124,9 +124,8 @@ def __init__(self, test_context: TestContext):
self.second_cluster = None

def start_second_cluster(self) -> None:
self.second_cluster = RedpandaService(self.test_context,
num_brokers=3,
si_settings=self.rr_settings)
self.second_cluster = make_redpanda_service(
self.test_context, num_brokers=3, si_settings=self.rr_settings)
self.second_cluster.start(start_si=False)

def create_read_replica_topic(self) -> None:
Expand Down Expand Up @@ -386,9 +385,8 @@ def test_upgrades(self):
30)
self.producer.stop()

self.second_cluster = RedpandaService(self.test_context,
num_brokers=3,
si_settings=self.rr_settings)
self.second_cluster = make_redpanda_service(
self.test_context, num_brokers=3, si_settings=self.rr_settings)
previous_version = self.second_cluster._installer.highest_from_prior_feature_version(
RedpandaInstaller.HEAD)
self.second_cluster._installer.install(self.second_cluster.nodes,
Expand Down
4 changes: 2 additions & 2 deletions tests/rptest/tests/redpanda_binary_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from ducktape.tests.test import Test
from rptest.services.cluster import cluster
from rptest.services.redpanda import RedpandaService
from rptest.services.redpanda import make_redpanda_service


class RedpandaBinaryTest(Test):
Expand All @@ -21,7 +21,7 @@ class RedpandaBinaryTest(Test):
"""
def __init__(self, test_context):
super(RedpandaBinaryTest, self).__init__(test_context=test_context)
self.redpanda = RedpandaService(self.test_context, 1)
self.redpanda = make_redpanda_service(self.test_context, 1)

@cluster(num_nodes=1, check_allowed_error_logs=False)
def test_version(self):
Expand Down
12 changes: 6 additions & 6 deletions tests/rptest/tests/redpanda_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from typing import Sequence

from ducktape.tests.test import Test
from rptest.services.redpanda import RedpandaService, CloudStorageType
from rptest.services.redpanda import make_redpanda_service, CloudStorageType
from rptest.clients.kafka_cli_tools import KafkaCliTools
from rptest.clients.default import DefaultClient
from rptest.util import Scale
Expand Down Expand Up @@ -54,11 +54,11 @@ def __init__(self,
else:
num_brokers = 1

self.redpanda = RedpandaService(test_context,
num_brokers,
extra_rp_conf=extra_rp_conf,
si_settings=self.si_settings,
**kwargs)
self.redpanda = make_redpanda_service(test_context,
num_brokers,
extra_rp_conf=extra_rp_conf,
si_settings=self.si_settings,
**kwargs)
self._client = DefaultClient(self.redpanda)

def early_exit_hook(self):
Expand Down
Loading

0 comments on commit 0e8a31d

Please sign in to comment.