Remove the unit test added for Ubuntu using older version i.e 15.04.

Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
This commit is contained in:
Vasu1105 2021-09-29 12:15:39 +05:30
parent eb9a12d501
commit fe555a3780
7 changed files with 20 additions and 32 deletions

View file

@ -19,9 +19,9 @@ class MockLoader
macos10_10: { name: "mac_os_x", family: "darwin", release: "10.10.4", arch: nil },
macos10_16: { name: "darwin", family: "darwin", release: "10.16", arch: nil },
ubuntu1404: { name: "ubuntu", family: "debian", release: "14.04", arch: "x86_64" },
ubuntu1504: { name: "ubuntu", family: "debian", release: "15.04", arch: "x86_64" },
ubuntu1604: { name: "ubuntu", family: "debian", release: "16.04", arch: "x86_64" },
ubuntu1804: { name: "ubuntu", family: "debian", release: "18.04", arch: "x86_64" },
ubuntu: { name: "ubuntu", family: "debian", release: "20.04", arch: "x86_64" },
mint17: { name: "linuxmint", family: "debian", release: "17.3", arch: "x86_64" },
mint18: { name: "linuxmint", family: "debian", release: "18", arch: "x86_64" },
windows: { name: "windows", family: "windows", release: "6.2.9200", arch: "x86_64" },
@ -176,21 +176,10 @@ class MockLoader
"/etc/postfix/main.cf" => mockfile.call("main.cf"),
"/etc/postfix/other.cf" => mockfile.call("other.cf"),
"/etc/selinux/selinux_conf" => mockfile.call("selinux_conf"),
"/etc/apache2/apache2.conf" => mockfile.call("apache2.conf"),
"/etc/test-serverroot/apache2/apache2.conf" => mockfile.call("apache2_server_root_void.conf"),
}
if @platform
if @platform[:name] == "ubuntu" && @platform[:release] == "18.04"
mock_files.merge!(
"/etc/apache2/apache2.conf" => mockfile.call("apache2.conf")
)
elsif @platform[:name] == "ubuntu" && @platform[:release] == "15.04"
# using this ubuntu version to test apache_conf with non configured server root in conf file
mock_files.merge!(
"/etc/apache2/apache2.conf" => mockfile.call("apache2_server_root_void.conf")
)
end
end
mock.files = mock_files
# create all mock commands

View file

@ -6,7 +6,7 @@ require "hashie"
describe "Inspec::Resources::ApacheConf" do
# debian style apache2
it "reads values in apache2.conf and from Include, IncludeOptional params" do
resource = MockLoader.new(:ubuntu1804).load_resource("apache_conf",
resource = MockLoader.new(:ubuntu).load_resource("apache_conf",
"/etc/apache2/apache2.conf")
_(resource.params).must_be_kind_of Hash
_(resource.content).must_be_kind_of String
@ -22,7 +22,7 @@ describe "Inspec::Resources::ApacheConf" do
end
it "reads values successfully from apache2.conf and ignores Include, IncludeOptional params when server root is not configured" do
resource = MockLoader.new(:ubuntu1504).load_resource("apache_conf", "/etc/apache2/apache2.conf")
resource = MockLoader.new(:ubuntu).load_resource("apache_conf", "/etc/test-serverroot/apache2/apache2.conf")
_(resource.params).must_be_kind_of Hash
_(resource.content).must_be_kind_of String
_(resource.params("ServerAlias")).must_equal ["inspec.test www.inspec.test io.inspec.test"]

View file

@ -5,19 +5,19 @@ require "inspec/resources/apt"
describe "Inspec::Resources::AptRepo" do
it "check apt on ubuntu" do
resource = MockLoader.new(:ubuntu1504).load_resource("apt", "http://archive.ubuntu.com/ubuntu/")
resource = MockLoader.new(:ubuntu).load_resource("apt", "http://archive.ubuntu.com/ubuntu/")
_(resource.exists?).must_equal true
_(resource.enabled?).must_equal true
end
it "check apt on ubuntu with ppa" do
resource = MockLoader.new(:ubuntu1504).load_resource("apt", "ubuntu-wine/ppa")
resource = MockLoader.new(:ubuntu).load_resource("apt", "ubuntu-wine/ppa")
_(resource.exists?).must_equal true
_(resource.enabled?).must_equal true
end
it "check apt on ubuntu with ppa" do
resource = MockLoader.new(:ubuntu1504).load_resource("apt", "ppa:ubuntu-wine/ppa")
resource = MockLoader.new(:ubuntu).load_resource("apt", "ppa:ubuntu-wine/ppa")
_(resource.exists?).must_equal true
_(resource.enabled?).must_equal true
end

View file

@ -28,10 +28,10 @@ describe "Inspec::Resources::Os" do
end
it "verify os parsing on Ubuntu" do
resource = MockLoader.new(:ubuntu1504).load_resource("os")
resource = MockLoader.new(:ubuntu).load_resource("os")
_(resource.name).must_equal "ubuntu"
_(resource.family).must_equal "debian"
_(resource.release).must_equal "15.04"
_(resource.release).must_equal "20.04"
_(resource.arch).must_equal "x86_64"
end

View file

@ -3,19 +3,19 @@ require "inspec/resource"
require "inspec/resources/platform"
describe "Inspec::Resources::Platform" do
let(:resource) { MockLoader.new(:ubuntu1504).load_resource("platform") }
let(:resource) { MockLoader.new(:ubuntu).load_resource("platform") }
it "verify platform parsing on Ubuntu" do
_(resource.name).must_equal "ubuntu"
_(resource.family).must_equal "debian"
_(resource.release).must_equal "15.04"
_(resource.release).must_equal "20.04"
_(resource.arch).must_equal "x86_64"
end
it "verify platform hash parsing on Ubuntu" do
_(resource[:name]).must_equal "ubuntu"
_(resource[:family]).must_equal "debian"
_(resource[:release]).must_equal "15.04"
_(resource[:release]).must_equal "20.04"
_(resource[:arch]).must_equal "x86_64"
end
@ -67,18 +67,18 @@ describe "Inspec::Resources::Platform" do
_(resource).wont_be :supported?, supports
end
it "loads a profile which supports release 15.04" do
it "loads a profile which supports release 20.04" do
supports = [
{ 'os-family': "windows", 'os-name': "windows_2000" },
{ 'os-name': "ubuntu", 'release': "15.04" },
{ 'os-name': "ubuntu", 'release': "20.04" },
]
_(resource).must_be :supported?, supports
end
it "loads a profile which supports release 15.*" do
it "loads a profile which supports release 20.*" do
supports = [
{ 'os-family': "windows", 'os-name': "windows_2000" },
{ 'os-name': "ubuntu", 'release': "15.*" },
{ 'os-name': "ubuntu", 'release': "20.*" },
]
_(resource).must_be :supported?, supports
end

View file

@ -47,9 +47,8 @@ describe "Inspec::Resources::Service" do
_(resource.params.UnitFileState).must_be_nil
end
# ubuntu 15.04 with systemd
it "verify ubuntu service parsing" do
resource = MockLoader.new(:ubuntu1504).load_resource("service", "sshd")
resource = MockLoader.new(:ubuntu).load_resource("service", "sshd")
params = Hashie::Mash.new({ "ActiveState" => "active", "Description" => "OpenSSH server daemon", "Id" => "sshd.service", "LoadState" => "loaded", "Names" => "sshd.service", "SubState" => "running", "UnitFileState" => "enabled" })
_(resource.type).must_equal "systemd"
_(resource.name).must_equal "sshd.service"
@ -62,7 +61,7 @@ describe "Inspec::Resources::Service" do
end
it "verify ubuntu service parsing with default systemd_service" do
resource = MockLoader.new(:ubuntu1504).load_resource("systemd_service", "sshd")
resource = MockLoader.new(:ubuntu).load_resource("systemd_service", "sshd")
params = Hashie::Mash.new({ "ActiveState" => "active", "Description" => "OpenSSH server daemon", "Id" => "sshd.service", "LoadState" => "loaded", "Names" => "sshd.service", "SubState" => "running", "UnitFileState" => "enabled" })
_(resource.type).must_equal "systemd"
_(resource.name).must_equal "sshd.service"

View file

@ -5,7 +5,7 @@ require "inspec/resources/sys_info"
describe "Inspec::Resources::SysInfo" do
describe "sys_info" do
it "check sys_info on Ubuntu" do
resource = MockLoader.new(:ubuntu1504).load_resource("sys_info")
resource = MockLoader.new(:ubuntu).load_resource("sys_info")
_(resource.hostname).must_equal "example.com"
_(resource.manufacturer).must_equal "ACME Corp."
_(resource.model).must_equal "Flux Capacitor"