foreman_rh_cloud 12.2.13 → 13.0.0

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 (73) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_rh_cloud/locale/fr/foreman_rh_cloud.js +24 -78
  3. data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +24 -78
  4. data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +23 -77
  5. data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +23 -77
  6. data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +23 -77
  7. data/app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb +3 -2
  8. data/app/models/insights_hit.rb +1 -1
  9. data/app/services/foreman_rh_cloud/cert_auth.rb +3 -13
  10. data/app/services/foreman_rh_cloud/gateway_request.rb +26 -0
  11. data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +1 -3
  12. data/app/services/foreman_rh_cloud/tags_auth.rb +1 -2
  13. data/lib/foreman_inventory_upload/async/generate_report_job.rb +8 -13
  14. data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +4 -4
  15. data/lib/foreman_inventory_upload/async/upload_report_job.rb +5 -6
  16. data/lib/foreman_inventory_upload/generators/fact_helpers.rb +2 -2
  17. data/lib/foreman_inventory_upload/generators/slice.rb +3 -3
  18. data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +1 -7
  19. data/lib/foreman_inventory_upload.rb +2 -6
  20. data/lib/foreman_rh_cloud/engine.rb +15 -34
  21. data/lib/foreman_rh_cloud/plugin.rb +9 -9
  22. data/lib/foreman_rh_cloud/version.rb +1 -1
  23. data/lib/tasks/rh_cloud_inventory.rake +31 -14
  24. data/locale/foreman_rh_cloud.pot +157 -261
  25. data/locale/fr/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  26. data/locale/fr/foreman_rh_cloud.po +26 -79
  27. data/locale/ja/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  28. data/locale/ja/foreman_rh_cloud.po +26 -79
  29. data/locale/ka/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  30. data/locale/ka/foreman_rh_cloud.po +24 -77
  31. data/locale/ko/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  32. data/locale/ko/foreman_rh_cloud.po +25 -78
  33. data/locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  34. data/locale/zh_CN/foreman_rh_cloud.po +25 -78
  35. data/package.json +1 -1
  36. data/test/jobs/cloud_connector_announce_task_test.rb +2 -3
  37. data/test/jobs/connector_playbook_execution_reporter_task_test.rb +20 -32
  38. data/test/jobs/exponential_backoff_test.rb +8 -9
  39. data/test/jobs/insights_client_status_aging_test.rb +2 -3
  40. data/test/jobs/insights_full_sync_test.rb +7 -13
  41. data/test/jobs/insights_resolutions_sync_test.rb +5 -9
  42. data/test/jobs/insights_rules_sync_test.rb +3 -5
  43. data/test/jobs/inventory_full_sync_test.rb +5 -9
  44. data/test/jobs/inventory_hosts_sync_test.rb +6 -11
  45. data/test/jobs/inventory_scheduled_sync_test.rb +6 -10
  46. data/test/jobs/inventory_self_host_sync_test.rb +1 -1
  47. data/test/jobs/remove_insights_hosts_job_test.rb +15 -14
  48. data/test/jobs/upload_report_job_test.rb +5 -7
  49. data/test/unit/fact_helpers_test.rb +0 -47
  50. data/test/unit/slice_generator_test.rb +0 -57
  51. data/webpack/ForemanRhCloudFills.js +2 -6
  52. data/webpack/ForemanRhCloudHelpers.js +0 -4
  53. data/webpack/InsightsHostDetailsTab/InsightsTab.scss +0 -4
  54. data/webpack/InsightsHostDetailsTab/InsightsTotalRiskChart.js +23 -59
  55. data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +16 -3
  56. data/webpack/InsightsVulnerabilityHostIndexExtensions/CVECountCell.js +2 -8
  57. data/webpack/InsightsVulnerabilityHostIndexExtensions/__tests__/CVECountCell.test.js +2 -48
  58. data/webpack/__tests__/ForemanRhCloudHelpers.test.js +1 -16
  59. data/webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap +0 -6
  60. metadata +4 -23
  61. data/app/controllers/concerns/foreman_rh_cloud/registration_manager_extensions.rb +0 -39
  62. data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +0 -30
  63. data/lib/foreman_inventory_upload/async/generate_host_report.rb +0 -20
  64. data/lib/foreman_inventory_upload/async/host_inventory_report_job.rb +0 -39
  65. data/lib/foreman_inventory_upload/async/single_host_report_job.rb +0 -20
  66. data/test/jobs/create_missing_insights_facets_test.rb +0 -151
  67. data/test/jobs/generate_host_report_test.rb +0 -100
  68. data/test/jobs/generate_report_job_test.rb +0 -146
  69. data/test/jobs/host_inventory_report_job_test.rb +0 -244
  70. data/test/jobs/queue_for_upload_job_test.rb +0 -65
  71. data/test/jobs/single_host_report_job_test.rb +0 -155
  72. data/test/unit/lib/foreman_rh_cloud/registration_manager_extensions_test.rb +0 -192
  73. data/webpack/InsightsHostDetailsTab/__tests__/InsightsTotalRiskChart.test.js +0 -194
@@ -9,14 +9,15 @@
9
9
  # 0868a4d1af5275b3f70b0a6dac4c99a4, 2023
10
10
  # Amit Upadhye <aupadhye@redhat.com>, 2023
11
11
  # Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarden.nl>, 2025
12
- # Ondřej Gajdušek, 2025
13
12
  #
13
+ #, fuzzy
14
14
  msgid ""
15
15
  msgstr ""
16
- "Project-Id-Version: foreman_rh_cloud 13.0.5\n"
16
+ "Project-Id-Version: foreman_rh_cloud 11.1.0\n"
17
17
  "Report-Msgid-Bugs-To: \n"
18
18
  "PO-Revision-Date: 2023-01-20 13:26+0000\n"
19
- "Last-Translator: Ondřej Gajdušek, 2025\n"
19
+ "Last-Translator: Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarde"
20
+ "n.nl>, 2025\n"
20
21
  "Language-Team: Chinese (China) (https://app.transifex.com/foreman/teams/114/zh"
21
22
  "_CN/)\n"
22
23
  "MIME-Version: 1.0\n"
@@ -43,9 +44,6 @@ msgstr "高级清单设置"
43
44
  msgid "All recommendations are now selected."
44
45
  msgstr "现在选择了所有建议。"
45
46
 
46
- msgid "Analytics data collection"
47
- msgstr "数据收集分析"
48
-
49
47
  msgid "Any Organization"
50
48
  msgstr "任意机构"
51
49
 
@@ -127,17 +125,11 @@ msgstr "下载最新的报告"
127
125
  msgid "Enable automatic deletion of mismatched host records from the Red Hat cloud"
128
126
  msgstr "启用自动删除来自红帽云的主机记录"
129
127
 
130
- msgid "Enable automatic deletion of mismatched host records from the Red Hat cloud. Ignored when using local Insights."
131
- msgstr ""
132
-
133
128
  msgid "Enable automatic synchronization of Insights recommendations from the Red Hat cloud"
134
129
  msgstr "启用来自红帽云的 Insights 建议自动同步"
135
130
 
136
- msgid "Enable automatic synchronization of Insights recommendations from the Red Hat cloud. Ignored when using local Insights."
137
- msgstr ""
138
-
139
- msgid "Enable automatic upload of your host inventory to the Red Hat cloud. Ignored when using local Insights."
140
- msgstr ""
131
+ msgid "Enable automatic upload of your host inventory to the Red Hat cloud"
132
+ msgstr "启用自动将主机清单上传到红帽云"
141
133
 
142
134
  msgid "Enable automatic upload of your hosts inventory to the Red Hat cloud"
143
135
  msgstr "启用自动将主机清单上传到红帽云"
@@ -151,14 +143,17 @@ msgstr "启用清单上传"
151
143
  msgid "Encountered an error while trying to access the server:"
152
144
  msgstr "在尝试访问服务器时遇到错误:"
153
145
 
154
- msgid "Exclude installed packages"
146
+ msgid "Exclude installed Packages"
155
147
  msgstr "排除安装的软件包"
156
148
 
157
149
  msgid "Exclude installed packages from being uploaded to the Red Hat cloud"
158
150
  msgstr "将安装的软件包上传到红帽云"
159
151
 
160
- msgid "Exclude installed packages from being uploaded to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored and installed packages are always excluded.) Ignored when using local Insights."
161
- msgstr ""
152
+ msgid "Exclude packages"
153
+ msgstr "排除软件包"
154
+
155
+ msgid "Exclude packages from being uploaded to the Red Hat cloud"
156
+ msgstr "排除软件包上传到红帽云"
162
157
 
163
158
  msgid "Exit Code: %s"
164
159
  msgstr "退出代码:%s"
@@ -193,9 +188,6 @@ msgstr "全屏"
193
188
  msgid "Generate and upload report"
194
189
  msgstr "生成并上传报告"
195
190
 
196
- msgid "Generate report"
197
- msgstr "生成报告"
198
-
199
191
  msgid "Generate the report, but do not upload"
200
192
  msgstr "生成报告,但不上传"
201
193
 
@@ -223,9 +215,6 @@ msgstr "获取 RH Cloud 中缺少的主机"
223
215
  msgid "Host Insights recommendations"
224
216
  msgstr "主机 Insights 建议"
225
217
 
226
- msgid "Host inventory report job"
227
- msgstr ""
228
-
229
218
  msgid "Host was not uploaded to your RH cloud inventory"
230
219
  msgstr "主机没有上传到您的 RH 云清单"
231
220
 
@@ -268,9 +257,6 @@ msgstr "每页的项"
268
257
  msgid "Knowledgebase article"
269
258
  msgstr "知识库文章"
270
259
 
271
- msgid "Learn more about {minimalDataCollectionSetting}."
272
- msgstr "了解有关 {minimalDataCollectionSetting} 的更多信息。"
273
-
274
260
  msgid "List of host UUIDs"
275
261
  msgstr "主机 UUID 列表"
276
262
 
@@ -286,12 +272,6 @@ msgstr "低"
286
272
  msgid "Manual"
287
273
  msgstr "手册"
288
274
 
289
- msgid "Minimal data collection"
290
- msgstr "最小数据收集"
291
-
292
- msgid "Missing Insights facets created: %s"
293
- msgstr ""
294
-
295
275
  msgid "Moderate"
296
276
  msgstr "中等"
297
277
 
@@ -322,33 +302,21 @@ msgstr "没有同步,此机构没有带有订阅的主机。"
322
302
  msgid "Notice"
323
303
  msgstr "注意事項"
324
304
 
305
+ msgid "Obfuscate IPs"
306
+ msgstr "模糊 IP"
307
+
325
308
  msgid "Obfuscate host ipv4 addresses"
326
309
  msgstr "模糊的主机 ipv4 地址"
327
310
 
328
- msgid "Obfuscate host ipv4 addresses."
329
- msgstr "对主机 ipv4 地址进行模糊化处理"
330
-
331
311
  msgid "Obfuscate host names"
332
312
  msgstr "模糊主机名"
333
313
 
334
314
  msgid "Obfuscate host names sent to the Red Hat cloud"
335
315
  msgstr "发送到红帽云的模糊主机名"
336
316
 
337
- msgid "Obfuscate host names sent to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored because host names are not included in the report.) Ignored when using local Insights."
338
- msgstr ""
339
-
340
317
  msgid "Obfuscate ipv4 addresses sent to the Red Hat cloud"
341
318
  msgstr "发送到红帽云的模糊 ipv4 地址"
342
319
 
343
- msgid "Obfuscate ipv4 addresses sent to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored because host IPv4 addresses are not included in the report.) Ignored when using local Insights."
344
- msgstr ""
345
-
346
- msgid "Only include the minimum required data in inventory reports for uploading to Red Hat cloud. When this is true, installed packages are excluded from the report regardless of the exclude_installed_packages setting, and host names and IPv4 addresses are excluded from the report regardless of obfuscation settings. Ignored when using local Insights."
347
- msgstr ""
348
-
349
- msgid "Only send the minimum required data to Red Hat cloud, obfuscation settings are disabled"
350
- msgstr "仅将最低所需的数据发送到红帽云,禁用模糊设置"
351
-
352
320
  msgid "Oops! Couldn't find organization that matches your query"
353
321
  msgstr "未找到与您的查询匹配的机构"
354
322
 
@@ -364,8 +332,11 @@ msgstr "运行 playbook"
364
332
  msgid "RH Cloud"
365
333
  msgstr "RH Cloud"
366
334
 
367
- msgid "RHC daemon id. Ignored when using local Insights."
368
- msgstr ""
335
+ msgid "RHC daemon id"
336
+ msgstr "RHC 守护进程 ID"
337
+
338
+ msgid "RHCloud"
339
+ msgstr "RHCloud"
369
340
 
370
341
  msgid "Read more about it in RH cloud insights"
371
342
  msgstr "在 RH Cloud insights 中了解更多有关它的信息"
@@ -424,7 +395,7 @@ msgstr "解决方案"
424
395
  msgid "Run RH Cloud playbook"
425
396
  msgstr "运行 RH Cloud playbook"
426
397
 
427
- msgid "Run playbook generated by Red Hat remediations app"
398
+ msgid "Run playbook genrated by Red Hat remediations app"
428
399
  msgstr "运行由红帽补救应用生成的 playbook"
429
400
 
430
401
  msgid "Run remediation playbook generated by Insights"
@@ -439,17 +410,14 @@ msgstr "用于删除主机的有范围的搜索字符串"
439
410
  msgid "Select recommendations from all pages"
440
411
  msgstr "在所有页面中选择建议"
441
412
 
442
- msgid "Send additional data to enhance Insights services, as per the settings"
443
- msgstr "根据设置,发送额外数据以增强 Insights 服务"
444
-
445
413
  msgid "Set the current organization context for the request"
446
414
  msgstr "设置请求的当前机构上下文"
447
415
 
448
416
  msgid "Settings"
449
417
  msgstr "设置"
450
418
 
451
- msgid "Should import include parameter tags from Foreman? Ignored when using local Insights."
452
- msgstr ""
419
+ msgid "Should import include parameter tags from Foreman?"
420
+ msgstr "应从 Foreman 导入包含参数标签?"
453
421
 
454
422
  msgid "Show Advanced Settings"
455
423
  msgstr "显示高级设置"
@@ -457,12 +425,6 @@ msgstr "显示高级设置"
457
425
  msgid "Show if system is configured to use local iop-advisor-engine."
458
426
  msgstr "显示系统是否被配置为使用本地 iop-advisor-engine。"
459
427
 
460
- msgid "Single-host report job"
461
- msgstr ""
462
-
463
- msgid "Single-host report job for host %s"
464
- msgstr ""
465
-
466
428
  msgid "Start inventory synchronization"
467
429
  msgstr "启动清单同步"
468
430
 
@@ -493,8 +455,8 @@ msgstr "Red Hat Hybrid Cloud Console 提供了一组云服务,包括 Red Hat I
493
455
  msgid "The report file %{filename} doesn't exist"
494
456
  msgstr "报告文件 %{filename} 不存在"
495
457
 
496
- msgid "The scheduled process is disabled because this Foreman is configured with a local IoP Smart Proxy."
497
- msgstr "调度的进程被禁用,因为此 Foreman 配置了一个本地 IoP Smart Proxy。"
458
+ msgid "The scheduled process is disabled because this Foreman is configured with the use_local_advisor_engine option."
459
+ msgstr "调度的进程被禁用,因为此 Foreman 配置了 use_local_advisor_engine 选项。"
498
460
 
499
461
  msgid "The server returned the following error: %s"
500
462
  msgstr "服务器返回以下错误:%s"
@@ -505,9 +467,6 @@ msgstr "任务失败,错误为:"
505
467
  msgid "There are no recommendations for your hosts"
506
468
  msgstr "没有适用于您的主机的建议"
507
469
 
508
- msgid "There were no missing Insights facets"
509
- msgstr ""
510
-
511
470
  msgid "This action will also enable automatic reports upload"
512
471
  msgstr "此操作还会启用自动报告上传"
513
472
 
@@ -517,9 +476,6 @@ msgstr "要为所有 Foreman 机构启用此报告,请将 {uploadButtonName}
517
476
  msgid "To manually upload the data for a specific organization, select an organization and click {restartButtonName}."
518
477
  msgstr "要手动上传特定机构的数据,请选择机构并点 {restartButtonName}。"
519
478
 
520
- msgid "Total CVEs"
521
- msgstr "CVE 总数"
522
-
523
479
  msgid "Total risk"
524
480
  msgstr "总风险"
525
481
 
@@ -547,12 +503,6 @@ msgstr "查看所有建议"
547
503
  msgid "View in Red Hat Insights"
548
504
  msgstr "禁用 Red Hat Insights"
549
505
 
550
- msgid "Vulnerabilities"
551
- msgstr "安全漏洞"
552
-
553
- msgid "Vulnerability"
554
- msgstr "安全漏洞"
555
-
556
506
  msgid "Wait and %s"
557
507
  msgstr "等待和 %s"
558
508
 
@@ -619,9 +569,6 @@ msgstr "rule id"
619
569
  msgid "rule title"
620
570
  msgstr "rule 标题"
621
571
 
622
- msgid "setting minimal data collection"
623
- msgstr "设置最小数据收集"
624
-
625
572
  msgid "solution url"
626
573
  msgstr "solution url"
627
574
 
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreman_rh_cloud",
3
- "version": "12.2.13",
3
+ "version": "13.0.0",
4
4
  "description": "Inventory Upload =============",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,7 +4,7 @@ require 'foreman_tasks/test_helpers'
4
4
  require "#{ForemanTasks::Engine.root}/test/support/dummy_dynflow_action"
5
5
 
6
6
  class CloudConnectorAnnounceTaskTest < ActiveSupport::TestCase
7
- include Dynflow::Testing::Factories
7
+ include ForemanTasks::TestHelpers::WithInThreadExecutor
8
8
 
9
9
  setup do
10
10
  RemoteExecutionFeature.register(
@@ -23,8 +23,7 @@ class CloudConnectorAnnounceTaskTest < ActiveSupport::TestCase
23
23
  test 'It executes cloud presence announcer' do
24
24
  ForemanRhCloud::CloudPresence.any_instance.expects(:announce_to_sources).times(Organization.unscoped.count)
25
25
 
26
- action = create_and_plan_action(InsightsCloud::Async::CloudConnectorAnnounceTask, @job_invocation)
27
- finalize_action(action)
26
+ ForemanTasks.sync_task(InsightsCloud::Async::CloudConnectorAnnounceTask, @job_invocation)
28
27
  end
29
28
 
30
29
  private
@@ -4,7 +4,7 @@ require 'foreman_tasks/test_helpers'
4
4
  require "#{ForemanTasks::Engine.root}/test/support/dummy_dynflow_action"
5
5
 
6
6
  class ConnectorPlaybookExecutionReporterTaskTest < ActiveSupport::TestCase
7
- include Dynflow::Testing::Factories
7
+ include ForemanTasks::TestHelpers::WithInThreadExecutor
8
8
 
9
9
  # override default send behavior for the test
10
10
  class TestConnectorPlaybookExecutionReporterTask < InsightsCloud::Async::ConnectorPlaybookExecutionReporterTask
@@ -35,19 +35,17 @@ class ConnectorPlaybookExecutionReporterTaskTest < ActiveSupport::TestCase
35
35
 
36
36
  TestConnectorPlaybookExecutionReporterTask.any_instance.stubs(:job_finished?).returns(true)
37
37
 
38
- action = create_and_plan_action(TestConnectorPlaybookExecutionReporterTask, @job_invocation)
39
- action = run_action(action)
38
+ actual = ForemanTasks.sync_task(TestConnectorPlaybookExecutionReporterTask, @job_invocation)
40
39
 
41
- saved_reports = action.output[:saved_reports]
42
- actual_report = saved_reports.first.to_s
40
+ actual_report = actual.output[:saved_reports].first.to_s
43
41
 
44
- assert_equal 1, saved_reports.size
42
+ assert_equal 1, actual.output[:saved_reports].size
45
43
  assert_not_nil actual_report
46
44
  actual_jsonl = read_jsonl(actual_report)
47
45
 
48
- assert_equal true, action.output['task']['invocation_status']['task_state']['task_done_reported']
49
- assert_equal 0, action.output['task']['invocation_status']['hosts_state']['TEST_UUID1']['exit_status']
50
- assert_equal 0, action.output['task']['invocation_status']['hosts_state']['TEST_UUID2']['exit_status']
46
+ assert_equal true, actual.output['task']['invocation_status']['task_state']['task_done_reported']
47
+ assert_equal 0, actual.output['task']['invocation_status']['hosts_state']['TEST_UUID1']['exit_status']
48
+ assert_equal 0, actual.output['task']['invocation_status']['hosts_state']['TEST_UUID2']['exit_status']
51
49
 
52
50
  assert_equal true, @job_invocation.finished?
53
51
  assert_equal 'stopped', @job_invocation.sub_task_for_host(Host.where(name: 'host1').first)['state']
@@ -79,25 +77,20 @@ class ConnectorPlaybookExecutionReporterTaskTest < ActiveSupport::TestCase
79
77
 
80
78
  ArrangeTestHost.any_instance.stubs(:job_finished?).returns(false, true)
81
79
 
82
- action = create_and_plan_action(ArrangeTestHost, @job_invocation)
83
- action = run_action(action)
80
+ actual = ForemanTasks.sync_task(ArrangeTestHost, @job_invocation)
84
81
 
85
- # Process polling cycles - manually trigger Poll events until done
86
- action = run_action(action, Dynflow::Action::Polling::Poll) until action.done?
82
+ actual_report1 = actual.output[:saved_reports].first.to_s
83
+ actual_report2 = actual.output[:saved_reports].second.to_s
87
84
 
88
- saved_reports = action.output[:saved_reports]
89
- actual_report1 = saved_reports.first.to_s
90
- actual_report2 = saved_reports.second.to_s
91
-
92
- assert_equal 2, saved_reports.size
85
+ assert_equal 2, actual.output[:saved_reports].size
93
86
  assert_not_nil actual_report1
94
87
  assert_not_nil actual_report2
95
88
 
96
89
  actual_json1 = read_jsonl(actual_report1)
97
90
  actual_json2 = read_jsonl(actual_report2)
98
91
 
99
- assert_equal true, action.output['task']['invocation_status']['task_state']['task_done_reported']
100
- assert_equal 0, action.output['task']['invocation_status']['hosts_state']['TEST_UUID1']['exit_status']
92
+ assert_equal true, actual.output['task']['invocation_status']['task_state']['task_done_reported']
93
+ assert_equal 0, actual.output['task']['invocation_status']['hosts_state']['TEST_UUID1']['exit_status']
101
94
 
102
95
  assert_equal 'stopped', @job_invocation.sub_task_for_host(Host.where(name: 'host1').first)['state']
103
96
 
@@ -148,18 +141,13 @@ class ConnectorPlaybookExecutionReporterTaskTest < ActiveSupport::TestCase
148
141
 
149
142
  ArrangeTestHostTwo.any_instance.stubs(:job_finished?).returns(false, false, true)
150
143
 
151
- action = create_and_plan_action(ArrangeTestHostTwo, @job_invocation)
152
- action = run_action(action)
153
-
154
- # Process polling cycles - manually trigger Poll events until done
155
- action = run_action(action, Dynflow::Action::Polling::Poll) until action.done?
144
+ actual = ForemanTasks.sync_task(ArrangeTestHostTwo, @job_invocation)
156
145
 
157
- saved_reports = action.output[:saved_reports]
158
- actual_report1 = saved_reports.first.to_s
159
- actual_report2 = saved_reports.second.to_s
160
- actual_report3 = saved_reports.third.to_s
146
+ actual_report1 = actual.output[:saved_reports].first.to_s
147
+ actual_report2 = actual.output[:saved_reports].second.to_s
148
+ actual_report3 = actual.output[:saved_reports].third.to_s
161
149
 
162
- assert_equal 3, saved_reports.size
150
+ assert_equal 3, actual.output[:saved_reports].size
163
151
  assert_not_nil actual_report1
164
152
  assert_not_nil actual_report2
165
153
  assert_not_nil actual_report3
@@ -168,8 +156,8 @@ class ConnectorPlaybookExecutionReporterTaskTest < ActiveSupport::TestCase
168
156
  actual_json2 = read_jsonl(actual_report2)
169
157
  actual_json3 = read_jsonl(actual_report3)
170
158
 
171
- assert_equal true, action.output['task']['invocation_status']['task_state']['task_done_reported']
172
- assert_equal 0, action.output['task']['invocation_status']['hosts_state']['TEST_UUID1']['exit_status']
159
+ assert_equal true, actual.output['task']['invocation_status']['task_state']['task_done_reported']
160
+ assert_equal 0, actual.output['task']['invocation_status']['hosts_state']['TEST_UUID1']['exit_status']
173
161
 
174
162
  assert_not_nil actual_report_updated = actual_json1.find { |l| l['type'] == 'playbook_run_update' && l['host'] == 'TEST_UUID1' }
175
163
  assert_equal 'TEST_CORRELATION', actual_report_updated['correlation_id']
@@ -2,7 +2,7 @@ require 'test_plugin_helper'
2
2
  require 'foreman_tasks/test_helpers'
3
3
 
4
4
  class ExponentialBackoffTest < ActiveSupport::TestCase
5
- include Dynflow::Testing::Factories
5
+ include ForemanTasks::TestHelpers::WithInThreadExecutor
6
6
 
7
7
  class TestAction < ::Actions::EntryAction
8
8
  include ::ForemanRhCloud::Async::ExponentialBackoff
@@ -19,29 +19,28 @@ class ExponentialBackoffTest < ActiveSupport::TestCase
19
19
  test 'executes an action once' do
20
20
  TestAction.any_instance.expects(:action_callback).returns(->(instance) { instance.done! })
21
21
 
22
- action = create_and_plan_action(TestAction)
23
- run_action(action)
22
+ ForemanTasks.sync_task(TestAction)
24
23
  end
25
24
 
26
25
  test 'fails after a single excution if done was called' do
27
26
  TestAction.any_instance.expects(:action_callback).returns(
28
27
  lambda do |instance|
29
28
  instance.done!
30
- raise StandardError.new('Foo')
29
+ raise ::Foreman::Exception('Foo')
31
30
  end
32
31
  )
33
32
 
34
- action = create_and_plan_action(TestAction)
35
- run_action(action)
33
+ ForemanTasks.sync_task(TestAction)
36
34
  end
37
35
 
38
36
  test 'executes the task three times before failing it' do
39
37
  # speed up the execution
40
38
  TestAction.any_instance.stubs(:poll_intervals).returns([0, 0, 0])
41
39
 
42
- TestAction.any_instance.expects(:action_callback).raises(StandardError.new('Foo')).at_least_once
40
+ TestAction.any_instance.expects(:action_callback).raises(::Foreman::Exception.new('Foo')).times(3)
43
41
 
44
- action = create_and_plan_action(TestAction)
45
- run_action(action)
42
+ ForemanTasks.sync_task(TestAction)
43
+ rescue ForemanTasks::TaskError => ex
44
+ assert ex.aggregated_message =~ /Foo/
46
45
  end
47
46
  end
@@ -2,7 +2,7 @@ require 'test_plugin_helper'
2
2
  require 'foreman_tasks/test_helpers'
3
3
 
4
4
  class InsightsClientStatusAgingTest < ActiveSupport::TestCase
5
- include Dynflow::Testing::Factories
5
+ include ForemanTasks::TestHelpers::WithInThreadExecutor
6
6
 
7
7
  setup do
8
8
  User.current = User.find_by(login: 'secret_admin')
@@ -21,8 +21,7 @@ class InsightsClientStatusAgingTest < ActiveSupport::TestCase
21
21
  InsightsClientReportStatus.find_or_initialize_by(host_id: @host3.id).update(status: InsightsClientReportStatus::REPORTING, reported_at: Time.now - InsightsClientReportStatus::REPORT_INTERVAL - 1.day)
22
22
  InsightsClientReportStatus.find_or_initialize_by(host_id: @host4.id).update(status: InsightsClientReportStatus::NO_REPORT, reported_at: Time.now - InsightsClientReportStatus::REPORT_INTERVAL - 1.day)
23
23
 
24
- action = create_and_plan_action(InsightsCloud::Async::InsightsClientStatusAging)
25
- run_action(action)
24
+ ForemanTasks.sync_task(InsightsCloud::Async::InsightsClientStatusAging)
26
25
 
27
26
  @hosts.each(&:reload)
28
27
 
@@ -2,7 +2,7 @@ require 'test_plugin_helper'
2
2
  require 'foreman_tasks/test_helpers'
3
3
 
4
4
  class InsightsFullSyncTest < ActiveSupport::TestCase
5
- include Dynflow::Testing::Factories
5
+ include ForemanTasks::TestHelpers::WithInThreadExecutor
6
6
  include MockCerts
7
7
 
8
8
  setup do
@@ -72,8 +72,7 @@ class InsightsFullSyncTest < ActiveSupport::TestCase
72
72
  InsightsCloud::Async::InsightsFullSync.any_instance.expects(:plan_hosts_sync)
73
73
  InsightsCloud::Async::InsightsFullSync.any_instance.expects(:plan_rules_sync)
74
74
  InsightsCloud::Async::InsightsFullSync.any_instance.expects(:plan_notifications)
75
- action = create_and_plan_action(InsightsCloud::Async::InsightsFullSync, [@host1.organization, @host2.organization])
76
- run_action(action)
75
+ ForemanTasks.sync_task(InsightsCloud::Async::InsightsFullSync, [@host1.organization, @host2.organization])
77
76
 
78
77
  @host1.reload
79
78
  @host2.reload
@@ -90,8 +89,7 @@ class InsightsFullSyncTest < ActiveSupport::TestCase
90
89
  InsightsCloud::Async::InsightsFullSync.any_instance.expects(:plan_hosts_sync).never
91
90
  InsightsCloud::Async::InsightsFullSync.any_instance.expects(:plan_self).never
92
91
 
93
- action = create_and_plan_action(InsightsCloud::Async::InsightsFullSync, [@host1.organization])
94
- run_action(action)
92
+ ForemanTasks.sync_task(InsightsCloud::Async::InsightsFullSync, [@host1.organization])
95
93
  end
96
94
 
97
95
  test 'Manifest is deleted do not run task steps' do
@@ -102,8 +100,7 @@ class InsightsFullSyncTest < ActiveSupport::TestCase
102
100
  InsightsCloud::Async::InsightsFullSync.any_instance.expects(:plan_hosts_sync).never
103
101
  InsightsCloud::Async::InsightsFullSync.any_instance.expects(:plan_self).never
104
102
 
105
- action = create_and_plan_action(InsightsCloud::Async::InsightsFullSync, [@host1.organization])
106
- run_action(action)
103
+ ForemanTasks.sync_task(InsightsCloud::Async::InsightsFullSync, [@host1.organization])
107
104
  end
108
105
 
109
106
  test 'Hits counters are reset correctly' do
@@ -113,11 +110,9 @@ class InsightsFullSyncTest < ActiveSupport::TestCase
113
110
 
114
111
  InsightsCloud::Async::InsightsFullSync.any_instance.stubs(:plan_hosts_sync)
115
112
 
116
- action = create_and_plan_action(InsightsCloud::Async::InsightsFullSync, [@host1.organization, @host2.organization])
117
- run_action(action)
113
+ ForemanTasks.sync_task(InsightsCloud::Async::InsightsFullSync, [@host1.organization, @host2.organization])
118
114
  # Invoke again
119
- action = create_and_plan_action(InsightsCloud::Async::InsightsFullSync, [@host1.organization, @host2.organization])
120
- run_action(action)
115
+ ForemanTasks.sync_task(InsightsCloud::Async::InsightsFullSync, [@host1.organization, @host2.organization])
121
116
 
122
117
  @host1.reload
123
118
  @host2.reload
@@ -151,8 +146,7 @@ class InsightsFullSyncTest < ActiveSupport::TestCase
151
146
  InsightsCloud::Async::InsightsFullSync.any_instance.stubs(:plan_hosts_sync)
152
147
  InsightsCloud::Async::InsightsFullSync.any_instance.expects(:query_insights_hits).returns(hits)
153
148
 
154
- action = create_and_plan_action(InsightsCloud::Async::InsightsFullSync, [@host1.organization, @host2.organization])
155
- run_action(action)
149
+ ForemanTasks.sync_task(InsightsCloud::Async::InsightsFullSync, [@host1.organization, @host2.organization])
156
150
 
157
151
  @host1.reload
158
152
  @host2.reload
@@ -2,7 +2,7 @@ require 'test_plugin_helper'
2
2
  require 'foreman_tasks/test_helpers'
3
3
 
4
4
  class InsightsResolutionsSyncTest < ActiveSupport::TestCase
5
- include Dynflow::Testing::Factories
5
+ include ForemanTasks::TestHelpers::WithInThreadExecutor
6
6
  include MockCerts
7
7
 
8
8
  setup do
@@ -76,8 +76,7 @@ class InsightsResolutionsSyncTest < ActiveSupport::TestCase
76
76
  Katello::UpstreamConnectionChecker.any_instance.stubs(:can_connect?).returns(true)
77
77
  InsightsCloud::Async::InsightsResolutionsSync.any_instance.stubs(:query_insights_resolutions).returns(@resolutions)
78
78
 
79
- action = create_and_plan_action(InsightsCloud::Async::InsightsResolutionsSync)
80
- run_action(action)
79
+ ForemanTasks.sync_task(InsightsCloud::Async::InsightsResolutionsSync)
81
80
  @rule.reload
82
81
 
83
82
  assert_equal 5, InsightsResolution.all.count
@@ -89,8 +88,7 @@ class InsightsResolutionsSyncTest < ActiveSupport::TestCase
89
88
  Katello::UpstreamConnectionChecker.any_instance.stubs(:can_connect?).returns(false)
90
89
  InsightsCloud::Async::InsightsResolutionsSync.any_instance.expects(:query_insights_resolutions).never
91
90
 
92
- action = create_and_plan_action(InsightsCloud::Async::InsightsResolutionsSync)
93
- run_action(action)
91
+ ForemanTasks.sync_task(InsightsCloud::Async::InsightsResolutionsSync)
94
92
 
95
93
  assert_equal 0, InsightsResolution.all.count
96
94
  end
@@ -100,8 +98,7 @@ class InsightsResolutionsSyncTest < ActiveSupport::TestCase
100
98
  Katello::UpstreamConnectionChecker.any_instance.stubs(:can_connect?).returns(true)
101
99
  InsightsCloud::Async::InsightsResolutionsSync.any_instance.expects(:query_insights_resolutions).never
102
100
 
103
- action = create_and_plan_action(InsightsCloud::Async::InsightsResolutionsSync)
104
- run_action(action)
101
+ ForemanTasks.sync_task(InsightsCloud::Async::InsightsResolutionsSync)
105
102
 
106
103
  assert_equal 0, InsightsResolution.all.count
107
104
  end
@@ -111,8 +108,7 @@ class InsightsResolutionsSyncTest < ActiveSupport::TestCase
111
108
  InsightsCloud::Async::InsightsResolutionsSync.any_instance.expects(:query_insights_resolutions).never
112
109
  InsightsRule.all.delete_all
113
110
 
114
- action = create_and_plan_action(InsightsCloud::Async::InsightsResolutionsSync)
115
- run_action(action)
111
+ ForemanTasks.sync_task(InsightsCloud::Async::InsightsResolutionsSync)
116
112
 
117
113
  assert_equal 0, InsightsResolution.all.count
118
114
  end
@@ -2,7 +2,7 @@ require 'test_plugin_helper'
2
2
  require 'foreman_tasks/test_helpers'
3
3
 
4
4
  class InsightsRulesSyncTest < ActiveSupport::TestCase
5
- include Dynflow::Testing::Factories
5
+ include ForemanTasks::TestHelpers::WithInThreadExecutor
6
6
 
7
7
  setup do
8
8
  rules_json = <<-'RULES_JSON'
@@ -119,8 +119,7 @@ class InsightsRulesSyncTest < ActiveSupport::TestCase
119
119
  # do not cleanup unused rules for tests
120
120
  InsightsCloud::Async::InsightsRulesSync.any_instance.stubs(:cleanup_rules)
121
121
 
122
- action = create_and_plan_action(InsightsCloud::Async::InsightsRulesSync, Organization.all)
123
- run_action(action)
122
+ ForemanTasks.sync_task(InsightsCloud::Async::InsightsRulesSync, Organization.all)
124
123
  @hit.reload
125
124
 
126
125
  assert_equal 2, InsightsRule.all.count
@@ -202,8 +201,7 @@ class InsightsRulesSyncTest < ActiveSupport::TestCase
202
201
  # do not cleanup unused rules for tests
203
202
  InsightsCloud::Async::InsightsRulesSync.any_instance.stubs(:cleanup_rules)
204
203
 
205
- action = create_and_plan_action(InsightsCloud::Async::InsightsRulesSync, Organization.all)
206
- run_action(action)
204
+ ForemanTasks.sync_task(InsightsCloud::Async::InsightsRulesSync, Organization.all)
207
205
 
208
206
  assert_equal 3, InsightsRule.all.count
209
207
  end
@@ -2,7 +2,7 @@ require 'test_plugin_helper'
2
2
  require 'foreman_tasks/test_helpers'
3
3
 
4
4
  class InventoryFullSyncTest < ActiveSupport::TestCase
5
- include Dynflow::Testing::Factories
5
+ include ForemanTasks::TestHelpers::WithInThreadExecutor
6
6
  include MockCerts
7
7
  include KatelloCVEHelper
8
8
 
@@ -265,8 +265,7 @@ class InventoryFullSyncTest < ActiveSupport::TestCase
265
265
 
266
266
  InventorySync::Async::InventoryFullSync.any_instance.expects(:query_inventory).returns(@inventory)
267
267
 
268
- action = create_and_plan_action(InventorySync::Async::InventoryFullSync, @host2.organization)
269
- run_action(action)
268
+ ForemanTasks.sync_task(InventorySync::Async::InventoryFullSync, @host2.organization)
270
269
 
271
270
  @host2.reload
272
271
 
@@ -281,8 +280,7 @@ class InventoryFullSyncTest < ActiveSupport::TestCase
281
280
  InventorySync::Async::InventoryFullSync.any_instance.expects(:query_inventory).returns(@inventory)
282
281
  FactoryBot.create(:fact_value, fact_name: fact_names['virt::uuid'], value: '1234', host: @host2)
283
282
 
284
- action = create_and_plan_action(InventorySync::Async::InventoryFullSync, @host1.organization)
285
- run_action(action)
283
+ ForemanTasks.sync_task(InventorySync::Async::InventoryFullSync, @host1.organization)
286
284
  @host2.reload
287
285
 
288
286
  assert_equal InventorySync::InventoryStatus::DISCONNECT, InventorySync::InventoryStatus.where(host_id: @host1.id).first.status
@@ -293,8 +291,7 @@ class InventoryFullSyncTest < ActiveSupport::TestCase
293
291
 
294
292
  InventorySync::Async::InventoryFullSync.any_instance.expects(:plan_self).never
295
293
 
296
- action = create_and_plan_action(InventorySync::Async::InventoryFullSync, @host1.organization)
297
- run_action(action)
294
+ ForemanTasks.sync_task(InventorySync::Async::InventoryFullSync, @host1.organization)
298
295
  end
299
296
 
300
297
  test 'Should skip hosts that are not returned in query' do
@@ -307,8 +304,7 @@ class InventoryFullSyncTest < ActiveSupport::TestCase
307
304
  InventorySync::Async::InventoryFullSync.any_instance.expects(:affected_host_ids).returns([@host1.id, @host2.id])
308
305
  FactoryBot.create(:fact_value, fact_name: fact_names['virt::uuid'], value: '1234', host: @host2)
309
306
 
310
- action = create_and_plan_action(InventorySync::Async::InventoryFullSync, @host1.organization)
311
- run_action(action)
307
+ ForemanTasks.sync_task(InventorySync::Async::InventoryFullSync, @host1.organization)
312
308
  @host2.reload
313
309
 
314
310
  assert_nil InventorySync::InventoryStatus.where(host_id: @host3.id).first