Skip to content

Commit 2fd6721

Browse files
committed
ducktape: fix data_policy ducktape test
1 parent a85fe5d commit 2fd6721

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
function foo() {}

tests/rptest/tests/data_policy_test.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,42 @@
77
# the Business Source License, use of this software will be governed
88
# by the Apache License, Version 2.0
99

10+
import os
11+
1012
from ducktape.mark.resource import cluster
1113
from rptest.clients.kafka_cli_tools import KafkaCliTools
1214
from rptest.clients.types import TopicSpec
1315

1416
import subprocess
1517

1618
from rptest.tests.redpanda_test import RedpandaTest
19+
from rptest.clients.rpk import RpkTool
1720

1821

1922
class DataPolicyTest(RedpandaTest):
2023
topics = (TopicSpec(partition_count=1, replication_factor=3), )
2124

2225
def __init__(self, test_context):
26+
extra_rp_conf = dict(
27+
developer_mode=True,
28+
enable_v8=True,
29+
)
2330
super(DataPolicyTest, self).__init__(test_context=test_context,
24-
num_brokers=3)
31+
num_brokers=3,
32+
extra_rp_conf=extra_rp_conf)
2533

2634
self.kafka_tools = KafkaCliTools(self.redpanda)
35+
self.rpk = RpkTool(self.redpanda)
2736

2837
def _get_data_policy(self, function_name, script_name):
2938
return "function_name: {} script_name: {}".format(
3039
function_name, script_name)
3140

41+
def _deploy_script(self, script_name, path):
42+
current_dir = os.path.dirname(os.path.realpath(__file__))
43+
file_path = os.path.join(current_dir, "data_policy_scripts", path)
44+
self.rpk.wasm_deploy(file_path, script_name, "", "data-policy")
45+
3246
@cluster(num_nodes=3)
3347
def test_default_data_policy(self):
3448
topic = self.topics[0].name
@@ -38,6 +52,7 @@ def test_default_data_policy(self):
3852

3953
@cluster(num_nodes=3)
4054
def test_set_data_policy(self):
55+
self._deploy_script("2", "simple.js")
4156
topic = self.topics[0].name
4257
kafka_tools = KafkaCliTools(self.redpanda)
4358
res = kafka_tools.alter_topic_config(
@@ -50,6 +65,7 @@ def test_set_data_policy(self):
5065

5166
@cluster(num_nodes=3)
5267
def test_incremental_config(self):
68+
self._deploy_script("2", "simple.js")
5369
topic = self.topics[0].name
5470
kafka_tools = KafkaCliTools(self.redpanda)
5571
kafka_tools.alter_topic_config(

0 commit comments

Comments
 (0)