Skip to content

Commit add8d63

Browse files
committed
Skip jira ticket check if cluster manager is local
1 parent 5f0095a commit add8d63

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

service_configuration_lib/spark_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ def get_spark_conf(
10601060
user = user or os.environ.get('USER', None)
10611061

10621062
if self.mandatory_default_spark_srv_conf.get('spark.yelp.jira_ticket.enabled') == 'true':
1063-
needs_jira_check = user not in TICKET_NOT_REQUIRED_USERS
1063+
needs_jira_check = cluster_manager != 'local' and user not in TICKET_NOT_REQUIRED_USERS
10641064
if needs_jira_check:
10651065
valid_ticket = self._get_valid_jira_ticket(jira_ticket)
10661066
if valid_ticket is None:

tests/spark_config_test.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,15 +1901,18 @@ def test_get_spark_conf_with_jira_validation_disabled(self, mock_spark_srv_conf_
19011901
assert 'spark.kubernetes.executor.label.spark.yelp.com/jira_ticket' not in result
19021902

19031903
@pytest.mark.parametrize(
1904-
'user,should_check', [
1905-
('regular_user', True),
1906-
('batch', False),
1907-
('TRON', False),
1908-
(None, False),
1904+
'cluster_manager,user,should_check', [
1905+
('kubernetes', 'regular_user', True),
1906+
('kubernetes', 'batch', False),
1907+
('kubernetes', 'TRON', False),
1908+
('kubernetes', None, False),
1909+
('local', 'regular_user', False),
1910+
('local', 'TRON', False),
1911+
('local', None, False),
19091912
],
19101913
)
19111914
def test_jira_ticket_check_for_different_users(
1912-
self, user, should_check, mock_spark_srv_conf_file_with_jira_enabled, mock_log,
1915+
self, cluster_manager, user, should_check, mock_spark_srv_conf_file_with_jira_enabled, mock_log,
19131916
):
19141917
"""Test that Jira ticket validation is skipped for certain users."""
19151918
spark_conf_builder = spark_config.SparkConfBuilder()
@@ -1918,7 +1921,7 @@ def test_jira_ticket_check_for_different_users(
19181921
# For regular users, validation should be enforced
19191922
with pytest.raises(RuntimeError):
19201923
spark_conf_builder.get_spark_conf(
1921-
cluster_manager='kubernetes',
1924+
cluster_manager=cluster_manager,
19221925
spark_app_base_name='test-app',
19231926
user_spark_opts={},
19241927
paasta_cluster='test-cluster',
@@ -1931,7 +1934,7 @@ def test_jira_ticket_check_for_different_users(
19311934
else:
19321935
# For special users, validation should be skipped
19331936
spark_conf_builder.get_spark_conf(
1934-
cluster_manager='kubernetes',
1937+
cluster_manager=cluster_manager,
19351938
spark_app_base_name='test-app',
19361939
user_spark_opts={},
19371940
paasta_cluster='test-cluster',

0 commit comments

Comments
 (0)