qontract-reconcile 0.10.1rc1202__py3-none-any.whl → 0.10.2.dev1__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.
- qontract_reconcile-0.10.2.dev1.dist-info/METADATA +500 -0
- {qontract_reconcile-0.10.1rc1202.dist-info → qontract_reconcile-0.10.2.dev1.dist-info}/RECORD +12 -130
- {qontract_reconcile-0.10.1rc1202.dist-info → qontract_reconcile-0.10.2.dev1.dist-info}/WHEEL +1 -2
- {qontract_reconcile-0.10.1rc1202.dist-info → qontract_reconcile-0.10.2.dev1.dist-info}/entry_points.txt +1 -0
- reconcile/aws_account_manager/README.md +5 -0
- reconcile/change_owners/README.md +34 -0
- reconcile/glitchtip/README.md +150 -0
- reconcile/gql_definitions/introspection.json +51176 -0
- reconcile/run_integration.py +293 -0
- reconcile/utils/binary.py +2 -2
- reconcile/utils/mr/README.md +198 -0
- reconcile/utils/oc_map.py +2 -2
- tools/qontract_cli.py +0 -0
- qontract_reconcile-0.10.1rc1202.dist-info/METADATA +0 -64
- qontract_reconcile-0.10.1rc1202.dist-info/top_level.txt +0 -3
- reconcile/test/__init__.py +0 -0
- reconcile/test/conftest.py +0 -157
- reconcile/test/fixtures.py +0 -24
- reconcile/test/saas_auto_promotions_manager/__init__.py +0 -0
- reconcile/test/saas_auto_promotions_manager/conftest.py +0 -170
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/__init__.py +0 -0
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/__init__.py +0 -0
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/conftest.py +0 -115
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/data_keys.py +0 -19
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/test_desired_state.py +0 -66
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/test_merge_request_manager.py +0 -86
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/test_mr_parser.py +0 -352
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/merge_request_manager/test_reconciler.py +0 -494
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/__init__.py +0 -0
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/conftest.py +0 -25
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_content_multiple_namespaces.py +0 -37
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_content_single_namespace.py +0 -81
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_content_single_target.py +0 -61
- reconcile/test/saas_auto_promotions_manager/merge_request_manager/renderer/test_json_path_selector.py +0 -74
- reconcile/test/saas_auto_promotions_manager/test_integration_test.py +0 -52
- reconcile/test/saas_auto_promotions_manager/utils/__init__.py +0 -0
- reconcile/test/test_acs_notifiers.py +0 -393
- reconcile/test/test_acs_policies.py +0 -497
- reconcile/test/test_acs_rbac.py +0 -865
- reconcile/test/test_aggregated_list.py +0 -237
- reconcile/test/test_amtool.py +0 -37
- reconcile/test/test_aws_ami_cleanup.py +0 -230
- reconcile/test/test_aws_ami_share.py +0 -68
- reconcile/test/test_aws_cloudwatch_log_retention.py +0 -434
- reconcile/test/test_aws_iam_keys.py +0 -70
- reconcile/test/test_aws_iam_password_reset.py +0 -35
- reconcile/test/test_aws_support_cases_sos.py +0 -23
- reconcile/test/test_checkpoint.py +0 -178
- reconcile/test/test_cli.py +0 -41
- reconcile/test/test_closedbox_endpoint_monitoring.py +0 -207
- reconcile/test/test_dashdotdb_dora.py +0 -245
- reconcile/test/test_database_access_manager.py +0 -660
- reconcile/test/test_deadmanssnitch.py +0 -290
- reconcile/test/test_gabi_authorized_users.py +0 -72
- reconcile/test/test_gcr_mirror.py +0 -14
- reconcile/test/test_github_org.py +0 -156
- reconcile/test/test_github_repo_invites.py +0 -119
- reconcile/test/test_gitlab_housekeeping.py +0 -333
- reconcile/test/test_gitlab_labeler.py +0 -126
- reconcile/test/test_gitlab_members.py +0 -219
- reconcile/test/test_gitlab_permissions.py +0 -164
- reconcile/test/test_instrumented_wrappers.py +0 -18
- reconcile/test/test_integrations_manager.py +0 -1252
- reconcile/test/test_jenkins_worker_fleets.py +0 -57
- reconcile/test/test_jira_permissions_validator.py +0 -519
- reconcile/test/test_jump_host.py +0 -114
- reconcile/test/test_ldap_users.py +0 -125
- reconcile/test/test_make.py +0 -28
- reconcile/test/test_ocm_additional_routers.py +0 -133
- reconcile/test/test_ocm_clusters.py +0 -798
- reconcile/test/test_ocm_clusters_manifest_updates.py +0 -87
- reconcile/test/test_ocm_machine_pools.py +0 -1103
- reconcile/test/test_ocm_update_recommended_version.py +0 -145
- reconcile/test/test_ocm_upgrade_scheduler_org_updater.py +0 -125
- reconcile/test/test_openshift_base.py +0 -1269
- reconcile/test/test_openshift_cluster_bots.py +0 -240
- reconcile/test/test_openshift_namespace_labels.py +0 -344
- reconcile/test/test_openshift_namespaces.py +0 -256
- reconcile/test/test_openshift_resource.py +0 -443
- reconcile/test/test_openshift_resources_base.py +0 -478
- reconcile/test/test_openshift_saas_deploy.py +0 -188
- reconcile/test/test_openshift_saas_deploy_change_tester.py +0 -308
- reconcile/test/test_openshift_saas_deploy_trigger_cleaner.py +0 -65
- reconcile/test/test_openshift_serviceaccount_tokens.py +0 -282
- reconcile/test/test_openshift_tekton_resources.py +0 -265
- reconcile/test/test_openshift_upgrade_watcher.py +0 -223
- reconcile/test/test_prometheus_rules_tester.py +0 -151
- reconcile/test/test_quay_membership.py +0 -86
- reconcile/test/test_quay_mirror.py +0 -172
- reconcile/test/test_quay_mirror_org.py +0 -82
- reconcile/test/test_quay_repos.py +0 -59
- reconcile/test/test_queries.py +0 -53
- reconcile/test/test_repo_owners.py +0 -47
- reconcile/test/test_requests_sender.py +0 -139
- reconcile/test/test_saasherder.py +0 -1611
- reconcile/test/test_saasherder_allowed_secret_paths.py +0 -125
- reconcile/test/test_secret_reader.py +0 -153
- reconcile/test/test_slack_base.py +0 -183
- reconcile/test/test_slack_usergroups.py +0 -785
- reconcile/test/test_sql_query.py +0 -316
- reconcile/test/test_status_board.py +0 -258
- reconcile/test/test_terraform_aws_route53.py +0 -29
- reconcile/test/test_terraform_cloudflare_dns.py +0 -117
- reconcile/test/test_terraform_cloudflare_resources.py +0 -408
- reconcile/test/test_terraform_cloudflare_users.py +0 -747
- reconcile/test/test_terraform_repo.py +0 -440
- reconcile/test/test_terraform_resources.py +0 -519
- reconcile/test/test_terraform_tgw_attachments.py +0 -1295
- reconcile/test/test_terraform_users.py +0 -152
- reconcile/test/test_terraform_vpc_peerings.py +0 -576
- reconcile/test/test_terraform_vpc_peerings_build_desired_state.py +0 -1434
- reconcile/test/test_three_way_diff_strategy.py +0 -131
- reconcile/test/test_utils_jinja2.py +0 -130
- reconcile/test/test_vault_replication.py +0 -534
- reconcile/test/test_vault_utils.py +0 -47
- reconcile/test/test_version_bump.py +0 -18
- reconcile/test/test_vpc_peerings_validator.py +0 -194
- reconcile/test/test_wrong_region.py +0 -78
- release/__init__.py +0 -0
- release/test_version.py +0 -50
- release/version.py +0 -104
- tools/cli_commands/test/__init__.py +0 -0
- tools/cli_commands/test/conftest.py +0 -332
- tools/cli_commands/test/test_aws_cost_report.py +0 -258
- tools/cli_commands/test/test_cost_management_api.py +0 -326
- tools/cli_commands/test/test_gpg_encrypt.py +0 -235
- tools/cli_commands/test/test_openshift_cost_optimization_report.py +0 -255
- tools/cli_commands/test/test_openshift_cost_report.py +0 -295
- tools/cli_commands/test/test_util.py +0 -70
- tools/test/__init__.py +0 -0
- tools/test/conftest.py +0 -77
- tools/test/test_app_interface_metrics_exporter.py +0 -48
- tools/test/test_erv2.py +0 -80
- tools/test/test_get_container_images.py +0 -230
- tools/test/test_qontract_cli.py +0 -197
- tools/test/test_saas_promotion_state.py +0 -187
- tools/test/test_sd_app_sre_alert_report.py +0 -74
- 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"
|