qontract-reconcile 0.10.1rc1202__py3-none-any.whl → 0.10.2.dev2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. qontract_reconcile-0.10.2.dev2.dist-info/METADATA +500 -0
  2. {qontract_reconcile-0.10.1rc1202.dist-info → qontract_reconcile-0.10.2.dev2.dist-info}/RECORD +12 -130
  3. {qontract_reconcile-0.10.1rc1202.dist-info → qontract_reconcile-0.10.2.dev2.dist-info}/WHEEL +1 -2
  4. {qontract_reconcile-0.10.1rc1202.dist-info → qontract_reconcile-0.10.2.dev2.dist-info}/entry_points.txt +1 -0
  5. reconcile/aws_account_manager/README.md +5 -0
  6. reconcile/change_owners/README.md +34 -0
  7. reconcile/glitchtip/README.md +150 -0
  8. reconcile/gql_definitions/introspection.json +51176 -0
  9. reconcile/run_integration.py +293 -0
  10. reconcile/utils/binary.py +2 -2
  11. reconcile/utils/mr/README.md +198 -0
  12. reconcile/utils/oc_map.py +2 -2
  13. tools/qontract_cli.py +0 -0
  14. qontract_reconcile-0.10.1rc1202.dist-info/METADATA +0 -64
  15. qontract_reconcile-0.10.1rc1202.dist-info/top_level.txt +0 -3
  16. reconcile/test/__init__.py +0 -0
  17. reconcile/test/conftest.py +0 -157
  18. reconcile/test/fixtures.py +0 -24
  19. reconcile/test/saas_auto_promotions_manager/__init__.py +0 -0
  20. reconcile/test/saas_auto_promotions_manager/conftest.py +0 -170
  21. reconcile/test/saas_auto_promotions_manager/merge_request_manager/__init__.py +0 -0
  22. reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/__init__.py +0 -0
  23. reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/conftest.py +0 -115
  24. reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/data_keys.py +0 -19
  25. reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/test_desired_state.py +0 -66
  26. reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/test_merge_request_manager.py +0 -86
  27. reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/test_mr_parser.py +0 -352
  28. reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/test_reconciler.py +0 -494
  29. reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/__init__.py +0 -0
  30. reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/conftest.py +0 -25
  31. reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_content_multiple_namespaces.py +0 -37
  32. reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_content_single_namespace.py +0 -81
  33. reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_content_single_target.py +0 -61
  34. reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_json_path_selector.py +0 -74
  35. reconcile/test/saas_auto_promotions_manager/test_integration_test.py +0 -52
  36. reconcile/test/saas_auto_promotions_manager/utils/__init__.py +0 -0
  37. reconcile/test/test_acs_notifiers.py +0 -393
  38. reconcile/test/test_acs_policies.py +0 -497
  39. reconcile/test/test_acs_rbac.py +0 -865
  40. reconcile/test/test_aggregated_list.py +0 -237
  41. reconcile/test/test_amtool.py +0 -37
  42. reconcile/test/test_aws_ami_cleanup.py +0 -230
  43. reconcile/test/test_aws_ami_share.py +0 -68
  44. reconcile/test/test_aws_cloudwatch_log_retention.py +0 -434
  45. reconcile/test/test_aws_iam_keys.py +0 -70
  46. reconcile/test/test_aws_iam_password_reset.py +0 -35
  47. reconcile/test/test_aws_support_cases_sos.py +0 -23
  48. reconcile/test/test_checkpoint.py +0 -178
  49. reconcile/test/test_cli.py +0 -41
  50. reconcile/test/test_closedbox_endpoint_monitoring.py +0 -207
  51. reconcile/test/test_dashdotdb_dora.py +0 -245
  52. reconcile/test/test_database_access_manager.py +0 -660
  53. reconcile/test/test_deadmanssnitch.py +0 -290
  54. reconcile/test/test_gabi_authorized_users.py +0 -72
  55. reconcile/test/test_gcr_mirror.py +0 -14
  56. reconcile/test/test_github_org.py +0 -156
  57. reconcile/test/test_github_repo_invites.py +0 -119
  58. reconcile/test/test_gitlab_housekeeping.py +0 -333
  59. reconcile/test/test_gitlab_labeler.py +0 -126
  60. reconcile/test/test_gitlab_members.py +0 -219
  61. reconcile/test/test_gitlab_permissions.py +0 -164
  62. reconcile/test/test_instrumented_wrappers.py +0 -18
  63. reconcile/test/test_integrations_manager.py +0 -1252
  64. reconcile/test/test_jenkins_worker_fleets.py +0 -57
  65. reconcile/test/test_jira_permissions_validator.py +0 -519
  66. reconcile/test/test_jump_host.py +0 -114
  67. reconcile/test/test_ldap_users.py +0 -125
  68. reconcile/test/test_make.py +0 -28
  69. reconcile/test/test_ocm_additional_routers.py +0 -133
  70. reconcile/test/test_ocm_clusters.py +0 -798
  71. reconcile/test/test_ocm_clusters_manifest_updates.py +0 -87
  72. reconcile/test/test_ocm_machine_pools.py +0 -1103
  73. reconcile/test/test_ocm_update_recommended_version.py +0 -145
  74. reconcile/test/test_ocm_upgrade_scheduler_org_updater.py +0 -125
  75. reconcile/test/test_openshift_base.py +0 -1269
  76. reconcile/test/test_openshift_cluster_bots.py +0 -240
  77. reconcile/test/test_openshift_namespace_labels.py +0 -344
  78. reconcile/test/test_openshift_namespaces.py +0 -256
  79. reconcile/test/test_openshift_resource.py +0 -443
  80. reconcile/test/test_openshift_resources_base.py +0 -478
  81. reconcile/test/test_openshift_saas_deploy.py +0 -188
  82. reconcile/test/test_openshift_saas_deploy_change_tester.py +0 -308
  83. reconcile/test/test_openshift_saas_deploy_trigger_cleaner.py +0 -65
  84. reconcile/test/test_openshift_serviceaccount_tokens.py +0 -282
  85. reconcile/test/test_openshift_tekton_resources.py +0 -265
  86. reconcile/test/test_openshift_upgrade_watcher.py +0 -223
  87. reconcile/test/test_prometheus_rules_tester.py +0 -151
  88. reconcile/test/test_quay_membership.py +0 -86
  89. reconcile/test/test_quay_mirror.py +0 -172
  90. reconcile/test/test_quay_mirror_org.py +0 -82
  91. reconcile/test/test_quay_repos.py +0 -59
  92. reconcile/test/test_queries.py +0 -53
  93. reconcile/test/test_repo_owners.py +0 -47
  94. reconcile/test/test_requests_sender.py +0 -139
  95. reconcile/test/test_saasherder.py +0 -1611
  96. reconcile/test/test_saasherder_allowed_secret_paths.py +0 -125
  97. reconcile/test/test_secret_reader.py +0 -153
  98. reconcile/test/test_slack_base.py +0 -183
  99. reconcile/test/test_slack_usergroups.py +0 -785
  100. reconcile/test/test_sql_query.py +0 -316
  101. reconcile/test/test_status_board.py +0 -258
  102. reconcile/test/test_terraform_aws_route53.py +0 -29
  103. reconcile/test/test_terraform_cloudflare_dns.py +0 -117
  104. reconcile/test/test_terraform_cloudflare_resources.py +0 -408
  105. reconcile/test/test_terraform_cloudflare_users.py +0 -747
  106. reconcile/test/test_terraform_repo.py +0 -440
  107. reconcile/test/test_terraform_resources.py +0 -519
  108. reconcile/test/test_terraform_tgw_attachments.py +0 -1295
  109. reconcile/test/test_terraform_users.py +0 -152
  110. reconcile/test/test_terraform_vpc_peerings.py +0 -576
  111. reconcile/test/test_terraform_vpc_peerings_build_desired_state.py +0 -1434
  112. reconcile/test/test_three_way_diff_strategy.py +0 -131
  113. reconcile/test/test_utils_jinja2.py +0 -130
  114. reconcile/test/test_vault_replication.py +0 -534
  115. reconcile/test/test_vault_utils.py +0 -47
  116. reconcile/test/test_version_bump.py +0 -18
  117. reconcile/test/test_vpc_peerings_validator.py +0 -194
  118. reconcile/test/test_wrong_region.py +0 -78
  119. release/__init__.py +0 -0
  120. release/test_version.py +0 -50
  121. release/version.py +0 -104
  122. tools/cli_commands/test/__init__.py +0 -0
  123. tools/cli_commands/test/conftest.py +0 -332
  124. tools/cli_commands/test/test_aws_cost_report.py +0 -258
  125. tools/cli_commands/test/test_cost_management_api.py +0 -326
  126. tools/cli_commands/test/test_gpg_encrypt.py +0 -235
  127. tools/cli_commands/test/test_openshift_cost_optimization_report.py +0 -255
  128. tools/cli_commands/test/test_openshift_cost_report.py +0 -295
  129. tools/cli_commands/test/test_util.py +0 -70
  130. tools/test/__init__.py +0 -0
  131. tools/test/conftest.py +0 -77
  132. tools/test/test_app_interface_metrics_exporter.py +0 -48
  133. tools/test/test_erv2.py +0 -80
  134. tools/test/test_get_container_images.py +0 -230
  135. tools/test/test_qontract_cli.py +0 -197
  136. tools/test/test_saas_promotion_state.py +0 -187
  137. tools/test/test_sd_app_sre_alert_report.py +0 -74
  138. tools/test/test_sre_checkpoints.py +0 -79
@@ -1,131 +0,0 @@
1
- import pytest
2
-
3
- from reconcile.utils.openshift_resource import OpenshiftResource as OR
4
- from reconcile.utils.three_way_diff_strategy import (
5
- is_cpu_mutation,
6
- three_way_diff_using_hash,
7
- )
8
-
9
- from .fixtures import Fixtures
10
-
11
- fxt = Fixtures("openshift_resource")
12
-
13
-
14
- @pytest.fixture
15
- def deployment():
16
- resource = fxt.get_anymarkup("deployment.yml")
17
- yield resource
18
-
19
-
20
- def test_3wpd_change_current_not_in_desired_should_not_apply(deployment):
21
- d_item = OR(deployment, "", "")
22
- c_item = d_item.annotate(canonicalize=False)
23
-
24
- c_item.body["spec"]["manual_added_attr"] = 5
25
- assert three_way_diff_using_hash(c_item, d_item) is True
26
-
27
-
28
- def test_3wpd_equal_objects_should_not_apply(deployment):
29
- d_item = OR(deployment, "", "")
30
-
31
- # sha256 Hash is calculated over the DESIRED object
32
- c_item = d_item.annotate(canonicalize=False)
33
- assert three_way_diff_using_hash(c_item, d_item) is True
34
-
35
-
36
- def test_3wpd_change_desired_should_apply(deployment):
37
- d_item = OR(deployment, "", "")
38
- c_item = d_item.annotate(canonicalize=False)
39
-
40
- del d_item.body["metadata"]["annotations"]
41
- assert three_way_diff_using_hash(c_item, d_item) is False
42
-
43
-
44
- # Changes in current objects over attributes defined in desired
45
- def test_3wpd_change_current_should_apply(deployment):
46
- d_item = OR(deployment, "", "")
47
- c_item = d_item.annotate(canonicalize=False)
48
-
49
- c_item.body["spec"]["replicas"] = 5
50
- assert three_way_diff_using_hash(c_item, d_item) is False
51
-
52
-
53
- def test_is_a_cpu_mutation(deployment):
54
- patch = {
55
- "op": "replace",
56
- "path": "/spec/template/spec/containers/0/resources/requests/cpu",
57
- "value": "2000m",
58
- }
59
- deployment["spec"]["template"]["spec"]["containers"][0]["resources"]["requests"][
60
- "cpu"
61
- ] = "2"
62
- current = OR(deployment, "", "")
63
- desired = OR(deployment, "", "") # Not used to check cpu mutation
64
- assert is_cpu_mutation(current, desired, patch) is True
65
-
66
-
67
- def test_is_not_a_cpu_mutation(deployment):
68
- patch = {
69
- "op": "replace",
70
- "path": "/spec/template/spec/containers/0/resources/requests/cpu",
71
- "value": "20m",
72
- }
73
- deployment["spec"]["template"]["spec"]["containers"][0]["resources"]["requests"][
74
- "cpu"
75
- ] = "2"
76
- current = OR(deployment, "", "")
77
- desired = OR(deployment, "", "") # Not used to check cpu mutation
78
- assert is_cpu_mutation(current, desired, patch) is False
79
-
80
-
81
- def test_3wpd_change_valid_mutation_not_apply(deployment):
82
- d_item = OR(deployment, "", "")
83
- d_item.body["spec"]["template"]["spec"]["containers"][0]["resources"]["requests"][
84
- "cpu"
85
- ] = "1000m"
86
-
87
- c_item = d_item.annotate(canonicalize=False)
88
- c_item.body["spec"]["template"]["spec"]["containers"][0]["resources"]["requests"][
89
- "cpu"
90
- ] = "1"
91
-
92
- assert three_way_diff_using_hash(c_item, d_item) is True
93
-
94
-
95
- def test_3wpd_change_empty_env_value_should_not_apply(deployment):
96
- d_item = OR(deployment, "", "")
97
- d_item.body["spec"]["template"]["spec"]["containers"][0]["env"] = [
98
- {
99
- "name": "test_env",
100
- "value": "",
101
- }
102
- ]
103
-
104
- c_item = d_item.annotate(canonicalize=False)
105
- c_item.body["spec"]["template"]["spec"]["containers"][0]["env"] = [
106
- {
107
- "name": "test_env",
108
- }
109
- ]
110
-
111
- assert three_way_diff_using_hash(c_item, d_item) is True
112
-
113
-
114
- def test_3wpd_diff_detects_missing_annotation(deployment):
115
- d_item = OR(deployment, "", "")
116
- d_item.body["metadata"]["annotations"]["new-annotation"] = "test-value"
117
- c_item = d_item.annotate(canonicalize=False)
118
-
119
- del c_item.body["metadata"]["annotations"]["new-annotation"]
120
-
121
- assert three_way_diff_using_hash(c_item, d_item) is False
122
-
123
-
124
- def test_3wpd_diff_detects_switch_integration(deployment):
125
- d_item = OR(deployment, "same-integration", "")
126
- deployment["metadata"]["annotations"]["qontract.integration"] = (
127
- "different-integration"
128
- )
129
- c_item = OR(deployment, "same-integration", "").annotate(canonicalize=False)
130
-
131
- assert three_way_diff_using_hash(c_item, d_item) is False
@@ -1,130 +0,0 @@
1
- import pytest
2
- from jsonpath_ng.exceptions import JsonPathParserError
3
-
4
- from reconcile.utils.jinja2.filters import (
5
- extract_jsonpath,
6
- hash_list,
7
- json_pointers,
8
- matches_jsonpath,
9
- str_format,
10
- )
11
-
12
-
13
- def test_hash_list_empty() -> None:
14
- assert hash_list([])[:6] == "ca9781"
15
-
16
-
17
- def test_hash_list_string() -> None:
18
- assert hash_list(["a", "b"])[:6] == "38760e"
19
- assert hash_list(["b", "a"])[:6] == "38760e"
20
-
21
-
22
- def test_hash_list_int() -> None:
23
- assert hash_list([1, 2])[:6] == "f37508"
24
- assert hash_list([2, 1])[:6] == "f37508"
25
-
26
-
27
- def test_hash_list_bool() -> None:
28
- assert hash_list([True, False])[:6] == "e0ca28"
29
- assert hash_list([False, True])[:6] == "e0ca28"
30
-
31
-
32
- def test_hash_list_error() -> None:
33
- with pytest.raises(RuntimeError):
34
- hash_list([{}])
35
-
36
- with pytest.raises(RuntimeError):
37
- hash_list([[]])
38
-
39
- with pytest.raises(RuntimeError):
40
- hash_list(["a", {}])
41
-
42
-
43
- def test_extract_jsonpath_dict_basic() -> None:
44
- input = {"a": "A", "b": {"b1": "B1", "b2": ["B", 2]}}
45
- assert extract_jsonpath(input, "a") == ["A"]
46
- assert extract_jsonpath(input, "b.b1") == ["B1"]
47
- assert extract_jsonpath(input, "b.b2") == [["B", 2]]
48
- assert extract_jsonpath(input, "b.b2[0]") == ["B"]
49
- assert extract_jsonpath(input, "c") == []
50
-
51
-
52
- def test_extract_jsonpath_dict_multiple() -> None:
53
- input = {
54
- "items": [
55
- {"name": "a", "value": "A"},
56
- {"name": "b", "value": "B1"},
57
- {"name": "b", "value": "B2"},
58
- ]
59
- }
60
- assert extract_jsonpath(input, "items[0]") == [{"name": "a", "value": "A"}]
61
- assert extract_jsonpath(input, "items[?(@.name=='a')]") == [
62
- {"name": "a", "value": "A"}
63
- ]
64
- assert extract_jsonpath(input, "items[?(@.name=='a')].value") == ["A"]
65
- assert extract_jsonpath(input, "items[?(@.name=='b')]") == [
66
- {"name": "b", "value": "B1"},
67
- {"name": "b", "value": "B2"},
68
- ]
69
- assert extract_jsonpath(input, "items[?(@.name=='b')].value") == ["B1", "B2"]
70
- assert extract_jsonpath(input, "items[?(@.name=='c')].value") == []
71
-
72
-
73
- def test_extract_jsonpath_list() -> None:
74
- input = ["a", "b"]
75
- assert extract_jsonpath(input, "[0]") == ["a"]
76
-
77
-
78
- def test_extract_jsonpath_str() -> None:
79
- assert extract_jsonpath("a", "[0]") == ["a"]
80
- assert extract_jsonpath("a", "something") == []
81
-
82
-
83
- def test_extract_jsonpath_none() -> None:
84
- assert extract_jsonpath(None, "a") == []
85
-
86
-
87
- def test_extract_jsonpath_errors() -> None:
88
- input = {"a": "A", "b": "B"}
89
- with pytest.raises(JsonPathParserError):
90
- extract_jsonpath(input, "THIS IS AN INVALID JSONPATH]")
91
- with pytest.raises(AssertionError):
92
- extract_jsonpath("a", "")
93
-
94
-
95
- def test_matches_jsonpath() -> None:
96
- input = {"a": "A", "b": "B"}
97
- assert matches_jsonpath(input, "a")
98
- assert not matches_jsonpath(input, "c")
99
- with pytest.raises(JsonPathParserError):
100
- matches_jsonpath(input, "THIS IS AN INVALID JSONPATH]")
101
- with pytest.raises(AssertionError):
102
- matches_jsonpath("a", "")
103
- with pytest.raises(AssertionError):
104
- matches_jsonpath("a", None)
105
-
106
-
107
- def test_json_pointers() -> None:
108
- input = {
109
- "items": [
110
- {"name": "a", "value": "A"},
111
- {"name": "b", "value": "B1"},
112
- {"name": "b", "value": "B2"},
113
- ]
114
- }
115
- assert json_pointers(input, "items") == ["/items"]
116
- assert json_pointers(input, "items[*]") == ["/items/0", "/items/1", "/items/2"]
117
- assert json_pointers(input, "items[0]") == ["/items/0"]
118
- assert json_pointers(input, "items[0].name") == ["/items/0/name"]
119
- assert json_pointers(input, "items[4]") == []
120
- assert json_pointers(input, "items[4].name") == []
121
-
122
- assert json_pointers(input, "items[?@.name=='a']") == ["/items/0"]
123
- assert json_pointers(input, "items[?@.name=='b']") == ["/items/1", "/items/2"]
124
- assert json_pointers(input, "items[?@.name=='c']") == []
125
-
126
-
127
- def test_str_format() -> None:
128
- value = "path/to/object"
129
- format = "s3://%s"
130
- assert str_format(value, format) == "s3://path/to/object"