Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DPE-3552] Fix handling of extraJavaOptions #101

Merged
merged 7 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ignore_missing_imports = true

[tool.poetry]
name = "spark8t"
version = "0.0.9"
version = "0.0.10"
description = "This project provides some utilities function and CLI commands to run Spark on K8s."
authors = [
"Canonical Data Platform <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion spark8t/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def options(self) -> Dict[str, Dict]:
@staticmethod
def _construct_options_string(options: Dict) -> str:
output = " ".join(f"-D{k}={v}" for k, v in options.items())
return f'"{output}"'
return f"{output}"

@classmethod
def empty(cls) -> "PropertyFile":
Expand Down
2 changes: 1 addition & 1 deletion spark8t/literals.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MANAGED_BY_LABELNAME = "app.kubernetes.io/managed-by"
PRIMARY_LABELNAME = "app.kubernetes.io/spark8t-primary"
SPARK8S_LABEL = "spark8t"
HUB_LABEL = "integration-hub-conf"
HUB_LABEL = "integrator-hub-conf" # TODO revert this label to `integration-hub-conf``
2 changes: 1 addition & 1 deletion spark8t/resources/templates/role_yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ rules:
resources:
- secrets
resourceNames:
- integration-hub-conf-{{username}}
- integrator-hub-conf-{{username}}
verbs:
- get
2 changes: 1 addition & 1 deletion tests/integration/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_merge_configurations():
expected_merged_props = PropertyFile(
{
k1: v13,
k2: f'"-Dscala.shell.histfile={v23}"',
k2: f"-Dscala.shell.histfile={v23}",
"key1": "value1",
"key2": "value2",
"key3": "value3",
Expand Down
14 changes: 7 additions & 7 deletions tests/unittest/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def test_property_file_parse_options():

scala_hist_file = str(uuid.uuid4())

props_with_option = f'"-Dscala.shell.histfile={scala_hist_file} -Da=A -Db=B -Dc=C"'
props_with_option = f"-Dscala.shell.histfile={scala_hist_file} -Da=A -Db=B -Dc=C"

conf = PropertyFile(
props={
Expand All @@ -213,7 +213,7 @@ def test_property_file_construct_options_string():
scala_hist_file = str(uuid.uuid4())

expected_props_with_option = (
f'"-Dscala.shell.histfile={scala_hist_file} -Da=A -Db=B -Dc=C"'
f"-Dscala.shell.histfile={scala_hist_file} -Da=A -Db=B -Dc=C"
)

assert (
Expand All @@ -240,7 +240,7 @@ def test_property_file_io():
app_name = str(uuid.uuid4())
test_config_w = dict()
contents_java_options = (
f'-Dscala.shell.histfile = "{scala_hist_file} -Da=A -Db=B -Dc=C"'
f"-Dscala.shell.histfile={scala_hist_file} -Da=A -Db=B -Dc=C"
)

test_config_w["spark.kubernetes.authenticate.driver.serviceAccountName"] = name
Expand Down Expand Up @@ -285,11 +285,11 @@ def test_merge_property_file_options(tmp_path, key):
"""
filename_1 = os.path.join(tmp_path, "test-1.properties")
with open(filename_1, "w") as fid:
fid.write(f'{key}="-Da=A -Db=B"')
fid.write(f"{key}=-Da=A -Db=B")

filename_2 = os.path.join(tmp_path, "test-2.properties")
with open(filename_2, "w") as fid:
fid.write(f'{key}="-Da=D -Dc=C"')
fid.write(f"{key}=-Da=D -Dc=C")

conf_1 = PropertyFile.read(filename_1)
conf_2 = PropertyFile.read(filename_2)
Expand All @@ -298,15 +298,15 @@ def test_merge_property_file_options(tmp_path, key):

assert conf_1.options[key]["a"] == "A"

assert conf_1.props[key] == '"-Da=A -Db=B"'
assert conf_1.props[key] == "-Da=A -Db=B"

merged = conf_1 + conf_2

assert len(merged.options[key]) == 3

assert merged.options[key]["a"] == "D"

assert merged.props[key] == '"-Da=D -Db=B -Dc=C"'
assert merged.props[key] == "-Da=D -Db=B -Dc=C"


def test_property_file_log(caplog):
Expand Down