diff options
| author | Colin Wilk <colin@wilk.cx> | 2026-08-11 01:39:58 +0200 |
|---|---|---|
| committer | Colin Wilk <colin@wilk.cx> | 2026-08-11 01:45:24 +0200 |
| commit | ac3c94b3159acf91674fdd61396e5811a6a55fb3 (patch) | |
| tree | a9f8c3f86308835d100e638edfc68cbf77ffecc8 /molecule/default/tests/test_yaml_strategy.py | |
| parent | f31bda03a2922d2b7d09be6772a5cf28f0981c8b (diff) | |
| download | ansible-role-prometheus-target-ac3c94b3159acf91674fdd61396e5811a6a55fb3.tar.gz ansible-role-prometheus-target-ac3c94b3159acf91674fdd61396e5811a6a55fb3.zip | |
Fix pre-commit lint violations
Diffstat (limited to 'molecule/default/tests/test_yaml_strategy.py')
| -rw-r--r-- | molecule/default/tests/test_yaml_strategy.py | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/molecule/default/tests/test_yaml_strategy.py b/molecule/default/tests/test_yaml_strategy.py index 7f9b6ed..9e14b80 100644 --- a/molecule/default/tests/test_yaml_strategy.py +++ b/molecule/default/tests/test_yaml_strategy.py @@ -72,14 +72,19 @@ def test_yaml_user_edited_file_is_reparsed_and_keeps_expected_semantics(host): "targets" ] == ["application2:9200"] - assert get_unlabeled_group(groups)["targets"] == ["unlabeled:9100", "standalone:9300"] + assert get_unlabeled_group(groups)["targets"] == [ + "unlabeled:9100", + "standalone:9300", + ] def test_yaml_moving_host_removes_last_host_from_old_group(host): groups = read_yaml_file(host, "/opt/yaml_move_remove_last.yml") assert not has_group_with_labels(groups, {"job": "old"}) - assert get_group_by_labels(groups, {"job": "new"})["targets"] == ["application:9400"] + assert get_group_by_labels(groups, {"job": "new"})["targets"] == [ + "application:9400" + ] def test_yaml_output_remains_parseable_after_all_operations(host): @@ -110,12 +115,14 @@ def test_yaml_branch_matrix_covers_exact_match_and_append(host): "application3:9506", ] - assert get_group_by_labels(groups, {"job": "present", "env": "prod"})["targets"] == [ - "application3:9501" - ] + assert get_group_by_labels(groups, {"job": "present", "env": "prod"})[ + "targets" + ] == ["application3:9501"] -def test_yaml_branch_matrix_keeps_nonmatching_groups_for_both_label_mismatch_paths(host): +def test_yaml_branch_matrix_keeps_nonmatching_groups_for_both_label_mismatch_paths( + host, +): groups = read_yaml_file(host, "/opt/yaml_branch_matrix.yml") assert get_group_by_labels(groups, {"job": "wrong", "env": "prod"})["targets"] == [ @@ -126,7 +133,9 @@ def test_yaml_branch_matrix_keeps_nonmatching_groups_for_both_label_mismatch_pat "keep_length_mismatch:9500" ] - assert get_group_by_labels(groups, {"job": "foreign"})["targets"] == ["foreign:9505"] + assert get_group_by_labels(groups, {"job": "foreign"})["targets"] == [ + "foreign:9505" + ] def test_yaml_branch_matrix_moves_hosts_and_drops_emptied_groups(host): @@ -152,7 +161,9 @@ def test_yaml_branch_matrix_preserves_unlabeled_group_when_targets_remain(host): ] -def test_yaml_branch_matrix_creates_missing_file_groups_for_labeled_and_unlabeled_targets(host): +def test_yaml_branch_matrix_creates_missing_file_groups_for_labeled_and_unlabeled_targets( + host, +): assert read_yaml_file(host, "/opt/yaml_missing_labeled.yml") == [ {"labels": {"team": "infra"}, "targets": ["application4:9600"]} ] @@ -165,9 +176,9 @@ def test_yaml_branch_matrix_creates_missing_file_groups_for_labeled_and_unlabele def test_yaml_exporter_defaults_merge_labels_and_deduplicate(host): groups = read_yaml_file(host, "/opt/yaml_defaults.yml") - assert get_group_by_labels( - groups, {"job": "inherited", "environment": "staging"} - )["targets"] == ["application:9700"] + assert get_group_by_labels(groups, {"job": "inherited", "environment": "staging"})[ + "targets" + ] == ["application:9700"] assert get_group_by_labels(groups, {"job": "default"})["targets"] == [ "appended-default:9701" ] |