Skip to content

Commit

Permalink
Also run OSS specs during NON-OSS spec run (#1078)
Browse files Browse the repository at this point in the history
  • Loading branch information
kke authored and jakolehm committed Feb 27, 2019
1 parent 63f4b60 commit d1bf46e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pipeline:
- bundle install --path bundler
- bundle exec rubocop --fail-level A -S --format c --parallel
- bundle exec rspec spec/
- PHAROS_NON_OSS=true bundle exec rspec non-oss/spec/
- PHAROS_NON_OSS=true bundle exec rspec spec/ non-oss/spec/
test-shellcheck:
image: koalaman/shellcheck-alpine:latest
commands:
Expand Down
4 changes: 4 additions & 0 deletions lib/pharos/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ module Pharos
def self.version
VERSION + "+oss"
end

def self.oss?
true
end
end
4 changes: 4 additions & 0 deletions non-oss/pharos_pro/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ module Pharos
def self.version
VERSION
end

def self.oss?
false
end
end
2 changes: 1 addition & 1 deletion non-oss/spec/pharos_pro/commands/version_command_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe Pharos::VersionCommand do
describe Pharos::VersionCommand, unless: Pharos.oss? do
subject { described_class.new('') }

it 'outputs pharos version' do
Expand Down
11 changes: 7 additions & 4 deletions non-oss/spec/pharos_pro/phases/validate_version_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
require 'pharos/phases/validate_version'
require 'pharos_pro/phases/validate_version'
describe "Pharos::Phases::ValidateVersion", unless: Pharos.oss? do
before :all do
Pharos::Phases.send(:remove_const, :ValidateVersion) if Pharos::Phases.const_defined?(:ValidateVersion)
load File.expand_path(File.join(__dir__, '../../../../lib/pharos/phases/validate_version.rb'))
load File.expand_path(File.join(__dir__, '../../../pharos_pro/phases/validate_version.rb'))
end

describe Pharos::Phases::ValidateVersion do
let(:host) { Pharos::Configuration::Host.new(address: '192.0.2.1', role: 'master') }
let(:network_config) { {} }
let(:config) { Pharos::Config.new(hosts: [host]) }
subject { described_class.new(host, config: config) }
subject { Pharos::Phases::ValidateVersion.new(host, config: config) }

describe '#validate_version' do
it 'allows re-up for stable releases' do
Expand Down
9 changes: 6 additions & 3 deletions spec/pharos/phases/validate_version_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
require 'pharos/phases/validate_version'
describe "Pharos::Phases::ValidateVersion", if: Pharos.oss? do
before :all do
Pharos::Phases.send(:remove_const, :ValidateVersion) if Pharos::Phases.const_defined?(:ValidateVersion)
load File.expand_path(File.join(__dir__, '../../../lib/pharos/phases/validate_version.rb'))
end

describe Pharos::Phases::ValidateVersion do
let(:host) { Pharos::Configuration::Host.new(address: '192.0.2.1', role: 'master') }
let(:network_config) { {} }
let(:config) { Pharos::Config.new(hosts: [host]) }
let(:ssh) { instance_double(Pharos::Transport::SSH) }
let(:cluster_context) { Hash.new }
subject { described_class.new(host, config: config, cluster_context: cluster_context) }
subject { Pharos::Phases::ValidateVersion.new(host, config: config, cluster_context: cluster_context) }

before do
allow(host).to receive(:transport).and_return(ssh)
Expand Down
2 changes: 1 addition & 1 deletion spec/pharos/version_command_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe Pharos::VersionCommand do
describe Pharos::VersionCommand, if: Pharos.oss? do
subject { described_class.new('') }

it 'outputs version with +oss' do
Expand Down

0 comments on commit d1bf46e

Please sign in to comment.