Skip to content

Commit

Permalink
Merge pull request #110 from ekohl/acceptance-tests
Browse files Browse the repository at this point in the history
Add acceptance tests to CI
  • Loading branch information
bastelfreak authored Jan 14, 2022
2 parents 04cba7b + a6df44d commit 84cf3ba
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 49 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Test
on:
- pull_request

env:
BEAKER_HYPERVISOR: docker

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -27,3 +30,5 @@ jobs:
bundler-cache: true
- name: Verify gem builds
run: bundle exec gem build beaker-rspec.gemspec
- name: Run acceptance tests
run: bundle exec rake beaker
20 changes: 9 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,18 @@ def location_for(place, fake_version = nil)
end
end

beaker_version = ENV['BEAKER_VERSION']

if beaker_version
if (beaker_version = ENV['BEAKER_VERSION'])
gem 'beaker', *location_for(beaker_version)
else
gem 'beaker'
end

# For running the spec/acceptance/example_spec.rb
gem 'beaker-vagrant'

# Dependencies for CI acceptance testing; TODO: fix CI so this can be removed
gem 'beaker-hostgenerator'
gem 'beaker-vmpooler', '~> 1.3'
case ENV['BEAKER_HYPERVISOR']
when 'docker'
gem 'beaker-docker'
when 'vagrant', 'vagrant_libvirt'
gem 'beaker-vagrant'
when 'vmpooler'
gem 'beaker-vmpooler', '~> 1.3'
end

group :release do
gem 'github_changelog_generator', '>= 1.16.4', require: false if RUBY_VERSION >= '2.5'
Expand Down
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

task default: [:changelog]
require 'beaker-rspec/rake_task'

task default: :beaker

begin
require 'rubygems'
Expand Down
3 changes: 0 additions & 3 deletions beaker-rspec.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ Gem::Specification.new do |s|
s.add_development_dependency 'yard'
s.add_development_dependency 'thin'

# Dependency for example spec/acceptance tests
s.add_development_dependency 'beaker-pe'

# Run time dependencies
s.add_runtime_dependency 'beaker', '> 3.0'
s.add_runtime_dependency 'rspec', '~> 3.0'
Expand Down
28 changes: 0 additions & 28 deletions sample.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions spec/acceptance/example_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
self.hosts = hosts
end

example "access options hash" do
install_pe
example "use DSL method" do
echo_on hosts, 'Hello World!'
end

example "access the logger" do
Expand Down
5 changes: 1 addition & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# if you need DSL extension libraries, it appears that they have to be loaded before the RSpec shim
require "beaker-pe"

ENV['RS_SETFILE'] ||= 'sample.cfg'
ENV['RS_SETFILE'] ||= 'centos8-64'

require "beaker-rspec"

0 comments on commit 84cf3ba

Please sign in to comment.