From 1ba765b5c71329767d281b94ef1b26661c323b5d Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Mon, 4 Nov 2019 19:55:38 -0600 Subject: tests: Add tests for all supported FSes --- tests/fixtures/0193-fs-ext2.installfile | 9 +++++++ tests/fixtures/0194-fs-ext3.installfile | 9 +++++++ tests/fixtures/0195-fs-jfs.installfile | 9 +++++++ tests/fixtures/0196-fs-vfat.installfile | 9 +++++++ tests/fixtures/0197-fs-xfs.installfile | 9 +++++++ tests/spec/simulator_spec.rb | 42 +++++++++++++++++++++++++++++++++ 6 files changed, 87 insertions(+) create mode 100644 tests/fixtures/0193-fs-ext2.installfile create mode 100644 tests/fixtures/0194-fs-ext3.installfile create mode 100644 tests/fixtures/0195-fs-jfs.installfile create mode 100644 tests/fixtures/0196-fs-vfat.installfile create mode 100644 tests/fixtures/0197-fs-xfs.installfile (limited to 'tests') diff --git a/tests/fixtures/0193-fs-ext2.installfile b/tests/fixtures/0193-fs-ext2.installfile new file mode 100644 index 0000000..a0b6c9d --- /dev/null +++ b/tests/fixtures/0193-fs-ext2.installfile @@ -0,0 +1,9 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +diskid /dev/sdb WDBNCE2500PNC +disklabel /dev/sdb gpt +partition /dev/sdb 1 fill +fs /dev/sdb1 ext2 +mount /dev/sdb1 / diff --git a/tests/fixtures/0194-fs-ext3.installfile b/tests/fixtures/0194-fs-ext3.installfile new file mode 100644 index 0000000..b261530 --- /dev/null +++ b/tests/fixtures/0194-fs-ext3.installfile @@ -0,0 +1,9 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +diskid /dev/sdb WDBNCE2500PNC +disklabel /dev/sdb mbr +partition /dev/sdb 1 fill +fs /dev/sdb1 ext3 +mount /dev/sdb1 / diff --git a/tests/fixtures/0195-fs-jfs.installfile b/tests/fixtures/0195-fs-jfs.installfile new file mode 100644 index 0000000..40bc217 --- /dev/null +++ b/tests/fixtures/0195-fs-jfs.installfile @@ -0,0 +1,9 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +diskid /dev/sdb WDBNCE2500PNC +disklabel /dev/sdb apm +partition /dev/sdb 1 fill +fs /dev/sdb1 jfs +mount /dev/sdb1 / diff --git a/tests/fixtures/0196-fs-vfat.installfile b/tests/fixtures/0196-fs-vfat.installfile new file mode 100644 index 0000000..bea20f9 --- /dev/null +++ b/tests/fixtures/0196-fs-vfat.installfile @@ -0,0 +1,9 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +diskid /dev/sdb WDBNCE2500PNC +disklabel /dev/sdb gpt +partition /dev/sdb 1 fill +fs /dev/sdb1 vfat +mount /dev/sdb1 / diff --git a/tests/fixtures/0197-fs-xfs.installfile b/tests/fixtures/0197-fs-xfs.installfile new file mode 100644 index 0000000..488fdf6 --- /dev/null +++ b/tests/fixtures/0197-fs-xfs.installfile @@ -0,0 +1,9 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +diskid /dev/sdb WDBNCE2500PNC +disklabel /dev/sdb apm +partition /dev/sdb 1 fill +fs /dev/sdb1 xfs +mount /dev/sdb1 / diff --git a/tests/spec/simulator_spec.rb b/tests/spec/simulator_spec.rb index 8c8e91a..d46c87c 100644 --- a/tests/spec/simulator_spec.rb +++ b/tests/spec/simulator_spec.rb @@ -27,6 +27,23 @@ RSpec.describe 'HorizonScript Simulator', :type => :aruba do expect(last_command_started.stdout).to start_with("#!/bin/sh") end end + context "simulating 'disklabel' execution" do + it "creates Apple Partition Maps correctly" do + use_fixture '0122-disklabel-apm.installfile' + run_simulate + expect(last_command_started.stdout).to include("parted -ms /dev/sda mklabel apm") + end + it "creates GUID Partition Tables correctly" do + use_fixture '0124-disklabel-gpt.installfile' + run_simulate + expect(last_command_started.stdout).to include("parted -ms /dev/sda mklabel gpt") + end + it "creates MBR tables correctly" do + use_fixture '0123-disklabel-mbr.installfile' + run_simulate + expect(last_command_started.stdout).to include("parted -ms /dev/sda mklabel mbr") + end + end context "simulating 'lvm_pv' execution" do it "creates a physical volume" do use_fixture '0163-lvmpv-basic.installfile' @@ -49,11 +66,36 @@ RSpec.describe 'HorizonScript Simulator', :type => :aruba do end end context "simulating 'fs' execution" do + it "creates ext2 filesystems correctly" do + use_fixture '0193-fs-ext2.installfile' + run_simulate + expect(last_command_started.stdout).to include("mkfs.ext2 -q -z /tmp/undo-sdb1 /dev/sdb1") + end + it "creates ext3 filesystems correctly" do + use_fixture '0194-fs-ext3.installfile' + run_simulate + expect(last_command_started.stdout).to include("mkfs.ext3 -q -z /tmp/undo-sdb1 /dev/sdb1") + end it "creates ext4 filesystems correctly" do use_fixture '0179-fs-basic.installfile' run_simulate expect(last_command_started.stdout).to include("mkfs.ext4 -q -z /tmp/undo-sdb1 /dev/sdb1") end + it "creates JFS filesystems correctly" do + use_fixture '0195-fs-jfs.installfile' + run_simulate + expect(last_command_started.stdout).to include("mkfs.jfs -q /dev/sdb1") + end + it "creates VFAT filesystems correctly" do + use_fixture '0196-fs-vfat.installfile' + run_simulate + expect(last_command_started.stdout).to include("mkfs.vfat -F32 /dev/sdb1") + end + it "creates XFS filesystems correctly" do + use_fixture '0197-fs-xfs.installfile' + run_simulate + expect(last_command_started.stdout).to include("mkfs.xfs -f /dev/sdb1") + end end context "simulating 'mount' execution" do it "mounts directories in tree order" do -- cgit v1.2.3-60-g2f50