Skip to content

Commit

Permalink
feat: remove shared param validation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
schustersv committed Dec 17, 2024
1 parent 8d41c36 commit 108df0b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 72 deletions.
10 changes: 7 additions & 3 deletions spec/classes/broker_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require 'spec_helper'
require 'shared_examples_param_validation'

describe 'kafka::broker', type: :class do
on_supported_os.each do |os, os_facts|
Expand All @@ -18,11 +17,18 @@
}
end

it { is_expected.to compile }
it { is_expected.to contain_class('kafka::broker::install').that_comes_before('Class[kafka::broker::config]') }
it { is_expected.to contain_class('kafka::broker::config').that_comes_before('Class[kafka::broker::service]') }
it { is_expected.to contain_class('kafka::broker::service').that_comes_before('Class[kafka::broker]') }
it { is_expected.to contain_class('kafka::broker') }

context 'with invalid mirror_url' do
let(:params) { { 'mirror_url' => 'invalid' } }

it { is_expected.not_to compile }
end

context 'with manage_log4j => true' do
let(:params) { { 'manage_log4j' => true } }

Expand Down Expand Up @@ -95,8 +101,6 @@
it { is_expected.not_to contain_file('/etc/systemd/system/kafka.service').with_notify('Service[kafka]') }
end
end

it_validates_parameter 'mirror_url'
end
end
end
10 changes: 7 additions & 3 deletions spec/classes/consumer_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require 'spec_helper'
require 'shared_examples_param_validation'

describe 'kafka::consumer', type: :class do
on_supported_os.each do |os, os_facts|
Expand All @@ -19,11 +18,18 @@
}
end

it { is_expected.to compile }
it { is_expected.to contain_class('kafka::consumer::install').that_comes_before('Class[kafka::consumer::config]') }
it { is_expected.to contain_class('kafka::consumer::config').that_comes_before('Class[kafka::consumer::service]') }
it { is_expected.to contain_class('kafka::consumer::service').that_comes_before('Class[kafka::consumer]') }
it { is_expected.to contain_class('kafka::consumer') }

context 'with invalid mirror_url' do
let(:params) { { 'mirror_url' => 'invalid' } }

it { is_expected.not_to compile }
end

context 'with manage_log4j => true' do
let(:params) { { 'manage_log4j' => true } }

Expand Down Expand Up @@ -55,8 +61,6 @@
it { is_expected.to contain_service('kafka-consumer') }
end
end

it_validates_parameter 'mirror_url'
end
end
end
10 changes: 7 additions & 3 deletions spec/classes/mirror_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require 'spec_helper'
require 'shared_examples_param_validation'

describe 'kafka::mirror', type: :class do
on_supported_os.each do |os, os_facts|
Expand All @@ -22,11 +21,18 @@
}
end

it { is_expected.to compile }
it { is_expected.to contain_class('kafka::mirror::install').that_comes_before('Class[kafka::mirror::config]') }
it { is_expected.to contain_class('kafka::mirror::config').that_comes_before('Class[kafka::mirror::service]') }
it { is_expected.to contain_class('kafka::mirror::service').that_comes_before('Class[kafka::mirror]') }
it { is_expected.to contain_class('kafka::mirror') }

context 'with invalid mirror_url' do
let(:params) { { 'mirror_url' => 'invalid' } }

it { is_expected.not_to compile }
end

context 'with manage_log4j => true' do
let(:params) { { 'manage_log4j' => true } }

Expand All @@ -52,8 +58,6 @@
it { is_expected.to contain_service('kafka-mirror') }
end
end

it_validates_parameter 'mirror_url'
end
end
end
1 change: 0 additions & 1 deletion spec/classes/producer_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require 'spec_helper'
require 'shared_examples_param_validation'

describe 'kafka::producer', type: :class do
on_supported_os.each do |os, os_facts|
Expand Down
62 changes: 0 additions & 62 deletions spec/shared_examples_param_validation.rb

This file was deleted.

0 comments on commit 108df0b

Please sign in to comment.