From e8b4c47ecd1c46e044440091032c69573152e5c1 Mon Sep 17 00:00:00 2001 From: Vlad Lazar Date: Mon, 18 Jul 2022 12:07:44 +0100 Subject: [PATCH 1/3] docker: clone and install arroyo in test container This commit extends the ducktape test container to clone and install arroyo (https://github.com/getsentry/arroyo) in order to run its test suite against a Redpanda cluster. --- tests/docker/Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/docker/Dockerfile b/tests/docker/Dockerfile index 050730cd6f6d..161c549e3243 100644 --- a/tests/docker/Dockerfile +++ b/tests/docker/Dockerfile @@ -163,6 +163,13 @@ RUN apt update && \ file && \ rm -rf /var/lib/apt/lists/* +# Clone and install the arroyo client library in order to run its test suite. +RUN mkdir /root/external_test_suites && \ + git -C /root/external_test_suites clone --depth=1 https://github.com/getsentry/arroyo.git && \ + cd /root/external_test_suites/arroyo && \ + git reset --hard 2631cf1406b0cb5bc05c8a37e8f9f5a40fcf31d4 && \ + python3 -m pip install --force --no-cache-dir -e /root/external_test_suites/arroyo + RUN mkdir -p /opt/scripts && \ curl https://raw.githubusercontent.com/redpanda-data/seastar/2a9504b3238cba4150be59353bf8d0b3a01fe39c/scripts/addr2line.py -o /opt/scripts/addr2line.py && \ curl https://raw.githubusercontent.com/redpanda-data/seastar/2a9504b3238cba4150be59353bf8d0b3a01fe39c/scripts/seastar-addr2line -o /opt/scripts/seastar-addr2line && \ From 1d3331fe67ced8d34eac807c8690558050d53cc8 Mon Sep 17 00:00:00 2001 From: Vlad Lazar Date: Mon, 18 Jul 2022 12:09:20 +0100 Subject: [PATCH 2/3] rptest: add pytest dep to the rptest package Pytest is required in order to run the arroyo tests. --- tests/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/setup.py b/tests/setup.py index 49f997f269a8..c662aa22173e 100644 --- a/tests/setup.py +++ b/tests/setup.py @@ -17,7 +17,7 @@ 'prometheus-client==0.9.0', 'pyyaml==5.3.1', 'kafka-python==2.0.2', 'crc32c==2.2', 'confluent-kafka==1.7.0', 'zstandard==0.15.2', 'xxhash==2.0.2', 'protobuf==3.19.3', 'fastavro==1.4.9', - 'psutil==5.9.0', 'numpy==1.22.3', 'pygal==3.0', + 'psutil==5.9.0', 'numpy==1.22.3', 'pygal==3.0', 'pytest==7.1.2', 'kafkatest@git+https://github.com/apache/kafka.git@058589b03db686803b33052d574ce887fb5cfbd1#egg=kafkatest&subdirectory=tests' ], scripts=[], From 591fc4ff284b447aedb564dbeabe3cb66ab11fde Mon Sep 17 00:00:00 2001 From: Vlad Lazar Date: Mon, 18 Jul 2022 12:11:02 +0100 Subject: [PATCH 3/3] rptest: test against the arroyo test suite This commit adds a ducktape test that runs the arroyo test suite against a redpanda cluster. All test output is logged and test failures are parsed from the pytest output. The test fails if there were pytest failures or if pytest returns an error code indicating that the tests couldn't run. --- .../rptest/tests/compatibility/arroyo_test.py | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/rptest/tests/compatibility/arroyo_test.py diff --git a/tests/rptest/tests/compatibility/arroyo_test.py b/tests/rptest/tests/compatibility/arroyo_test.py new file mode 100644 index 000000000000..4a48500c6936 --- /dev/null +++ b/tests/rptest/tests/compatibility/arroyo_test.py @@ -0,0 +1,61 @@ +# Copyright 2022 Redpanda Data, Inc. +# +# Use of this software is governed by the Business Source License +# included in the file licenses/BSL.md +# +# As of the Change Date specified in that file, in accordance with +# the Business Source License, use of this software will be governed +# by the Apache License, Version 2.0 + +import os +import subprocess + +from rptest.services.cluster import cluster +from rptest.tests.prealloc_nodes import PreallocNodesTest +from ducktape.cluster.remoteaccount import RemoteCommandError + + +class ArroyoTest(PreallocNodesTest): + """ + Run the arroyo test suite against a redpanda cluster in + a ducktape environment. + + The test suite lives here under tests/ in https://github.com/getsentry/arroyo. + """ + TEST_SUITE_PATH = "/root/external_test_suites/arroyo" + + def __init__(self, ctx, *args, **kwargs): + super().__init__(test_context=ctx, + node_prealloc_count=1, + *args, + **kwargs) + + def _find_failed_tests(self, pytest_output: list[str]): + return [line for line in pytest_output if "FAILED" in line] + + @cluster(num_nodes=4) + def test_arroyo_test_suite(self): + test_node = self.preallocated_nodes[0] + + try: + env_preamble = f"DEFAULT_BROKERS={self.redpanda.brokers()}" + capture = test_node.account.ssh_capture( + f"{env_preamble} " + f"python3 -m pytest {ArroyoTest.TEST_SUITE_PATH} " + "-k KafkaStreamsTestCase -rf", + combine_stderr=True) + + pytest_output = list(capture) + for log_line in pytest_output: + self.logger.info(log_line) + + failure_reports = self._find_failed_tests(pytest_output) + if len(failure_reports) > 0: + assert False, "Arroyo test failures occured. Please check the log file" + except RemoteCommandError as err: + if err.exit_status == 2: + assert False, "Arroyo test suite was interrupted" + elif err.exit_status == 3: + assert False, "Internal error durring execution of Arroyo test suite" + elif err.exit_status == 4: + assert False, "Pytest command line invocation error"