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.
Files changed (138) hide show
  1. qontract_reconcile-0.10.2.dev1.dist-info/METADATA +500 -0
  2. {qontract_reconcile-0.10.1rc1202.dist-info → qontract_reconcile-0.10.2.dev1.dist-info}/RECORD +12 -130
  3. {qontract_reconcile-0.10.1rc1202.dist-info → qontract_reconcile-0.10.2.dev1.dist-info}/WHEEL +1 -2
  4. {qontract_reconcile-0.10.1rc1202.dist-info → qontract_reconcile-0.10.2.dev1.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,440 +0,0 @@
1
- from datetime import datetime
2
- from unittest.mock import MagicMock
3
-
4
- import pytest
5
-
6
- from reconcile.gql_definitions.fragments.terraform_state import (
7
- AWSTerraformStateIntegrationsV1,
8
- )
9
- from reconcile.gql_definitions.fragments.vault_secret import VaultSecret
10
- from reconcile.gql_definitions.terraform_repo.terraform_repo import (
11
- AWSAccountV1,
12
- TerraformRepoV1,
13
- TerraformRepoVariablesV1,
14
- TerraformStateAWSV1,
15
- )
16
- from reconcile.terraform_repo import (
17
- OutputFile,
18
- RepoOutput,
19
- TerraformRepoIntegration,
20
- TerraformRepoIntegrationParams,
21
- )
22
- from reconcile.utils.exceptions import ParameterError
23
- from reconcile.utils.state import State
24
-
25
- A_REPO = "https://git-example/tf-repo-example"
26
- A_REPO_SHA = "a390f5cb20322c90861d6d80e9b70c6a579be1d0"
27
- A_REPO_VERSION = "1.4.5"
28
- B_REPO = "https://git-example/tf-repo-example2"
29
- B_REPO_SHA = "94edb90815e502b387c25358f5ec602e52d0bfbb"
30
- B_REPO_VERSION = "1.6.6"
31
- AWS_UID = "000000000000"
32
- AUTOMATION_TOKEN_PATH = "aws-secrets/terraform/foo"
33
- STATE_REGION = "us-east-1"
34
- STATE_BUCKET = "app-sre"
35
- STATE_PROVIDER = "s3"
36
-
37
-
38
- @pytest.fixture
39
- def existing_repo(aws_account, tf_variables) -> TerraformRepoV1:
40
- return TerraformRepoV1(
41
- name="a_repo",
42
- repository=A_REPO,
43
- ref=A_REPO_SHA,
44
- account=aws_account,
45
- app=None,
46
- projectPath="tf",
47
- delete=False,
48
- requireFips=True,
49
- tfVersion=A_REPO_VERSION,
50
- variables=tf_variables,
51
- forceRerunTimestamp=None,
52
- )
53
-
54
-
55
- @pytest.fixture
56
- def existing_repo_output(tf_variables) -> OutputFile:
57
- return OutputFile(
58
- dry_run=True,
59
- repos=[
60
- RepoOutput(
61
- repository=A_REPO,
62
- name="a_repo",
63
- ref=A_REPO_SHA,
64
- project_path="tf",
65
- delete=False,
66
- aws_creds=VaultSecret(
67
- path=AUTOMATION_TOKEN_PATH, version=1, field="all", format=None
68
- ),
69
- bucket=STATE_BUCKET,
70
- region=STATE_REGION,
71
- bucket_path="tf-repo",
72
- require_fips=True,
73
- tf_version=A_REPO_VERSION,
74
- variables=tf_variables,
75
- )
76
- ],
77
- )
78
-
79
-
80
- @pytest.fixture
81
- def new_repo(aws_account_no_state) -> TerraformRepoV1:
82
- return TerraformRepoV1(
83
- name="b_repo",
84
- repository=B_REPO,
85
- ref=B_REPO_SHA,
86
- account=aws_account_no_state,
87
- app=None,
88
- projectPath="tf",
89
- delete=False,
90
- requireFips=False,
91
- tfVersion=B_REPO_VERSION,
92
- variables=None,
93
- forceRerunTimestamp=None,
94
- )
95
-
96
-
97
- @pytest.fixture
98
- def new_repo_output() -> OutputFile:
99
- return OutputFile(
100
- dry_run=True,
101
- repos=[
102
- RepoOutput(
103
- repository=B_REPO,
104
- name="b_repo",
105
- ref=B_REPO_SHA,
106
- project_path="tf",
107
- delete=False,
108
- aws_creds=VaultSecret(
109
- path=AUTOMATION_TOKEN_PATH, version=1, field="all", format=None
110
- ),
111
- bucket=None,
112
- region=None,
113
- bucket_path=None,
114
- require_fips=False,
115
- tf_version=B_REPO_VERSION,
116
- variables=None,
117
- )
118
- ],
119
- )
120
-
121
-
122
- @pytest.fixture()
123
- def automation_token() -> VaultSecret:
124
- return VaultSecret(path=AUTOMATION_TOKEN_PATH, version=1, field="all", format=None)
125
-
126
-
127
- @pytest.fixture()
128
- def tf_variables() -> TerraformRepoVariablesV1:
129
- return TerraformRepoVariablesV1(
130
- inputs=VaultSecret(
131
- path="terraform-repo/inputs/abc", field="all", version=2, format=None
132
- ),
133
- outputs=VaultSecret(
134
- path="terraform-repo/outputs/abc", field="all", version=2, format=None
135
- ),
136
- )
137
-
138
-
139
- @pytest.fixture()
140
- def terraform_state(terraform_state_integrations) -> TerraformStateAWSV1:
141
- return TerraformStateAWSV1(
142
- provider=STATE_PROVIDER,
143
- region=STATE_REGION,
144
- bucket=STATE_BUCKET,
145
- integrations=terraform_state_integrations,
146
- )
147
-
148
-
149
- @pytest.fixture()
150
- def terraform_state_integrations() -> list[AWSTerraformStateIntegrationsV1]:
151
- return [
152
- AWSTerraformStateIntegrationsV1(integration="terraform-repo", key="tf-repo")
153
- ]
154
-
155
-
156
- @pytest.fixture
157
- def aws_account(automation_token, terraform_state) -> AWSAccountV1:
158
- return AWSAccountV1(
159
- name="foo",
160
- uid="000000000000",
161
- automationToken=automation_token,
162
- terraformState=terraform_state,
163
- )
164
-
165
-
166
- @pytest.fixture
167
- def aws_account_no_state(automation_token) -> AWSAccountV1:
168
- return AWSAccountV1(
169
- name="foo",
170
- uid="000000000000",
171
- automationToken=automation_token,
172
- terraformState=None,
173
- )
174
-
175
-
176
- @pytest.fixture
177
- def int_params() -> TerraformRepoIntegrationParams:
178
- return TerraformRepoIntegrationParams(output_file=None, validate_git=False)
179
-
180
-
181
- @pytest.fixture()
182
- def state_mock() -> MagicMock:
183
- return MagicMock(spec=State)
184
-
185
-
186
- def test_addition_to_existing_repo(existing_repo, new_repo, int_params, state_mock):
187
- existing = [existing_repo]
188
- desired = [existing_repo, new_repo]
189
-
190
- integration = TerraformRepoIntegration(params=int_params)
191
- diff = integration.calculate_diff(
192
- existing_state=existing,
193
- desired_state=desired,
194
- dry_run=False,
195
- state=state_mock,
196
- )
197
-
198
- assert diff == [new_repo]
199
-
200
- # ensure that the state is saved for the new repo
201
- state_mock.add.assert_called_once_with(
202
- new_repo.name, new_repo.dict(by_alias=True), force=True
203
- )
204
-
205
-
206
- def test_updating_repo_ref(existing_repo, int_params, state_mock):
207
- existing = [existing_repo]
208
- updated_repo = TerraformRepoV1.copy(existing_repo)
209
- updated_repo.ref = B_REPO_SHA
210
-
211
- integration = TerraformRepoIntegration(params=int_params)
212
- diff = integration.calculate_diff(
213
- existing_state=existing,
214
- desired_state=[updated_repo],
215
- dry_run=False,
216
- state=state_mock,
217
- )
218
-
219
- assert diff == [updated_repo]
220
-
221
- state_mock.add.assert_called_once_with(
222
- updated_repo.name, updated_repo.dict(by_alias=True), force=True
223
- )
224
-
225
-
226
- def test_force_rerun(existing_repo, int_params, state_mock):
227
- existing = [existing_repo]
228
- updated_repo = TerraformRepoV1.copy(existing_repo)
229
- updated_repo.force_rerun_timestamp = datetime.now().isoformat()
230
-
231
- integration = TerraformRepoIntegration(params=int_params)
232
- diff = integration.calculate_diff(
233
- existing_state=existing,
234
- desired_state=[updated_repo],
235
- dry_run=False,
236
- state=state_mock,
237
- )
238
-
239
- assert diff == [updated_repo]
240
-
241
- state_mock.add.assert_called_once_with(
242
- updated_repo.name, updated_repo.dict(by_alias=True), force=True
243
- )
244
-
245
-
246
- def test_fail_on_update_invalid_repo_params(existing_repo, int_params):
247
- existing = [existing_repo]
248
- updated_repo = TerraformRepoV1.copy(existing_repo)
249
- updated_repo.name = "c_repo"
250
- updated_repo.project_path = "c_repo"
251
- updated_repo.repository = B_REPO
252
- updated_repo.ref = B_REPO_SHA
253
- updated_repo.delete = True
254
-
255
- integration = TerraformRepoIntegration(params=int_params)
256
-
257
- with pytest.raises(ParameterError):
258
- integration.calculate_diff(
259
- existing_state=existing,
260
- desired_state=[updated_repo],
261
- dry_run=True,
262
- state=None,
263
- )
264
-
265
-
266
- def test_delete_repo(existing_repo, int_params, state_mock):
267
- existing = [existing_repo]
268
- updated_repo = TerraformRepoV1.copy(existing_repo)
269
- updated_repo.delete = True
270
-
271
- integration = TerraformRepoIntegration(params=int_params)
272
-
273
- diff = integration.calculate_diff(
274
- existing_state=existing,
275
- desired_state=[updated_repo],
276
- dry_run=False,
277
- state=state_mock,
278
- )
279
-
280
- assert diff == [updated_repo]
281
-
282
- state_mock.rm.assert_called_once_with(updated_repo.name)
283
-
284
-
285
- def test_delete_repo_without_flag(existing_repo, int_params):
286
- existing = [existing_repo]
287
-
288
- integration = TerraformRepoIntegration(params=int_params)
289
-
290
- with pytest.raises(ParameterError):
291
- integration.calculate_diff(
292
- existing_state=existing,
293
- desired_state=[],
294
- dry_run=True,
295
- state=None,
296
- )
297
-
298
-
299
- def test_get_repo_state(s3_state_builder, int_params, existing_repo, tf_variables):
300
- state = s3_state_builder({
301
- "ls": [
302
- "/a_repo",
303
- ],
304
- "get": {
305
- "a_repo": {
306
- "name": "a_repo",
307
- "repository": A_REPO,
308
- "ref": A_REPO_SHA,
309
- "projectPath": "tf",
310
- "delete": False,
311
- "requireFips": True,
312
- "tfVersion": A_REPO_VERSION,
313
- "variables": tf_variables,
314
- "forceRerunTimestamp": None,
315
- "app": None,
316
- "account": {
317
- "name": "foo",
318
- "uid": AWS_UID,
319
- "automationToken": {
320
- "path": AUTOMATION_TOKEN_PATH,
321
- "field": "all",
322
- "version": 1,
323
- "format": None,
324
- },
325
- "terraformState": {
326
- "provider": "s3",
327
- "region": "us-east-1",
328
- "bucket": "app-sre",
329
- "integrations": [
330
- {
331
- "integration": "terraform-repo",
332
- "key": "tf-repo",
333
- }
334
- ],
335
- },
336
- },
337
- }
338
- },
339
- })
340
-
341
- integration = TerraformRepoIntegration(params=int_params)
342
-
343
- existing_state = integration.get_existing_state(state=state)
344
- assert existing_state == [existing_repo]
345
-
346
-
347
- def test_update_repo_state(int_params, existing_repo, state_mock):
348
- integration = TerraformRepoIntegration(params=int_params)
349
-
350
- existing_state: list = []
351
- desired_state = [existing_repo]
352
-
353
- integration.calculate_diff(
354
- existing_state=existing_state,
355
- desired_state=desired_state,
356
- dry_run=False,
357
- state=state_mock,
358
- )
359
-
360
- state_mock.add.assert_called_once_with(
361
- existing_repo.name, existing_repo.dict(by_alias=True), force=True
362
- )
363
-
364
-
365
- # these two output tests are to ensure that there isn't a sudden change to outputs that throws
366
- # off tf-executor
367
- def test_output_correct_statefile(
368
- int_params, existing_repo, existing_repo_output, state_mock
369
- ):
370
- integration = TerraformRepoIntegration(params=int_params)
371
-
372
- existing_state: list = []
373
- desired_state = [existing_repo]
374
-
375
- diff = integration.calculate_diff(
376
- existing_state=existing_state,
377
- desired_state=desired_state,
378
- dry_run=True,
379
- state=state_mock,
380
- )
381
-
382
- assert diff
383
- current_output = integration.print_output(diff, True)
384
-
385
- assert existing_repo_output == current_output
386
-
387
-
388
- def test_output_correct_no_statefile(
389
- int_params, new_repo, new_repo_output, tmp_path, state_mock
390
- ):
391
- integration = TerraformRepoIntegration(params=int_params)
392
-
393
- existing_state: list = []
394
- desired_state = [new_repo]
395
-
396
- diff = integration.calculate_diff(
397
- existing_state=existing_state,
398
- desired_state=desired_state,
399
- dry_run=True,
400
- state=state_mock,
401
- )
402
-
403
- assert diff
404
- current_output = integration.print_output(diff, True)
405
-
406
- assert new_repo_output == current_output
407
-
408
-
409
- def test_succeed_on_multiple_repos_non_dry_run(int_params, existing_repo, new_repo):
410
- integration = TerraformRepoIntegration(params=int_params)
411
-
412
- desired_state = [existing_repo, new_repo]
413
-
414
- diff = integration.calculate_diff(
415
- existing_state=[],
416
- desired_state=desired_state,
417
- dry_run=False,
418
- state=None,
419
- )
420
-
421
- assert diff
422
- if diff:
423
- assert diff.sort(key=lambda r: r.name) == desired_state.sort(
424
- key=lambda r: r.name
425
- )
426
-
427
-
428
- def test_no_op_succeeds(int_params, existing_repo):
429
- integration = TerraformRepoIntegration(params=int_params)
430
-
431
- state = [existing_repo]
432
-
433
- diff = integration.calculate_diff(
434
- existing_state=state,
435
- desired_state=state,
436
- dry_run=True,
437
- state=None,
438
- )
439
-
440
- assert diff is None