Skip to content

Commit

Permalink
Allow to define product support entity in features file
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernhard authored and ehelms committed Aug 7, 2023
1 parent d3afabb commit 3b30b83
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
8 changes: 8 additions & 0 deletions definitions/features/instance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ def product_name
end
end

def project_support_entity
if feature(:satellite)
'Red Hat Technical Support'
else
'Foreman Community Support'
end
end

def database_remote?(feature)
!!feature(feature) && !feature(feature).local?
end
Expand Down
10 changes: 5 additions & 5 deletions lib/foreman_maintain/reporter/cli_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -330,20 +330,20 @@ def scenario_failure_message(scenario)
whitelist_labels = steps_to_whitelist.map(&:label_dashed).join(',')
unless whitelist_labels.empty?
recommend << if scenario.detector.feature(:instance).downstream
format(<<-MESSAGE.strip_heredoc, whitelist_labels)
format(<<-MESSAGE.strip_heredoc)
Resolve the failed steps and rerun the command.
If the situation persists and, you are unclear what to do next,
contact Red Hat Technical Support.
contact #{scenario.detector.feature(:instance).project_support_entity}.
In case the failures are false positives, use
--whitelist="%s"
--whitelist="#{whitelist_labels}"
MESSAGE
else
format(<<-MESSAGE.strip_heredoc, whitelist_labels)
format(<<-MESSAGE.strip_heredoc)
Resolve the failed steps and rerun the command.
In case the failures are false positives, use
--whitelist="%s"
--whitelist="#{whitelist_labels}"
MESSAGE
end
end
Expand Down
8 changes: 8 additions & 0 deletions test/lib/reporter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ class FakeInstanceFeature < ForemanMaintain::Feature
def downstream
feature(:satellite) || feature(:capsule)
end

def project_support_entity
if feature(:satellite)
'Red Hat Technical Support'
else
'Foreman community support'
end
end
end

describe Reporter::CLIReporter do
Expand Down

0 comments on commit 3b30b83

Please sign in to comment.