fix remaining refactor bugs
This commit resolves some remaining bugs related to last weeks massive code refactor. - updates argument names - adds more inline documentation! - explicitly refer to ::Github from the Github module. Otherwise it fails
This commit is contained in:
@@ -9,6 +9,7 @@ module Puppetlabs
|
||||
include Puppetlabs::OsTester::Librarian
|
||||
|
||||
# checkout a specified pull request and test it
|
||||
#
|
||||
# Parameters:
|
||||
# repo_name::
|
||||
# short name of the repo to pull from (ex: nova, glance, ...)
|
||||
@@ -52,8 +53,8 @@ module Puppetlabs
|
||||
system "bash -c 'rspec #{rspec_test}; echo $?' 2>&1 | tee #{log_file}"
|
||||
results = File.read(log_file)
|
||||
publish_results(
|
||||
args.project_name,
|
||||
args.number,
|
||||
repo_name,
|
||||
pull_request_number,
|
||||
results.split("\n").last == '0' ? 'passed' : 'failed',
|
||||
results,
|
||||
{
|
||||
@@ -63,7 +64,18 @@ module Puppetlabs
|
||||
)
|
||||
end
|
||||
|
||||
# has specified the expected body.
|
||||
# figure out if a certain pull request can be tested.
|
||||
# Pull requests can only be tested if they have a comment
|
||||
# that contains the speficied expected_body in a PR comment
|
||||
# created by one of the approved admin.
|
||||
#
|
||||
# Parameters:
|
||||
# pr::
|
||||
# pull request object to be verified.
|
||||
# admin_users::
|
||||
# array of users who can approve pull requests for testing
|
||||
# expected_body::
|
||||
# expected body of a message that means a PR can be tested.
|
||||
def testable_pull_request?(
|
||||
pr,
|
||||
admin_users,
|
||||
@@ -73,7 +85,7 @@ module Puppetlabs
|
||||
if ! pr['merged']
|
||||
if pr['mergeable']
|
||||
if pr['comments'] > 0
|
||||
comments = Github.new(options).issues.comments.all(
|
||||
comments = ::Github.new(options).issues.comments.all(
|
||||
pr['base']['user']['login'],
|
||||
pr['base']['repo']['name'],
|
||||
pr['number']
|
||||
@@ -135,7 +147,7 @@ module Puppetlabs
|
||||
|
||||
each_repo do |repo_name|
|
||||
if repo_name == project_name
|
||||
pr = Github.new(options).pull_requests.get('puppetlabs', "puppetlabs-#{project_name}", number)
|
||||
pr = ::Github.new(options).pull_requests.get('puppetlabs', "puppetlabs-#{project_name}", number)
|
||||
# need to be able to override this?
|
||||
if checkedout_branch[:project]
|
||||
if checkedout_branch[:project] == project_name and checkedout_branch[:number] == number
|
||||
@@ -182,7 +194,7 @@ module Puppetlabs
|
||||
# publish a link to that gist as a issue comment.
|
||||
def publish_results(project_name, number, outcome, body, options)
|
||||
require 'github_api'
|
||||
github = Github.new(options)
|
||||
github = ::Github.new(options)
|
||||
gist_response = github.gists.create(
|
||||
'description' => "#{project_name}/#{number}@#{Time.now.strftime("%Y%m%dT%H%M%S%z")}",
|
||||
'public' => true,
|
||||
|
||||
Reference in New Issue
Block a user