Skip to content

Commit

Permalink
Merge pull request #307 from pmbuko/init_provides_fix
Browse files Browse the repository at this point in the history
Fix init script parameter bug
  • Loading branch information
bastelfreak committed May 7, 2020
2 parents 5c79327 + 9b1448e commit 138f27b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
10 changes: 10 additions & 0 deletions spec/acceptance/broker_spec.rb
Expand Up @@ -204,6 +204,16 @@ class { 'kafka::broker':
it { is_expected.to contain 'export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:/tmp/log4j.properties"' }
end

describe file('/etc/init.d/kafka'), if: (fact('service_provider') == 'upstart' && fact('osfamily') == 'Debian') do
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'root' }
it { is_expected.to be_grouped_into 'root' }
it { is_expected.to contain %r{^# Provides:\s+kafka$} }
it { is_expected.to contain 'export KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote"' }
it { is_expected.to contain 'export KAFKA_HEAP_OPTS="-Xmx512M -Xmx512M"' }
it { is_expected.to contain 'export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:/tmp/log4j.properties"' }
end

describe file('/etc/systemd/system/kafka.service'), if: (fact('operatingsystemmajrelease') == '7' && fact('osfamily') == 'RedHat') do
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'root' }
Expand Down
9 changes: 9 additions & 0 deletions spec/acceptance/consumer_spec.rb
Expand Up @@ -140,6 +140,15 @@ class { 'kafka::consumer':
it { is_expected.to contain 'export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:/opt/kafka/config/log4j.properties"' }
end

describe file('/etc/init.d/kafka-consumer'), if: (fact('service_provider') == 'upstart' && fact('osfamily') == 'Debian') do
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'root' }
it { is_expected.to be_grouped_into 'root' }
it { is_expected.to contain %r{^# Provides:\s+kafka-consumer$} }
it { is_expected.to contain 'export KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=9993"' }
it { is_expected.to contain 'export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:/opt/kafka/config/log4j.properties"' }
end

describe file('/etc/systemd/system/kafka-consumer.service'), if: (fact('operatingsystemmajrelease') == '7' && fact('osfamily') == 'RedHat') do
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'root' }
Expand Down
9 changes: 9 additions & 0 deletions spec/acceptance/mirror_spec.rb
Expand Up @@ -218,6 +218,15 @@ class { 'kafka::mirror':
it { is_expected.to contain 'export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:/opt/kafka/config/log4j.properties"' }
end

describe file('/etc/init.d/kafka-mirror'), if: (fact('service_provider') == 'upstart' && fact('osfamily') == 'Debian') do
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'root' }
it { is_expected.to be_grouped_into 'root' }
it { is_expected.to contain %r{^# Provides:\s+kafka-mirror$} }
it { is_expected.to contain 'export KAFKA_JMX_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=9991"' }
it { is_expected.to contain 'export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:/opt/kafka/config/log4j.properties"' }
end

describe file('/etc/systemd/system/kafka-mirror.service'), if: (fact('operatingsystemmajrelease') == '7' && fact('osfamily') == 'RedHat') do
it { is_expected.to be_file }
it { is_expected.to be_owned_by 'root' }
Expand Down
4 changes: 4 additions & 0 deletions spec/acceptance/producer_spec.rb
Expand Up @@ -138,6 +138,10 @@ class { 'kafka::producer':
it { is_expected.to contain 'export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:/opt/kafka/config/log4j.properties"' }
end

describe file('/etc/init.d/kafka-producer'), if: (fact('service_provider') == 'upstart' && fact('osfamily') == 'Debian') do
it { is_expected.to contain %r{^# Provides:\s+kafka-producer$} }
end

describe service('kafka-producer') do
it { is_expected.to be_running }
it { is_expected.to be_enabled }
Expand Down
2 changes: 1 addition & 1 deletion templates/init.erb
Expand Up @@ -4,7 +4,7 @@
#
<%- if @osfamily == 'Debian' -%>
### BEGIN INIT INFO
# Provides: <%- @service_name -%>
# Provides: <%= @service_name %>
# Required-Start: <%= @service_requires.join(' ') %>
# Required-Stop:
# Default-Start: 2 3 4 5
Expand Down

0 comments on commit 138f27b

Please sign in to comment.