Skip to content

Commit

Permalink
Use one operating system for most RSpec tests
Browse files Browse the repository at this point in the history
The majority of Puppet classes and defined types in this module do not
have behaviour which changes depending on the operating system. Mock one
operating system for most tests, except for collectd_init_spec when
mocking multiple operating systems makes sense.

This attempts to address #633 , and should reduce test runtimes
considerably with little change in the confidence of tests actually
picking up problems.
  • Loading branch information
juniorsysadmin committed Mar 31, 2018
1 parent 6f0ca7d commit 8517b1d
Show file tree
Hide file tree
Showing 88 changed files with 99 additions and 88 deletions.
2 changes: 1 addition & 1 deletion spec/classes/collectd_init_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os.each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_amqp_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::amqp', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_ceph_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::ceph', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_cgroups_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::cgroups', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_cpu_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::cpu', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_cuda_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::cuda', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_curl_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::curl', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_dbi_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::dbi', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_df_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::df', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_disk_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::disk', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_dns_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::dns', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_ethstat.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::ethstat', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_exec_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::exec', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_fhcount_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::fhcount', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_filecount_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::filecount', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_filter_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::filter', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_genericjmx_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::genericjmx', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
options = os_specific_options(facts)
let :facts do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_hddtemp_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::hddtemp', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_intel_pmu_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::intel_pmu', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_interface_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::interface', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_ipmi.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::ipmi', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
options = os_specific_options(facts)
let :facts do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_iptables_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::iptables', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_irq_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::irq', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_iscdhcp_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::cuda', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_java_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::java', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_load_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::load', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_logfile_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::logfile', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_memcached_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::memcached', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_memory_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::memory', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_mongodb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
end

on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_netlink_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::netlink', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_network_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::network', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_openldap_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::openldap', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_openvpn_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::openvpn', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_oracle_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::oracle', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
options = os_specific_options(facts)
let :facts do
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_ovs_events_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::ovs_events', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_ovs_stats_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::ovs_stats', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_ping_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::ping', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_postgresql_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::postgresql', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_processes_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::processes', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_protocols_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::protocols', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_python_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::python', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_rabbitmq_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::rabbitmq', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/collectd_plugin_redis_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'collectd::plugin::redis', type: :class do
on_supported_os(test_on).each do |os, facts|
on_supported_os(baseline_os_hash).each do |os, facts|
context "on #{os} " do
let :facts do
facts
Expand Down
Loading

0 comments on commit 8517b1d

Please sign in to comment.