control-repo/.onceover/spec/classes/role__custom_windows_on_RHEL-6.7_spec.rb
2020-05-22 10:43:42 +01:00

41 lines
12 KiB
Ruby

require 'spec_helper'
describe "role::custom_windows" do
context "using fact set RHEL-6.7" do
node_facts = {"aio_agent_version"=>"6.0.9", "architecture"=>"x86_64", "augeas"=>{"version"=>"1.11.0"}, "augeasversion"=>"1.11.0", "bios_release_date"=>"06/02/2017", "bios_vendor"=>"American Megatrends Inc.", "bios_version"=>"090007", "blockdevice_sda_model"=>"Virtual Disk", "blockdevice_sda_size"=>34359738368, "blockdevice_sda_vendor"=>"Msft", "blockdevice_sdb_model"=>"Virtual Disk", "blockdevice_sdb_size"=>53687091200, "blockdevice_sdb_vendor"=>"Msft", "blockdevice_sr0_model"=>"Virtual CD/ROM", "blockdevice_sr0_size"=>643072, "blockdevice_sr0_vendor"=>"Msft", "blockdevices"=>"sr0,sdb,sda", "boardmanufacturer"=>"Microsoft Corporation", "boardproductname"=>"Virtual Machine", "boardserialnumber"=>"0000-0010-9727-3914-2228-1494-64", "chassisassettag"=>"7783-7084-3265-9085-8269-3286-77", "chassistype"=>"Desktop", "dhcp_servers"=>{"eth0"=>"168.63.129.16", "system"=>"168.63.129.16"}, "disks"=>{"sda"=>{"model"=>"Virtual Disk", "size"=>"32.00 GiB", "size_bytes"=>34359738368, "vendor"=>"Msft"}, "sdb"=>{"model"=>"Virtual Disk", "size"=>"50.00 GiB", "size_bytes"=>53687091200, "vendor"=>"Msft"}, "sr0"=>{"model"=>"Virtual CD/ROM", "size"=>"628.00 KiB", "size_bytes"=>643072, "vendor"=>"Msft"}}, "dmi"=>{"bios"=>{"release_date"=>"06/02/2017", "vendor"=>"American Megatrends Inc.", "version"=>"090007"}, "board"=>{"manufacturer"=>"Microsoft Corporation", "product"=>"Virtual Machine", "serial_number"=>"0000-0010-9727-3914-2228-1494-64"}, "chassis"=>{"asset_tag"=>"7783-7084-3265-9085-8269-3286-77", "type"=>"Desktop"}, "manufacturer"=>"Microsoft Corporation", "product"=>{"name"=>"Virtual Machine", "serial_number"=>"0000-0016-4348-2410-5386-3288-39", "uuid"=>"723914E4-94CB-0743-9847-001D218884D8"}}, "domain"=>"104sjco4dnxe3mx0wbzfwnbl1h.gx.internal.cloudapp.net", "facterversion"=>"3.12.4", "filesystems"=>"ext4,iso9660,udf", "fips_enabled"=>false, "fqdn"=>"rhel6box.104sjco4dnxe3mx0wbzfwnbl1h.gx.internal.cloudapp.net", "gid"=>"root", "hardwareisa"=>"x86_64", "hardwaremodel"=>"x86_64", "hostname"=>"rhel6box", "hypervisors"=>{"hyperv"=>{}}, "id"=>"root", "identity"=>{"gid"=>0, "group"=>"root", "privileged"=>true, "uid"=>0, "user"=>"root"}, "interfaces"=>"eth0,lo", "ipaddress"=>"10.0.0.5", "ipaddress6"=>"fe80::20d:3aff:fe96:ed47", "ipaddress6_eth0"=>"fe80::20d:3aff:fe96:ed47", "ipaddress6_lo"=>"::1", "ipaddress_eth0"=>"10.0.0.5", "ipaddress_lo"=>"127.0.0.1", "is_virtual"=>true, "kernel"=>"Linux", "kernelmajversion"=>"2.6", "kernelrelease"=>"2.6.32-573.45.1.el6.x86_64", "kernelversion"=>"2.6.32", "load_averages"=>{"15m"=>0.06, "1m"=>0.15, "5m"=>0.14}, "lsbdistcodename"=>"Santiago", "lsbdistdescription"=>"Red Hat Enterprise Linux Server release 6.7 (Santiago)", "lsbdistid"=>"RedHatEnterpriseServer", "lsbdistrelease"=>"6.7", "lsbmajdistrelease"=>"6", "lsbminordistrelease"=>"7", "lsbrelease"=>":base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch", "macaddress"=>"00:0d:3a:96:ed:47", "macaddress_eth0"=>"00:0d:3a:96:ed:47", "manufacturer"=>"Microsoft Corporation", "memory"=>{"swap"=>{"available"=>"2.00 GiB", "available_bytes"=>2147479552, "capacity"=>"0%", "total"=>"2.00 GiB", "total_bytes"=>2147479552, "used"=>"0 bytes", "used_bytes"=>0}, "system"=>{"available"=>"7.55 GiB", "available_bytes"=>8103010304, "capacity"=>"3.24%", "total"=>"7.80 GiB", "total_bytes"=>8374747136, "used"=>"259.15 MiB", "used_bytes"=>271736832}}, "memoryfree"=>"7.55 GiB", "memoryfree_mb"=>7727.6328125, "memorysize"=>"7.80 GiB", "memorysize_mb"=>7986.78125, "mountpoints"=>{"/"=>{"available"=>"27.90 GiB", "available_bytes"=>29956210688, "capacity"=>"9.68%", "device"=>"/dev/sda2", "filesystem"=>"ext4", "options"=>["rw"], "size"=>"30.89 GiB", "size_bytes"=>33168420864, "used"=>"2.99 GiB", "used_bytes"=>3212210176}, "/boot"=>{"available"=>"402.87 MiB", "available_bytes"=>422435840, "capacity"=>"15.40%", "device"=>"/dev/sda1", "filesystem"=>"ext4", "options"=>["rw"], "size"=>"476.22 MiB", "size_bytes"=>499355648, "used"=>"73.36 MiB", "used_bytes"=>76919808}, "/dev/shm"=>{"available"=>"3.90 GiB", "available_bytes"=>4187373568, "capacity"=>"0%", "device"=>"tmpfs", "filesystem"=>"tmpfs", "options"=>["rw", "rootcontext=\"system_u:object_r:tmpfs_t:s0\""], "size"=>"3.90 GiB", "size_bytes"=>4187373568, "used"=>"0 bytes", "used_bytes"=>0}, "/mnt/resource"=>{"available"=>"47.04 GiB", "available_bytes"=>50506543104, "capacity"=>"4.18%", "device"=>"/dev/sdb1", "filesystem"=>"ext4", "options"=>["rw"], "size"=>"49.09 GiB", "size_bytes"=>52708372480, "used"=>"2.05 GiB", "used_bytes"=>2201829376}}, "mtu_eth0"=>1500, "mtu_lo"=>65536, "netmask"=>"255.255.255.0", "netmask6"=>"ffff:ffff:ffff:ffff::", "netmask6_eth0"=>"ffff:ffff:ffff:ffff::", "netmask6_lo"=>"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", "netmask_eth0"=>"255.255.255.0", "netmask_lo"=>"255.0.0.0", "network"=>"10.0.0.0", "network6"=>"fe80::", "network6_eth0"=>"fe80::", "network6_lo"=>"::1", "network_eth0"=>"10.0.0.0", "network_lo"=>"127.0.0.0", "networking"=>{"dhcp"=>"168.63.129.16", "domain"=>"104sjco4dnxe3mx0wbzfwnbl1h.gx.internal.cloudapp.net", "fqdn"=>"rhel6box.104sjco4dnxe3mx0wbzfwnbl1h.gx.internal.cloudapp.net", "hostname"=>"rhel6box", "interfaces"=>{"eth0"=>{"bindings"=>[{"address"=>"10.0.0.5", "netmask"=>"255.255.255.0", "network"=>"10.0.0.0"}], "bindings6"=>[{"address"=>"fe80::20d:3aff:fe96:ed47", "netmask"=>"ffff:ffff:ffff:ffff::", "network"=>"fe80::"}], "dhcp"=>"168.63.129.16", "ip"=>"10.0.0.5", "ip6"=>"fe80::20d:3aff:fe96:ed47", "mac"=>"00:0d:3a:96:ed:47", "mtu"=>1500, "netmask"=>"255.255.255.0", "netmask6"=>"ffff:ffff:ffff:ffff::", "network"=>"10.0.0.0", "network6"=>"fe80::"}, "lo"=>{"bindings"=>[{"address"=>"127.0.0.1", "netmask"=>"255.0.0.0", "network"=>"127.0.0.0"}], "bindings6"=>[{"address"=>"::1", "netmask"=>"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", "network"=>"::1"}], "ip"=>"127.0.0.1", "ip6"=>"::1", "mtu"=>65536, "netmask"=>"255.0.0.0", "netmask6"=>"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", "network"=>"127.0.0.0", "network6"=>"::1"}}, "ip"=>"10.0.0.5", "ip6"=>"fe80::20d:3aff:fe96:ed47", "mac"=>"00:0d:3a:96:ed:47", "mtu"=>1500, "netmask"=>"255.255.255.0", "netmask6"=>"ffff:ffff:ffff:ffff::", "network"=>"10.0.0.0", "network6"=>"fe80::", "primary"=>"eth0"}, "operatingsystem"=>"RedHat", "operatingsystemmajrelease"=>"6", "operatingsystemrelease"=>"6.7", "os"=>{"architecture"=>"x86_64", "distro"=>{"codename"=>"Santiago", "description"=>"Red Hat Enterprise Linux Server release 6.7 (Santiago)", "id"=>"RedHatEnterpriseServer", "release"=>{"full"=>"6.7", "major"=>"6", "minor"=>"7"}, "specification"=>":base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch"}, "family"=>"RedHat", "hardware"=>"x86_64", "name"=>"RedHat", "release"=>{"full"=>"6.7", "major"=>"6", "minor"=>"7"}, "selinux"=>{"config_mode"=>"enforcing", "current_mode"=>"enforcing", "enabled"=>true, "enforced"=>true, "policy_version"=>"24"}}, "osfamily"=>"RedHat", "partitions"=>{"/dev/sda1"=>{"filesystem"=>"ext4", "mount"=>"/boot", "size"=>"500.00 MiB", "size_bytes"=>524288000, "uuid"=>"ce2ad98e-bb9f-4603-abce-3db7fd857a6c"}, "/dev/sda2"=>{"filesystem"=>"ext4", "mount"=>"/", "size"=>"31.51 GiB", "size_bytes"=>33834401792, "uuid"=>"be4cc18d-b110-4914-a6f9-52dc0dc66f68"}, "/dev/sdb1"=>{"filesystem"=>"ext4", "mount"=>"/mnt/resource", "size"=>"50.00 GiB", "size_bytes"=>53684994048, "uuid"=>"aafc7ffe-f0b2-4872-8174-a05f24f6c3d4"}}, "path"=>"/sbin:/bin:/usr/sbin:/usr/bin", "physicalprocessorcount"=>1, "processor0"=>"Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", "processor1"=>"Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", "processorcount"=>2, "processors"=>{"count"=>2, "isa"=>"x86_64", "models"=>["Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz"], "physicalcount"=>1}, "productname"=>"Virtual Machine", "puppetversion"=>"6.0.9", "ruby"=>{"platform"=>"x86_64-linux", "sitedir"=>"/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.5.0", "version"=>"2.5.3"}, "rubyplatform"=>"x86_64-linux", "rubysitedir"=>"/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.5.0", "rubyversion"=>"2.5.3", "selinux"=>true, "selinux_config_mode"=>"enforcing", "selinux_current_mode"=>"enforcing", "selinux_enforced"=>true, "selinux_policyversion"=>"24", "serialnumber"=>"0000-0016-4348-2410-5386-3288-39", "ssh"=>{"dsa"=>{"fingerprints"=>{"sha1"=>"SSHFP 2 1 2e57bf0a973182ca91a3a9da9df2d332e55624ce", "sha256"=>"SSHFP 2 2 e2bbc2a273c58f32c9680300045705133d3efc571bda04798fc67b74463126cd"}, "key"=>"AAAAB3NzaC1kc3MAAACBAL//vXVYQWUZ0FmIEo76fECXpnTXBM5k9XpvJ/hHo+C9AAhkDz8OIPKW/mWjJWkux4nGASNKeHLaya+3Y9vtNZ/MdGw4ivJOR4rCCOfcPzuo3PbBsRE2gKaqc53F6/SwLufGPW2WF8deD6vgTs/OfklbK1evvPBSFAEYrGXlGyJPAAAAFQDY6orVttfPBu50B7OUA5k9ObNLaQAAAIBwX43NbThII85Bv6et0FdeQftDwoLNCTjBI0+DFNqxTVH/LO10fwqcdOMI1jAmmUSe0Dt+PpWQ1ZosK1UKN+hq3jWc84vxyL7l4KYigrvZJoKWvljazNN2unetwLUiPE4X2KL/CmTnXv/N9SeWsSnr86thNVRioQx+znoy8WZHOAAAAIEAkNIj1FhjzCMK4/f2Wg6tJHsW8wRwcGEzAymIj++aBYGPy5BI5Fa6kOcMEyJ+nl+8U3Mps+mJY5EYE/FvsinOrSJzFqowofABd7NgtoRLTGQyohBHP41+RPqXdPGDzPHHvOnuFP/vSKe+sgtJ6j6OqpddLPVybv/7EbylU9n1OpA=", "type"=>"ssh-dss"}, "rsa"=>{"fingerprints"=>{"sha1"=>"SSHFP 1 1 3c9465989548635bc20a034f98be3dd917074a7d", "sha256"=>"SSHFP 1 2 22cec87904c8057c2fa6b92e252b95496b678d042fe19d3f58332d67755bbb39"}, "key"=>"AAAAB3NzaC1yc2EAAAABIwAAAQEAuHC1qI3c48QrKuSLHo54im7OIGQyFL/KwoP4jig+LbIdduwmGMlXejZr+E3yb/RKvwQJGkGJ8HCLf8hyz0AmQf2690rXD7M3Ibq8Q3OrpteC46N3JbvnAFockJPLkMt3g/4sWTTmQbMStBAsfhaergAhXHp8x/xmqYnXtYWbKLyY1aFynWiyXx0omJLd3n0zCnDpEDTRlwn/LAwotK/b/lZ58RXJhafA5AbquKYANtg3png+FYX2MAWj75NXwY4h5dQGtMa8dWqWyZYE4Z9bzWFx4A6YAQPwyheKs4GWCU7dCDuiE4z6oZ3BMbfnfO4oX7bnmDtFRoE2GUElBi46Bw==", "type"=>"ssh-rsa"}}, "sshdsakey"=>"AAAAB3NzaC1kc3MAAACBAL//vXVYQWUZ0FmIEo76fECXpnTXBM5k9XpvJ/hHo+C9AAhkDz8OIPKW/mWjJWkux4nGASNKeHLaya+3Y9vtNZ/MdGw4ivJOR4rCCOfcPzuo3PbBsRE2gKaqc53F6/SwLufGPW2WF8deD6vgTs/OfklbK1evvPBSFAEYrGXlGyJPAAAAFQDY6orVttfPBu50B7OUA5k9ObNLaQAAAIBwX43NbThII85Bv6et0FdeQftDwoLNCTjBI0+DFNqxTVH/LO10fwqcdOMI1jAmmUSe0Dt+PpWQ1ZosK1UKN+hq3jWc84vxyL7l4KYigrvZJoKWvljazNN2unetwLUiPE4X2KL/CmTnXv/N9SeWsSnr86thNVRioQx+znoy8WZHOAAAAIEAkNIj1FhjzCMK4/f2Wg6tJHsW8wRwcGEzAymIj++aBYGPy5BI5Fa6kOcMEyJ+nl+8U3Mps+mJY5EYE/FvsinOrSJzFqowofABd7NgtoRLTGQyohBHP41+RPqXdPGDzPHHvOnuFP/vSKe+sgtJ6j6OqpddLPVybv/7EbylU9n1OpA=", "sshfp_dsa"=>"SSHFP 2 1 2e57bf0a973182ca91a3a9da9df2d332e55624ce\nSSHFP 2 2 e2bbc2a273c58f32c9680300045705133d3efc571bda04798fc67b74463126cd", "sshfp_rsa"=>"SSHFP 1 1 3c9465989548635bc20a034f98be3dd917074a7d\nSSHFP 1 2 22cec87904c8057c2fa6b92e252b95496b678d042fe19d3f58332d67755bbb39", "sshrsakey"=>"AAAAB3NzaC1yc2EAAAABIwAAAQEAuHC1qI3c48QrKuSLHo54im7OIGQyFL/KwoP4jig+LbIdduwmGMlXejZr+E3yb/RKvwQJGkGJ8HCLf8hyz0AmQf2690rXD7M3Ibq8Q3OrpteC46N3JbvnAFockJPLkMt3g/4sWTTmQbMStBAsfhaergAhXHp8x/xmqYnXtYWbKLyY1aFynWiyXx0omJLd3n0zCnDpEDTRlwn/LAwotK/b/lZ58RXJhafA5AbquKYANtg3png+FYX2MAWj75NXwY4h5dQGtMa8dWqWyZYE4Z9bzWFx4A6YAQPwyheKs4GWCU7dCDuiE4z6oZ3BMbfnfO4oX7bnmDtFRoE2GUElBi46Bw==", "swapfree"=>"2.00 GiB", "swapfree_mb"=>2047.99609375, "swapsize"=>"2.00 GiB", "swapsize_mb"=>2047.99609375, "system_uptime"=>{"days"=>0, "hours"=>0, "seconds"=>239, "uptime"=>"0:03 hours"}, "timezone"=>"EDT", "uptime"=>"0:03 hours", "uptime_days"=>0, "uptime_hours"=>0, "uptime_seconds"=>239, "uuid"=>"723914E4-94CB-0743-9847-001D218884D8", "virtual"=>"hyperv", "clientcert"=>"rhel6box.104sjco4dnxe3mx0wbzfwnbl1h.gx.internal.cloudapp.net", "clientversion"=>"6.0.9", "clientnoop"=>false}
let(:facts) { node_facts }
before :each do
# Curtrently there is some code within Puppet that will try to execute
# commands when compiling a catalog even though it shouldn't. One example is
# the groups attribute of the user resource on AIX. If we are running on
# Windows but pretending to be UNIX this will definitely fail so we need to
# mock it (or vice versa)
# Details:
# https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util/execution.rb#L191
expected_null_file = Puppet::Util::Platform.windows? ? 'NUL' : '/dev/null'
unless File.exist? expected_null_file
allow(Puppet::Util::Execution).to receive(:execute).and_raise(Puppet::ExecutionFailure.new("Onceover caused this"))
end
end
let(:pre_condition) {
pp = <<-'END'
$onceover_class = 'role::custom_windows'
$onceover_node = 'RHEL-6.7'
# Begin user-specified pre_condition
# End user-specified pre_condition
END
}
it { should compile }
end
end