earthdata-owner / test-repo-A

Test Repo A for Tasktop integration
0 stars 0 forks source link

Some ECC tests throw a 405 "Method Not Allowed" error #24

Open ccuadrado opened 2 years ago

ccuadrado commented 2 years ago

When some  ECC integration tests are run, a 405 "Method Not Allowed" error is caught when trying to delete a JIRA project during cleanup. Currently, we are swallowing the excerption thrown from the API call and allowing the tests to pass despite the project(s) not actually being deleted. We should figure out the root cause of this instead of simply catching and on reporting the error:

see the rescue block in jira_helper.rb:

def delete_jira_project(key)
  return if get_jira_project(key).nil?

  begin
    response = rest_resource["project"][key].delete(content_type: :json,
                                                  accept: :json,
                                                  as: :json)
    response == ""

  # For some reason, the JIRA API intermittently returns an error such as
  # 403 or 405, even if the project exists and the user has deletion rights.
  # We haven't figured out why, but we suspect JIRA is still persisting updates
  # to it due to a previous operation.
  rescue RestClient::ExceptionWithResponse => e
    if e.is_a?(RestClient::Forbidden) || e.is_a?(RestClient::MethodNotAllowed)
      puts "WARNING: Failed to delete JIRA project #{key}."
      puts e.inspect
    else
      raise e
    end
  end

delete_jira_project