Skip to content

Commit

Permalink
feature(ruff): enable more plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
fruch committed Dec 17, 2023
1 parent 0060d67 commit 90d6233
Show file tree
Hide file tree
Showing 250 changed files with 1,268 additions and 1,350 deletions.
4 changes: 2 additions & 2 deletions add_new_dc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_add_new_dc(self) -> None: # pylint: disable=too-many-locals
status = self.db_cluster.get_nodetool_status()
self.reconfigure_keyspaces_to_use_network_topology_strategy(
keyspaces=system_keyspaces,
replication_factors={dc: len(status[dc].keys()) for dc in status}
replication_factors={dc: len(status[dc].keys()) for dc in status},
)
self.prewrite_db_with_data()
read_thread, write_thread = self.start_stress_during_adding_new_dc()
Expand All @@ -38,7 +38,7 @@ def test_add_new_dc(self) -> None: # pylint: disable=too-many-locals
status = self.db_cluster.get_nodetool_status()
self.reconfigure_keyspaces_to_use_network_topology_strategy(
keyspaces=system_keyspaces + ["keyspace1"],
replication_factors={dc: len(status[dc].keys()) for dc in status}
replication_factors={dc: len(status[dc].keys()) for dc in status},
)

self.log.info("Running rebuild on each node in new DC")
Expand Down
8 changes: 4 additions & 4 deletions artifacts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"aws": ["Ec2Snitch", "Ec2MultiRegionSnitch"],
"gce": ["GoogleCloudSnitch"],
"azure": ["AzureSnitch"],
"docker": ["GossipingPropertyFileSnitch", "SimpleSnitch"]
"docker": ["GossipingPropertyFileSnitch", "SimpleSnitch"],
}


Expand Down Expand Up @@ -218,13 +218,13 @@ def verify_snitch(self, backend_name: str):
with self.subTest('verify snitch against describecluster output'):
self.assertTrue(any(snitch_matches_describecluster),
msg=f"Expected snitch matches for describecluster to not be empty, but was. Snitch "
f"matches: {snitch_matches_describecluster}"
f"matches: {snitch_matches_describecluster}",
)

with self.subTest('verify snitch against scylla.yaml configuration'):
self.assertTrue(any(snitch_matches_scylla_yaml),
msg=f"Expected snitch matches for scylla yaml to not be empty, but was. Snitch "
f"matches: {snitch_matches_scylla_yaml}"
f"matches: {snitch_matches_scylla_yaml}",
)

def verify_docker_latest_match_release(self) -> None:
Expand Down Expand Up @@ -448,6 +448,6 @@ def get_email_data(self):
"scylla_packages_installed": scylla_packages,
"unified_package": self.params.get("unified_package"),
"nonroot_offline_install": self.params.get("nonroot_offline_install"),
"scylla_repo": self.params.get("scylla_repo"), })
"scylla_repo": self.params.get("scylla_repo")})

return email_data
2 changes: 0 additions & 2 deletions big_cluster_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
6 changes: 2 additions & 4 deletions cdc_replication_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down Expand Up @@ -40,7 +38,7 @@ def mode_str(mode: Mode) -> str:
return {
Mode.DELTA: 'delta',
Mode.PREIMAGE: 'preimage',
Mode.POSTIMAGE: 'postimage'
Mode.POSTIMAGE: 'postimage',
}[mode]


Expand Down Expand Up @@ -427,7 +425,7 @@ def get_email_data(self) -> dict:
"oracle_db_version":
self.cs_db_cluster.nodes[0].scylla_version if self.cs_db_cluster else "N/A",
"oracle_instance_type": self.params.get("instance_type_db_oracle"),
"consistency_status": self.consistency_ok
"consistency_status": self.consistency_ok,
})

return email_data
2 changes: 0 additions & 2 deletions cluster_configuration_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
2 changes: 0 additions & 2 deletions corrupt_then_rebuild_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
2 changes: 0 additions & 2 deletions cql_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
2 changes: 0 additions & 2 deletions custom_cs_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
2 changes: 0 additions & 2 deletions destroy_data_then_repair_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
2 changes: 0 additions & 2 deletions enospc_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
2 changes: 0 additions & 2 deletions functional_tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
2 changes: 0 additions & 2 deletions functional_tests/scylla_operator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
6 changes: 2 additions & 4 deletions functional_tests/scylla_operator/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down Expand Up @@ -117,14 +115,14 @@ def fixture_db_cluster(tester: ScyllaOperatorFunctionalClusterTester):
_bring_cluster_back_to_original_state(
tester,
config_map=original_scylla_config_map,
original_scylla_cluster_spec=original_scylla_cluster_spec
original_scylla_cluster_spec=original_scylla_cluster_spec,
)


def _bring_cluster_back_to_original_state(
tester: ScyllaOperatorFunctionalClusterTester,
config_map: dict,
original_scylla_cluster_spec: dict
original_scylla_cluster_spec: dict,
):
restart = False
db_cluster = tester.db_cluster
Expand Down
2 changes: 0 additions & 2 deletions functional_tests/scylla_operator/libs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
4 changes: 1 addition & 3 deletions functional_tests/scylla_operator/libs/auxiliary.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down Expand Up @@ -32,7 +30,7 @@ def get_email_data(self):
email_data = self._get_common_email_data()
email_data.update({
"test_statuses": self.test_data,
"scylla_ami_id": self.params.get("ami_id_db_scylla") or "-", }
"scylla_ami_id": self.params.get("ami_id_db_scylla") or "-"},
)
return email_data

Expand Down
2 changes: 0 additions & 2 deletions functional_tests/scylla_operator/libs/helpers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
12 changes: 5 additions & 7 deletions functional_tests/scylla_operator/test_functional.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down Expand Up @@ -129,8 +127,8 @@ def test_deploy_quasi_multidc_db_cluster(db_cluster: ScyllaPodCluster): # pylin
'resources': {
'requests': {'cpu': '200m', 'memory': "200Mi"},
'limits': {'cpu': '500m', 'memory': "400Mi"},
}
}]
},
}],
})

k8s_cluster.create_namespace(namespace=namespace)
Expand Down Expand Up @@ -423,7 +421,7 @@ def test_mgmt_backup(db_cluster, manager_version):
mgr_cluster = db_cluster.get_cluster_manager()
backup_bucket_location = db_cluster.params.get('backup_bucket_location')
bucket_name = f"s3:{backup_bucket_location.split()[0]}"
mgr_task = mgr_cluster.create_backup_task(location_list=[bucket_name, ])
mgr_task = mgr_cluster.create_backup_task(location_list=[bucket_name])
assert mgr_task, "Failed to create backup task"
status = mgr_task.wait_and_get_final_status(timeout=7200, step=5, only_final=True)
assert TaskStatus.DONE == status
Expand Down Expand Up @@ -514,7 +512,7 @@ def test_check_operator_operability_when_scylla_crd_is_incorrect(db_cluster):
'serviceAccount': {
'create': True,
'annotations': {},
'name': f"{cluster_name}-member"
'name': f"{cluster_name}-member",
},
'developerMode': True,
'sysctls': ["fs.aio-max-nr=1048576"],
Expand All @@ -528,7 +526,7 @@ def test_check_operator_operability_when_scylla_crd_is_incorrect(db_cluster):
'limits': {'cpu': 1, 'memory': "200Mi"},
'requests': {'cpu': 1, 'memory': "200Mi"},
},
}]
}],
})
db_cluster.k8s_cluster.create_namespace(namespace=namespace)
db_cluster.k8s_cluster.helm_install(
Expand Down
4 changes: 1 addition & 3 deletions gemini_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down Expand Up @@ -28,7 +26,7 @@ class GeminiTest(ClusterTester):
"cmd": ["N/A"],
"status": "Not Running",
"results": [],
'errors': {}
'errors': {},
}

def test_random_load(self):
Expand Down
2 changes: 0 additions & 2 deletions grow_cluster_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
2 changes: 1 addition & 1 deletion ics_space_amplification_goal_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def test_ics_space_amplification_goal(self): # pylint: disable=too-many-locals
if sag:
additional_compaction_params.update({'space_amplification_goal': sag})
self.log.info('Run a major compaction on nodes and wait for compactions end')
triggers = [partial(node.run_nodetool, sub_cmd="compact", args=f"{KEYSPACE_NAME} {TABLE_NAME}", ) for
triggers = [partial(node.run_nodetool, sub_cmd="compact", args=f"{KEYSPACE_NAME} {TABLE_NAME}") for
node in self.db_cluster.nodes]
ParallelObject(objects=triggers, timeout=3000).call_objects()
self.wait_compactions_are_running()
Expand Down
2 changes: 1 addition & 1 deletion jepsen_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_jepsen(self):
creds = f"--username {self.db_cluster.nodes[0].ssh_login_info['user']} --ssh-private-key ~/{DB_SSH_KEY}"
run_jepsen_cmd = partial(
getattr(self, f"run_jepsen_cmd_{self.params.get('jepsen_test_run_policy')}"),
ntimes=self.params.get("jepsen_test_count")
ntimes=self.params.get("jepsen_test_count"),
)
passed = True
for test in self.params.get("jepsen_test_cmd"):
Expand Down
4 changes: 2 additions & 2 deletions longevity_lwt_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def run_prepare_write_cmd(self):
self.data_validator = MagicMock()
self.data_validator.keyspace_name = None
DataValidatorEvent.DataValidator(severity=Severity.NORMAL,
message="Test runs with parallel nemesis. Data validator is disabled."
message="Test runs with parallel nemesis. Data validator is disabled.",
).publish()
else:
self.data_validator = LongevityDataValidator(longevity_self_object=self,
Expand Down Expand Up @@ -88,7 +88,7 @@ def validate_data(self):
node = self.db_cluster.nodes[0]
if not (keyspace := self.data_validator.keyspace_name):
DataValidatorEvent.DataValidator(severity=Severity.NORMAL,
message="Failed fo get keyspace name. Data validator is disabled."
message="Failed fo get keyspace name. Data validator is disabled.",
).publish()
return

Expand Down
2 changes: 0 additions & 2 deletions longevity_operator_multi_tenant_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
2 changes: 0 additions & 2 deletions longevity_sla_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
6 changes: 2 additions & 4 deletions longevity_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down Expand Up @@ -80,7 +78,7 @@ def _get_scan_operation_params(self) -> list[ThreadParams]:
user=sla_role_name,
user_password=sla_role_password,
duration=self.get_duration(item_dict.get("duration")),
**item_dict
**item_dict,
))

self.log.info('Scan operation scan_operation_params_list are: %s', scan_operation_params_list)
Expand Down Expand Up @@ -483,7 +481,7 @@ def get_email_data(self):
"node_benchmarks": benchmarks_results,
"nemesis_details": nemeses_stats,
"nemesis_name": self.params.get("nemesis_class_name"),
"scylla_ami_id": self.params.get("ami_id_db_scylla") or "-", })
"scylla_ami_id": self.params.get("ami_id_db_scylla") or "-"})
return email_data

def create_templated_user_stress_params(self, idx, cs_profile): # pylint: disable=invalid-name
Expand Down
4 changes: 2 additions & 2 deletions longevity_tombstone_gc_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def __init__(self, *args, **kwargs):

def _run_repair_and_major_compaction(self, wait_propagation_delay: bool = False):
self.log.info('Run a flush for %s on nodes', self.keyspace)
triggers = [partial(node.run_nodetool, sub_cmd=f"flush -- {self.keyspace}", ) for node in self.db_cluster.nodes]
triggers = [partial(node.run_nodetool, sub_cmd=f"flush -- {self.keyspace}") for node in self.db_cluster.nodes]
ParallelObject(objects=triggers, timeout=1200).call_objects()

self.log.info('Run a repair for %s on nodes', self.ks_cf)
triggers = [partial(node.run_nodetool, sub_cmd="repair", args=f"-pr {self.keyspace} {self.table}", ) for node
triggers = [partial(node.run_nodetool, sub_cmd="repair", args=f"-pr {self.keyspace} {self.table}") for node
in self.db_cluster.nodes]
ParallelObject(objects=triggers, timeout=1200).call_objects()

Expand Down
2 changes: 0 additions & 2 deletions maintenance_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
4 changes: 1 addition & 3 deletions mgmt_cli_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down Expand Up @@ -441,7 +439,7 @@ def get_email_data(self):
email_data = self._get_common_email_data()
email_data.update({"manager_server_repo": self.params.get("scylla_mgmt_address"),
"manager_agent_repo": self.params.get("scylla_mgmt_agent_address") or
self.params.get("scylla_mgmt_address"), })
self.params.get("scylla_mgmt_address")})

return email_data

Expand Down
2 changes: 0 additions & 2 deletions multiple_dc_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
Expand Down
2 changes: 1 addition & 1 deletion performance_regression_gradual_grow_throughput.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,6 @@ def warmup_cache(self, compaction_strategy):
stress_num=1,
compaction_strategy=compaction_strategy,
stats_aggregate_cmds=False,
round_robin=True
round_robin=True,
)
self.get_stress_results(stress_queue, store_results=False)
Loading

0 comments on commit 90d6233

Please sign in to comment.