Skip to content

Commit

Permalink
Merge pull request redpanda-data#9098 from VladLazar/ignore-upgrade-t…
Browse files Browse the repository at this point in the history
…est-on-azure

rptest: skip cloud storage upgrade test in Azure CDT
  • Loading branch information
jcsp authored Feb 28, 2023
2 parents 50736ce + 2bbe292 commit 46e450a
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 1 deletion.
6 changes: 5 additions & 1 deletion 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
from rptest.services.redpanda import RedpandaService, CloudStorageType
from rptest.clients.kafka_cli_tools import KafkaCliTools
from rptest.clients.default import DefaultClient
from rptest.util import Scale
Expand Down Expand Up @@ -91,6 +91,10 @@ def ci_mode(self):
"""
return os.environ.get('CI', None) != 'false'

@property
def azure_blob_storage(self):
return self.si_settings.cloud_storage_type == CloudStorageType.ABS

@property
def cloud_storage_client(self):
return self.redpanda.cloud_storage_client
Expand Down
17 changes: 17 additions & 0 deletions tests/rptest/tests/topic_creation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from rptest.services.rpk_producer import RpkProducer
from rptest.clients.kafka_cli_tools import KafkaCliTools
from rptest.util import wait_for_segments_removal, expect_exception
from rptest.utils.mode_checks import skip_azure_blob_storage
from rptest.clients.kcl import KCL

from ducktape.utils.util import wait_until
Expand Down Expand Up @@ -478,7 +479,15 @@ def __init__(self, test_context):
self.installer = self.redpanda._installer
self.rpk = RpkTool(self.redpanda)

# This test starts the Redpanda service inline (see 'install_and_start') at the beginning
# of the test body. By default, in the Azure CDT env, the service startup
# logic attempts to set the azure specific cluster configs.
# However, these did not exist prior to v23.1 and the test would fail
# before it can be skipped.
def setUp(self):
pass

def install_and_start(self):
self.installer.install(
self.redpanda.nodes,
(22, 2),
Expand All @@ -491,12 +500,14 @@ def _populate_tiered_storage_topic(self, topic_name):
wait_for_segments_removal(self.redpanda, topic_name, 0, 1)

@cluster(num_nodes=3)
@skip_azure_blob_storage
def test_cloud_storage_sticky_enablement_v22_2_to_v22_3(self):
"""
In Redpanda 22.3, the cluster defaults for cloud storage change
from being applied at runtime to being sticky at creation time,
or at upgrade time.
"""
self.install_and_start()

# Switch on tiered storage using cluster properties, not topic properties
self.redpanda.set_cluster_config(
Expand Down Expand Up @@ -555,7 +566,10 @@ def test_cloud_storage_sticky_enablement_v22_2_to_v22_3(self):
assert described['redpanda.remote.read'] == ('false', 'DEFAULT_CONFIG')

@cluster(num_nodes=3)
@skip_azure_blob_storage
def test_retention_config_on_upgrade_from_v22_2_to_v22_3(self):
self.install_and_start()

self.rpk.create_topic("test-topic-with-retention",
config={"retention.bytes": 10000})

Expand Down Expand Up @@ -729,11 +743,14 @@ def is_empty():
assert len(deleted_objects) == 0

@cluster(num_nodes=3)
@skip_azure_blob_storage
def test_retention_upgrade_with_cluster_remote_write(self):
"""
Validate how the cluster-wide cloud_storage_enable_remote_write
is handled on upgrades from <=22.2
"""
self.install_and_start()

self.redpanda.set_cluster_config(
{"cloud_storage_enable_remote_write": "true"}, expect_restart=True)

Expand Down
23 changes: 23 additions & 0 deletions tests/rptest/tests/upgrade_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
wait_until_segments,
)
from rptest.utils.si_utils import S3Snapshot
from rptest.utils.mode_checks import skip_azure_blob_storage
from rptest.services.cluster import cluster
from rptest.services.redpanda import SISettings
from rptest.services.kgo_verifier_services import (
Expand Down Expand Up @@ -373,13 +374,22 @@ def __init__(self, test_context):
self.installer = self.redpanda._installer
self.rpk = RpkTool(self.redpanda)

# This test starts the Redpanda service inline (see 'install_and_start') at the beginning
# of the test body. By default, in the Azure CDT env, the service startup
# logic attempts to set the azure specific cluster configs.
# However, these did not exist prior to v23.1 and the test would fail
# before it can be skipped.
def setUp(self):
pass

def install_and_start(self):
self.prev_version = \
self.installer.highest_from_prior_feature_version(RedpandaInstaller.HEAD)
self.installer.install(self.redpanda.nodes, self.prev_version)
super().setUp()

@cluster(num_nodes=4, log_allow_list=RESTART_LOG_ALLOW_LIST)
@skip_azure_blob_storage
def test_rolling_upgrade(self):
"""
Verify that when tiered storage writes happen during a rolling upgrade,
Expand All @@ -388,6 +398,8 @@ def test_rolling_upgrade(self):
This ensures that rollbacks remain possible.
"""
self.install_and_start()

initial_version = Version(
self.redpanda.get_version(self.redpanda.nodes[0]))

Expand Down Expand Up @@ -555,11 +567,20 @@ def __init__(self, test_context):
self.rpk = RpkTool(self.redpanda)
self.s3_bucket_name = si_settings.cloud_storage_bucket

# This test starts the Redpanda service inline (see 'install_and_start') at the beginning
# of the test body. By default, in the Azure CDT env, the service startup
# logic attempts to set the azure specific cluster configs.
# However, these did not exist prior to v23.1 and the test would fail
# before it can be skipped.
def setUp(self):
pass

def install_and_start(self):
self.installer.install(self.redpanda.nodes, (22, 2, 7))
super().setUp()

@cluster(num_nodes=3, log_allow_list=RESTART_LOG_ALLOW_LIST)
@skip_azure_blob_storage
def test_upgrade(self):
"""
Verify that there is no data loss with topics that have been 'upgraded',
Expand All @@ -569,6 +590,8 @@ def test_upgrade(self):
Their respective new cloud retention settings should be 'infinity' and
there should be no truncations or compactions performed on the partitions
"""
self.install_and_start()

total_segments = 10
topic = TopicSpec(name='migrating-topic',
partition_count=1,
Expand Down
32 changes: 32 additions & 0 deletions tests/rptest/utils/mode_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,35 @@ def f(*args, **kwargs):
return func(*args, **kwargs)

return f


def skip_azure_blob_storage(func):
"""
Decorator applied to a test class method. The property `azure_blob_storage` should be present
on the object.
If set to true, the wrapped function call is skipped, and a cleanup action
is performed instead.
If set to false, the wrapped function (usually a test case) is called.
"""
@functools.wraps(func)
def f(*args, **kwargs):
assert args, 'skip_azure_blob_storage must be placed on a test method in a class'

caller = args[0]

assert hasattr(
caller, 'azure_blob_storage'
), 'skip_azure_blob_storage called on object which does not have azure_blob_storage attribute'
assert hasattr(
caller, 'logger'
), 'skip_azure_blob_storage called on object which has no logger'
if caller.azure_blob_storage:
caller.logger.info(
"Skipping Azure Blob Storage test in (requires S3)")
cleanup_on_early_exit(caller)
return None
return func(*args, **kwargs)

return f

0 comments on commit 46e450a

Please sign in to comment.