JiraService does not handle service events

The investigation started in #24777 (closed), but it's not related to this particular exception at all.

The definition of JiraService#execute currently (b3e1561f) looks like that:

  def execute(push, issue = nil)
    if issue.nil?
      # No specific issue, that means
      # we just want to test settings
      test_settings
    else
      jira_issue = jira_request { client.Issue.find(issue.iid) }

      return false unless jira_issue.present?

      close_issue(push, jira_issue)
    end
  end

The second argument defaults to nil. Then the if statement checks if it's nil. If it's nil it executes test_settings. Which means that if we invoke JiraService#execute as execute(just_one_argument) we will always execute test_settings.

ProjectServiceWorker always does Service.find(hook_id).execute(data). This means that ProjectServiceWorker never passes the second argument to execute. This also means that ProjectServiceWorker always runs test_settings.

The only place where we call execute method with two parameters is Issues::CloseService#close_issue. And this is the only place that works properly.

Your commit - https://gitlab.com/gitlab-org/gitlab-ce/commit/d399e1ae2b92bc399962a286fddc59eaa09670a7 changed the hook triggers that are supported by JiraService. For some reason we didn't get any bug reports before that, but calling JiraService#execute from ProjectServiceWorker was always broken.

Am I missing something obvious here?

/cc @smcgivern @felipe_artur