diff --git a/.kitchen.docker.yml b/.kitchen.docker.yml index efb391b8..670a8edf 100644 --- a/.kitchen.docker.yml +++ b/.kitchen.docker.yml @@ -38,18 +38,3 @@ suites: log_dirs: ['/mnt/kafka-logs-1', '/mnt/kafka-logs-2'] zookeeper_connect: ['localhost:2181'] zookeeper_connection_timeout_ms: 15_000 - - name: source-init-style-sysv - run_list: - - recipe[java::default] - - recipe[kafka::default] - attributes: - kafka: - version: <%= ENV.fetch('KAFKA_VERSION', '0.8.1.1') %> - install_method: 'source' - checksum: <%= ENV.fetch('KAFKA_CHECKSUM', nil) %> - md5_checksum: <%= ENV.fetch('KAFKA_MD5', nil) %> - broker: - controlled_shutdown_enable: <%= ENV.fetch('KAFKA_CTRL_SHUTDOWN', nil) %> - log_dirs: ['/mnt/kafka-logs-1', '/mnt/kafka-logs-2'] - zookeeper_connect: ['localhost:2181'] - zookeeper_connection_timeout_ms: 15_000 diff --git a/.kitchen.yml b/.kitchen.yml index 955ce929..506a874e 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -89,62 +89,3 @@ suites: log_dirs: ['/mnt/kafka-logs-1', '/mnt/kafka-logs-2'] zookeeper_connect: ['localhost:2181'] zookeeper_connection_timeout_ms: 15_000 - - name: source-init-style-upstart - run_list: - - recipe[java::default] - - recipe[kafka::default] - excludes: - - centos-6.5 - - centos-7.0 - - debian-7.4 - - fedora-20 - attributes: - kafka: - install_method: 'source' - init_style: 'upstart' - version: <%= ENV.fetch('KAFKA_VERSION', '0.8.1.1') %> - checksum: <%= ENV.fetch('KAFKA_CHECKSUM', '""') %> - md5_checksum: <%= ENV.fetch('KAFKA_MD5', '""') %> - broker: - controlled_shutdown_enable: <%= ENV.fetch('KAFKA_CTRL_SHUTDOWN', nil) %> - log_dirs: ['/mnt/kafka-logs-1', '/mnt/kafka-logs-2'] - ulimit_file: 128000 - zookeeper_connect: ['localhost:2181'] - zookeeper_connection_timeout_ms: 15_000 - - name: source-init-style-sysv - run_list: - - recipe[java::default] - - recipe[kafka::default] - excludes: - - centos-7.0 - attributes: - kafka: - install_method: 'source' - version: <%= ENV.fetch('KAFKA_VERSION', '0.8.1.1') %> - checksum: <%= ENV.fetch('KAFKA_CHECKSUM', '""') %> - md5_checksum: <%= ENV.fetch('KAFKA_MD5', '""') %> - broker: - controlled_shutdown_enable: <%= ENV.fetch('KAFKA_CTRL_SHUTDOWN', nil) %> - log_dirs: ['/mnt/kafka-logs-1', '/mnt/kafka-logs-2'] - ulimit_file: 128000 - zookeeper_connect: ['localhost:2181'] - zookeeper_connection_timeout_ms: 15_000 - - name: source-init-style-systemd - run_list: - - recipe[java::default] - - recipe[kafka::default] - includes: - - fedora-20 - - centos-7.0 - attributes: - kafka: - install_method: 'source' - init_style: 'systemd' - version: <%= ENV.fetch('KAFKA_VERSION', '0.8.1.1') %> - checksum: <%= ENV.fetch('KAFKA_CHECKSUM', '""') %> - md5_checksum: <%= ENV.fetch('KAFKA_MD5', '""') %> - broker: - controlled_shutdown_enable: <%= ENV.fetch('KAFKA_CTRL_SHUTDOWN', nil) %> - log_dirs: ['/mnt/kafka-logs-1', '/mnt/kafka-logs-2'] - zookeeper_connect: ['localhost:2181'] - zookeeper_connection_timeout_ms: 15_000 diff --git a/README.md b/README.md index 75b22abb..52fe6ac9 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ Installs Kafka `v0.8.1.1`, and probably any newer versions. Based on the Kafka cookbook released by WebTrends (thanks!), but with a few notable differences: -* supports both source and binary releases. * does not depend on runit cookbook. * does not depend on zookeeper cookbook, thus it will not search for nodes with a specific role or such, that is left up to you to decide. @@ -64,16 +63,6 @@ This section describes the different recipes that are available. ### default -Includes either `source` or `binary` recipe depending on what -`node.kafka.install_method` is set to (`:source, :binary`). - -### source - -Downloads, compiles and installs Kafka from the official source releases. -Defaults to installing `v0.8.1.1` of Kafka. - -### binary - Downloads and installs Kafka from the official binary releases. Defaults to installing `v0.8.1.1` of Kafka. diff --git a/attributes/default.rb b/attributes/default.rb index 6572c3a7..5be0edf8 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -26,10 +26,6 @@ # Scala version of Kafka. default.kafka.scala_version = '2.9.2' -# -# Decides how to install Kafka, valid values are currently :binary and :source. -default.kafka.install_method = :binary - # # Directory where to install Kafka. default.kafka.install_dir = '/opt/kafka' diff --git a/libraries/helpers.rb b/libraries/helpers.rb index 77317f97..28e684f7 100644 --- a/libraries/helpers.rb +++ b/libraries/helpers.rb @@ -7,20 +7,8 @@ def kafka_base %(kafka_#{node.kafka.scala_version}-#{node.kafka.version}) end -def kafka_src - %(kafka-#{node.kafka.version}-src) -end - def kafka_target_path - if kafka_binary_install? - ::File.join(node.kafka.build_dir, kafka_base) - else - if kafka_v0_8_0? - ::File.join(node.kafka.build_dir, kafka_src, 'target', 'RELEASE', kafka_base) - else - ::File.join(node.kafka.build_dir, kafka_src, 'core', 'build', 'distributions', kafka_base) - end - end + ::File.join(node.kafka.build_dir, kafka_base) end def kafka_jar_path @@ -40,37 +28,21 @@ def kafka_download_uri(filename) end def kafka_archive_ext - if kafka_v0_8_0? && kafka_binary_install? + if kafka_v0_8_0? 'tar.gz' else 'tgz' end end -def kafka_build_command - if kafka_v0_8_0? - %(./sbt update && ./sbt "++#{node.kafka.scala_version} release-zip") - else - %(./gradlew -PscalaVersion=#{node.kafka.scala_version} releaseTarGz -x signArchives) - end -end - def kafka_v0_8_0? node.kafka.version == '0.8.0' end -def kafka_install_method - node.kafka.install_method.to_sym -end - def kafka_init_style node.kafka.init_style.to_sym end -def kafka_binary_install? - kafka_install_method == :binary -end - def kafka_init_opts @kafka_init_opts ||= Hash.new.tap do |opts| case kafka_init_style diff --git a/recipes/binary.rb b/recipes/_install.rb similarity index 97% rename from recipes/binary.rb rename to recipes/_install.rb index b854ed65..1a29febc 100644 --- a/recipes/binary.rb +++ b/recipes/_install.rb @@ -1,6 +1,6 @@ # # Cookbook Name:: kafka -# Recipe:: binary +# Recipe:: _install # kafka_tar_gz = [kafka_base, kafka_archive_ext].join('.') diff --git a/recipes/default.rb b/recipes/default.rb index d027b112..ceebd7eb 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -3,12 +3,7 @@ # Recipe:: default # -case kafka_install_method -when :source, :binary - include_recipe 'kafka::_defaults' - include_recipe 'kafka::_setup' - include_recipe 'kafka::%s' % node.kafka.install_method - include_recipe 'kafka::_configure' -else - Chef::Application.fatal!('Unknown install_method: %s' % node.kafka.install_method.inspect) -end +include_recipe 'kafka::_defaults' +include_recipe 'kafka::_setup' +include_recipe 'kafka::_install' +include_recipe 'kafka::_configure' diff --git a/recipes/source.rb b/recipes/source.rb deleted file mode 100644 index e3d9f0e2..00000000 --- a/recipes/source.rb +++ /dev/null @@ -1,35 +0,0 @@ -# -# Cookbook Name:: kafka -# Recipe:: source -# - -kafka_tar_gz = [kafka_src, kafka_archive_ext].join('.') -local_file_path = ::File.join(Chef::Config.file_cache_path, kafka_tar_gz) - -kafka_download local_file_path do - source kafka_download_uri(kafka_tar_gz) - checksum node.kafka.checksum - md5_checksum node.kafka.md5_checksum - not_if { kafka_installed? } -end - -execute 'compile-kafka' do - cwd node.kafka.build_dir - command <<-EOH.gsub(/^\s+/, '') - tar zxf #{local_file_path} && \ - cd #{kafka_src} && \ - #{kafka_build_command} - EOH - not_if { kafka_installed? } -end - -execute 'extract-kafka' do - cwd ::File.dirname(kafka_target_path) - command %(tar zxf #{kafka_base}.#{kafka_archive_ext}) - only_if { !kafka_installed? && !kafka_v0_8_0? } -end - -kafka_install node.kafka.install_dir do - from kafka_target_path - not_if { kafka_installed? } -end diff --git a/spec/recipes/default_spec.rb b/spec/recipes/default_spec.rb index eacf4cca..8f3ba5b3 100644 --- a/spec/recipes/default_spec.rb +++ b/spec/recipes/default_spec.rb @@ -3,72 +3,23 @@ require 'spec_helper' describe 'kafka::default' do - TerminatedExecutionError = Class.new(StandardError) - let :chef_run do - ChefSpec::Runner.new do |node| - node.set[:kafka][:install_method] = install_method - end.converge(described_recipe) - end - - shared_examples_for 'a valid install method' do - it 'includes kafka::_setup' do - expect(chef_run).to include_recipe('kafka::_setup') - end - - it 'includes kafka::install_method recipe' do - expect(chef_run).to include_recipe(%(kafka::#{install_method})) - end - - it 'includes kafka::_configure' do - expect(chef_run).to include_recipe('kafka::_configure') - end + ChefSpec::Runner.new.converge(described_recipe) end - context 'when node.kafka.install_method equals :source' do - it_behaves_like 'a valid install method' do - let :install_method do - :source - end - end + it 'includes kafka::_defaults' do + expect(chef_run).to include_recipe('kafka::_defaults') end - context 'when node.kafka.install_method equals \'source\'' do - it_behaves_like 'a valid install method' do - let :install_method do - 'source' - end - end + it 'includes kafka::_setup' do + expect(chef_run).to include_recipe('kafka::_setup') end - context 'when node.kafka.install_method equals :binary' do - it_behaves_like 'a valid install method' do - let :install_method do - :binary - end - end + it 'includes kafka::_install recipe' do + expect(chef_run).to include_recipe('kafka::_install') end - context 'when node.kafka.install_method equals \'binary\'' do - it_behaves_like 'a valid install method' do - let :install_method do - 'binary' - end - end - end - - context 'when node.kafka.install_method is something else' do - let :install_method do - :bork - end - - before do - allow(Chef::Application).to receive(:fatal!).and_raise(TerminatedExecutionError) - end - - it 'terminates the chef run' do - expect { chef_run.converge(described_recipe) }.to raise_error(TerminatedExecutionError) - expect(Chef::Application).to have_received(:fatal!).with(/Unknown install_method: :bork/).once - end + it 'includes kafka::_configure' do + expect(chef_run).to include_recipe('kafka::_configure') end end diff --git a/spec/recipes/binary_spec.rb b/spec/recipes/install_spec.rb similarity index 91% rename from spec/recipes/binary_spec.rb rename to spec/recipes/install_spec.rb index e544d111..4f3f7cf7 100644 --- a/spec/recipes/binary_spec.rb +++ b/spec/recipes/install_spec.rb @@ -2,11 +2,10 @@ require 'spec_helper' -describe 'kafka::binary' do +describe 'kafka::_install' do let :chef_run do - ChefSpec::Runner.new(step_into: %w(kafka_download kafka_install)) do |node| - node.set[:kafka][:install_method] = :binary - end.converge(described_recipe) + r = ChefSpec::Runner.new(step_into: %w(kafka_download kafka_install)) + r.converge(described_recipe) end it 'downloads remote binary release of Kafka' do diff --git a/spec/recipes/source_spec.rb b/spec/recipes/source_spec.rb deleted file mode 100644 index 73288576..00000000 --- a/spec/recipes/source_spec.rb +++ /dev/null @@ -1,93 +0,0 @@ -# encoding: utf-8 - -require 'spec_helper' - -describe 'kafka::source' do - let :chef_run do - ChefSpec::Runner.new(step_into: %w(kafka_download kafka_install)) do |node| - node.set[:kafka][:install_method] = :source - end.converge(described_recipe) - end - - it 'downloads remote source release of Kafka' do - expect(chef_run).to create_kafka_download(%(#{Chef::Config[:file_cache_path]}/kafka-0.8.1.1-src.tgz)) - expect(chef_run).to create_remote_file(%(#{Chef::Config[:file_cache_path]}/kafka-0.8.1.1-src.tgz)) - end - - it 'validates download' do - expect(chef_run).not_to run_ruby_block('kafka-validate-download') - - remote_file = chef_run.remote_file(%(#{Chef::Config[:file_cache_path]}/kafka-0.8.1.1-src.tgz)) - expect(remote_file).to notify('ruby_block[kafka-validate-download]').immediately - end - - context 'compilation of Kafka source' do - let :chef_run do - ChefSpec::Runner.new do |node| - node.set[:kafka][:install_method] = :source - node.set[:kafka][:version] = kafka_version - end.converge(described_recipe) - end - - let :compile_command do - chef_run.execute('compile-kafka').command - end - - context 'when version is 0.8.0' do - let :kafka_version do - '0.8.0' - end - - it 'downloads kafka' do - expect(chef_run).to create_kafka_download(%(#{Chef::Config[:file_cache_path]}/kafka-0.8.0-src.tgz)) - end - - it 'runs execute block' do - expect(chef_run).to run_execute('compile-kafka').with_cwd(%(#{Chef::Config[:file_cache_path]}/kafka-build)) - end - - it 'uses sbt' do - expect(compile_command).to include './sbt update' - expect(compile_command).to match /\.\/sbt .+ release-zip/ - end - end - - context 'when version is 0.8.1' do - let :kafka_version do - '0.8.1' - end - - it 'downloads kafka' do - expect(chef_run).to create_kafka_download(%(#{Chef::Config[:file_cache_path]}/kafka-0.8.1-src.tgz)) - end - - it 'runs execute block' do - expect(chef_run).to run_execute('compile-kafka').with_cwd(%(#{Chef::Config[:file_cache_path]}/kafka-build)) - end - - it 'uses gradle' do - expect(compile_command).to match /\.\/gradlew .+ releaseTarGz -x signArchives/ - end - end - - context 'when version is 0.8.1.1' do - let :kafka_version do - '0.8.1.1' - end - - it 'runs execute block' do - expect(chef_run).to run_execute('compile-kafka').with_cwd(%(#{Chef::Config[:file_cache_path]}/kafka-build)) - end - - it 'uses gradle' do - expect(compile_command).to match /\.\/gradlew .+ releaseTarGz -x signArchives/ - end - end - end - - it 'installs compiled Kafka source' do - expect(chef_run).to run_kafka_install('/opt/kafka') - expect(chef_run).to run_execute('install-kafka') - expect(chef_run).to run_execute('remove-kafka-build') - end -end diff --git a/test/integration/source-init-style-sysv/serverspec/localhost/required_files_spec.rb b/test/integration/source-init-style-sysv/serverspec/localhost/required_files_spec.rb deleted file mode 100644 index fc20d06b..00000000 --- a/test/integration/source-init-style-sysv/serverspec/localhost/required_files_spec.rb +++ /dev/null @@ -1,57 +0,0 @@ -# encoding: utf-8 - -require 'spec_helper' - -describe 'required files for sysv init style' do - describe 'environment file' do - let :env_file do - file path - end - - let :path do - if debian? || ubuntu? - '/etc/default/kafka' - else - '/etc/sysconfig/kafka' - end - end - - it 'exists' do - expect(env_file).to be_a_file - end - - it 'is owned by root' do - expect(env_file).to be_owned_by 'root' - end - - it 'belongs to the root group' do - expect(env_file).to be_grouped_into 'root' - end - - it 'has 644 permissions' do - expect(env_file).to be_mode 644 - end - end - - describe 'init script' do - let :init_file do - file '/etc/init.d/kafka' - end - - it 'exists' do - expect(init_file).to be_a_file - end - - it 'is owned by root' do - expect(init_file).to be_owned_by 'root' - end - - it 'belongs to the root group' do - expect(init_file).to be_grouped_into 'root' - end - - it 'has 755 permissions' do - expect(init_file).to be_mode 755 - end - end -end diff --git a/test/integration/source-init-style-sysv/serverspec/localhost/service_spec.rb b/test/integration/source-init-style-sysv/serverspec/localhost/service_spec.rb deleted file mode 100644 index 6ae96fce..00000000 --- a/test/integration/source-init-style-sysv/serverspec/localhost/service_spec.rb +++ /dev/null @@ -1,146 +0,0 @@ -# encoding: utf-8 - -require 'spec_helper' -require 'support/service_common' - -describe 'service for sysv init style' do - include_context 'service setup' - - describe 'service kafka start' do - context 'when kafka is not already running' do - before do - backend.run_command 'service kafka stop 2> /dev/null || true' - end - - it 'is not actually running' do - expect(kafka_service).not_to be_running - end - - it 'prints a message about starting kafka' do - expect(start_command).to return_stdout /starting.+kafka/i - end - - it 'exits with status 0' do - expect(start_command).to return_exit_status 0 - end - - it 'actually starts kafka' do - backend.run_command 'service kafka start' - - expect(kafka_service).to be_running - end - - it_behaves_like 'a kafka start command' - end - - context 'when kafka is already running' do - before do - backend.run_command 'service kafka start 2> /dev/null || true' - end - - it 'is actually running' do - expect(kafka_service).to be_running - end - - it 'prints a message about starting kafka' do - expect(start_command).to return_stdout /starting.+kafka/i - end - - it 'exits with status 0' do - expect(start_command).to return_exit_status 0 - end - - it_behaves_like 'a kafka start command' - end - end - - describe 'service kafka stop' do - context 'when kafka is running' do - before do - backend.run_command 'service kafka start 2> /dev/null || true' - end - - it 'is actually running' do - expect(kafka_service).to be_running - end - - it 'prints a message about stopping kafka' do - expect(stop_command).to return_stdout /stopping.+kafka/i - end - - it 'exits with status 0' do - expect(stop_command).to return_exit_status 0 - end - - it 'stops kafka' do - backend.run_command 'service kafka stop' - - expect(kafka_service).not_to be_running - end - - it_behaves_like 'a kafka stop command' - end - - context 'when kafka is not running' do - before do - backend.run_command 'service kafka stop 2> /dev/null || true' - end - - it 'is actually not running' do - expect(kafka_service).not_to be_running - end - - it 'prints a message about stopping kafka' do - expect(stop_command).to return_stdout /stopping.+kafka/i - end - - it 'exits with status 0' do - expect(stop_command).to return_exit_status 0 - end - - it_behaves_like 'a kafka stop command' - end - end - - describe 'service kafka status' do - context 'when kafka is running' do - before do - backend.run_command 'service kafka start 2> /dev/null || true' - end - - it 'exits with status 0' do - expect(status_command).to return_exit_status 0 - end - - it 'prints a message that kafka is running' do - if fedora? - expect(status_command).to return_stdout /Active: active \(running\)/ - expect(status_command).to return_stdout /Started SYSV: kafka daemon/ - else - expect(status_command).to return_stdout /kafka.+running/i - end - end - end - - context 'when kafka is not running' do - before do - backend.run_command 'service kafka stop 2> /dev/null || true' - end - - it 'exits with status 3' do - expect(status_command).to return_exit_status 3 - end - - it 'prints a message that kafka is not running / stopped' do - if debian? || ubuntu? - expect(status_command).to return_stdout /kafka is not running/ - elsif fedora? - expect(status_command).to return_stdout /Active: failed/ - expect(status_command).to return_stdout /Stopped SYSV: kafka daemon/ - else - expect(status_command).to return_stdout /kafka is stopped/ - end - end - end - end -end diff --git a/test/integration/source-init-style-sysv/serverspec/localhost/source_spec.rb b/test/integration/source-init-style-sysv/serverspec/localhost/source_spec.rb deleted file mode 100644 index 97d0b20b..00000000 --- a/test/integration/source-init-style-sysv/serverspec/localhost/source_spec.rb +++ /dev/null @@ -1,8 +0,0 @@ -# encoding: utf-8 - -require 'spec_helper' -require 'support/install_common' - -describe 'kafka::source' do - it_behaves_like 'an install method' -end diff --git a/test/integration/source-init-style-upstart/serverspec/localhost/required_files_spec.rb b/test/integration/source-init-style-upstart/serverspec/localhost/required_files_spec.rb deleted file mode 100644 index b36259c4..00000000 --- a/test/integration/source-init-style-upstart/serverspec/localhost/required_files_spec.rb +++ /dev/null @@ -1,49 +0,0 @@ -# encoding: utf-8 - -require 'spec_helper' - -describe 'required files for upstart init style' do - describe 'environment file' do - let :env_file do - file '/etc/default/kafka' - end - - it 'exists' do - expect(env_file).to be_a_file - end - - it 'is owned by root' do - expect(env_file).to be_owned_by 'root' - end - - it 'belongs to the root group' do - expect(env_file).to be_grouped_into 'root' - end - - it 'has 644 permissions' do - expect(env_file).to be_mode 644 - end - end - - describe 'init configuration' do - let :init_file do - file '/etc/init/kafka.conf' - end - - it 'exists' do - expect(init_file).to be_a_file - end - - it 'is owned by root' do - expect(init_file).to be_owned_by 'root' - end - - it 'belongs to the root group' do - expect(init_file).to be_grouped_into 'root' - end - - it 'has 644 permissions' do - expect(init_file).to be_mode 644 - end - end -end diff --git a/test/integration/source-init-style-upstart/serverspec/localhost/service_spec.rb b/test/integration/source-init-style-upstart/serverspec/localhost/service_spec.rb deleted file mode 100644 index 0a02b11a..00000000 --- a/test/integration/source-init-style-upstart/serverspec/localhost/service_spec.rb +++ /dev/null @@ -1,134 +0,0 @@ -# encoding: utf-8 - -require 'spec_helper' -require 'support/service_common' - -describe 'service for upstart init style' do - include_context 'service setup' - - describe 'service kafka start' do - context 'when kafka is not already running' do - before do - backend.run_command 'service kafka stop 2> /dev/null || true' - end - - it 'is not already running' do - expect(kafka_service).not_to be_running - end - - it 'prints a message about starting kafka' do - expect(start_command).to return_stdout /kafka start\/running, process \d+/ - end - - it 'exits with status 0' do - expect(start_command).to return_exit_status 0 - end - - it 'actually starts kafka' do - backend.run_command 'service kafka start' - - expect(kafka_service).to be_running - end - - it_behaves_like 'a kafka start command' - end - - context 'when kafka is already running' do - before do - backend.run_command 'service kafka start 2> /dev/null || true' - end - - it 'is actually already running' do - expect(kafka_service).to be_running - end - - it 'prints a message that kafka is already running' do - expect(start_command).to return_stdout /already running: kafka/ - end - - it 'exits with status 1' do - expect(start_command).to return_exit_status 1 - end - - it_behaves_like 'a kafka start command' - end - end - - describe 'service kafka stop' do - context 'when kafka is running' do - before do - backend.run_command 'service kafka start 2> /dev/null || true' - end - - it 'is actaully already running' do - expect(kafka_service).to be_running - end - - it 'prints a message about stopping kafka' do - expect(stop_command).to return_stdout /kafka stop\/waiting/ - end - - it 'exits with status 0' do - expect(stop_command).to return_exit_status 0 - end - - it 'actually stops kafka' do - backend.run_command 'service kafka stop' - - expect(kafka_service).not_to be_running - end - - it_behaves_like 'a kafka stop command' - end - - context 'when kafka is not running' do - before do - backend.run_command 'service kafka stop 2> /dev/null || true' - end - - it 'is not running' do - expect(kafka_service).not_to be_running - end - - it 'prints a message that kafka is stopped' do - expect(stop_command).to return_stdout /stop: Unknown instance:/ - end - - it 'exits with status 1' do - expect(stop_command).to return_exit_status 1 - end - - it_behaves_like 'a kafka stop command' - end - end - - describe 'service kafka status' do - context 'when kafka is running' do - before do - backend.run_command 'service kafka restart 2> /dev/null || true' - end - - it 'exits with status 0' do - expect(status_command).to return_exit_status 0 - end - - it 'prints a message that kafka is running' do - expect(status_command).to return_stdout /kafka start\/running, process \d+/ - end - end - - context 'when kafka is not running' do - before do - backend.run_command 'service kafka stop 2> /dev/null || true' - end - - it 'exits with status 0' do - expect(status_command).to return_exit_status 0 - end - - it 'prints a message that kafka is stopped' do - expect(status_command).to return_stdout /kafka stop\/waiting/ - end - end - end -end diff --git a/test/integration/source-init-style-upstart/serverspec/localhost/source_spec.rb b/test/integration/source-init-style-upstart/serverspec/localhost/source_spec.rb deleted file mode 100644 index 97d0b20b..00000000 --- a/test/integration/source-init-style-upstart/serverspec/localhost/source_spec.rb +++ /dev/null @@ -1,8 +0,0 @@ -# encoding: utf-8 - -require 'spec_helper' -require 'support/install_common' - -describe 'kafka::source' do - it_behaves_like 'an install method' -end