Skip to content

Commit 7c3691b

Browse files
committed
Update error reporting for catalogs where parallel is called
1 parent 8dbf526 commit 7c3691b

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

lib/octocatalog-diff/util/catalogs.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def build_catalog_parallelizer
8989

9090
# Execute the parallelized catalog builds
9191
passed_catalog_tasks = catalog_tasks.map { |x| x[1] }
92-
parallel_catalogs = OctocatalogDiff::Util::Parallel.run_tasks(passed_catalog_tasks, @logger, @options[:parallel])
92+
parallel_catalogs = OctocatalogDiff::Util::Parallel.run_tasks(passed_catalog_tasks, @logger, @options[:parallel], false)
9393

9494
# If the catalogs array is empty at this point, there is an unexpected size mismatch. This should
9595
# never happen, but test for it anyway.
@@ -99,6 +99,15 @@ def build_catalog_parallelizer
9999
# :nocov:
100100
end
101101

102+
# If catalogs failed to compile, report that. Prefer to display an actual failure message rather
103+
# than a generic incomplete parallel task message if there is a more specific message present.
104+
failures = parallel_catalogs.reject(&:status)
105+
if failures.any?
106+
f = failures.reject { |r| r.exception.is_a?(OctocatalogDiff::Util::Parallel::IncompleteTask) }.first
107+
f ||= failures.first
108+
raise OctocatalogDiff::Errors::CatalogError, "#{f.exception.class}: #{f.exception.message}"
109+
end
110+
102111
# Construct result hash. Will eventually be in the format
103112
# { :from => OctocatalogDiff::Catalog, :to => OctocatalogDiff::Catalog }
104113

spec/octocatalog-diff/integration/cached_master_dir_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@
197197
'--cached-master-dir', @cached_master_dir,
198198
'--safe-to-delete-cached-master-dir', @cached_master_dir,
199199
'--master-cache-branch', 'master',
200-
'-n', 'rspec-node.github.net'
200+
'-n', 'rspec-node.github.net',
201+
'--no-parallel'
201202
]
202203
)
203204

0 commit comments

Comments
 (0)