Skip to content

Commit

Permalink
Merge pull request #8 from ehelms/master
Browse files Browse the repository at this point in the history
Updates to run test suite on Travis.
  • Loading branch information
jlsherrill committed Oct 12, 2012
2 parents 005d72e + 4af1bcf commit 0c30bf0
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 24 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: ruby
rvm:
- "1.8.7"
#- "1.9.2"
#- "1.9.3"
# uncomment this line if your project needs to run something other than `rake`:
script: bundle exec rake test:integration
9 changes: 4 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in runcible.gemspec
gemspec

gem 'json'
gem 'rake', '0.9.2.2'
gem 'json', '1.7.5'
gem 'rest-client', '>= 1.6.1'
gem 'oauth'

group :development, :test do
gem 'ruby-debug'
end
gem 'activesupport', '3.0.10'
gem 'i18n', '0.5.0'

group :test do
gem 'vcr'
Expand Down
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ namespace :test do
task :integration do
options = {}

options[:mode] = ENV['mode']
options[:mode] = ENV['mode'] || 'none'
options[:test_name] = ENV['test']
options[:auth_type] = ENV['auth_type']
options[:logging] = ENV['logging']

if !['recorded', 'live', 'none'].include?(options[:mode])
puts "Invalid test mode"
Expand Down
3 changes: 0 additions & 3 deletions test/integration/resources/helpers/repository_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def self.task
end

def self.create_and_sync_repo(options={})
puts "Creating and Sync'ing repository."
create_repo(options)
sync_repo(options)
end
Expand Down Expand Up @@ -126,8 +125,6 @@ def self.create_schedule
end

def self.destroy_repo(id=@repo_id)
puts "Destroying Repository."

VCR.use_cassette('pulp_repository_helper') do
if @task
while !(['finished', 'error', 'timed_out', 'canceled', 'reset'].include?(@task['state'])) do
Expand Down
37 changes: 23 additions & 14 deletions test/integration/test_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

require 'rubygems'
require 'ruby-debug'
require 'minitest/unit'
require 'minitest/autorun'

Expand Down Expand Up @@ -57,10 +56,16 @@ def run_tests(options={})
mode = options[:mode] || "recorded"
test_name = options[:test_name] || nil
auth_type = options[:auth_type] || "http"
logging = options[:logging] || false

MiniTest::Unit.runner = CustomMiniTestRunner::Unit.new

set_runcible_config(auth_type)
if mode == "live"
set_runcible_config({ :auth_type => auth_type, :logging => logging })
else
set_runcible_config({ :logging => logging })
end

set_vcr_config(mode)

if test_name
Expand All @@ -71,13 +76,17 @@ def run_tests(options={})
end
end

def set_runcible_config(auth_type)
if auth_type == "http"
Runcible::Base.config = {
:api_path => "/pulp/api/v2/",
:http_auth => {},
:logger => 'stdout'
}
def set_runcible_config(options)
Runcible::Base.config = {
:api_path => "/pulp/api/v2/",
:http_auth => {}
}

if options[:logging] == "true"
Runcible::Base.config[:logger] = 'stdout'
end

if options[:auth_type] == "http"

File.open('/etc/pulp/server.conf') do |f|
f.each_line do |line|
Expand All @@ -90,11 +99,7 @@ def set_runcible_config(auth_type)
end
end
end
elsif auth_type == "oauth"
Runcible::Base.config = {
:api_path => "/pulp/api/v2/",
:oauth => {}
}
elsif options[:auth_type] == "oauth"

File.open('/etc/pulp/server.conf') do |f|
f.each_line do |line|
Expand All @@ -109,6 +114,10 @@ def set_runcible_config(auth_type)
end
end
end
else
Runcible::Base.config[:http_auth][:password] = 'admin'
Runcible::Base.config[:user] = 'admin'
Runcible::Base.config[:url] = "https://localhost"
end
end

Expand Down
1 change: 0 additions & 1 deletion test/unit/test_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
require 'rubygems'
require 'minitest/autorun'
require 'minitest/mock'
require 'ruby-debug'
require './lib/runcible/base'


Expand Down

0 comments on commit 0c30bf0

Please sign in to comment.