summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-10-15 13:25:38 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-10-15 13:25:38 -0500
commite9870d0b830deb0b253e5e514fc90ceee201a778 (patch)
tree244344085bdcd5ada2f187fc4579005caa51e409 /tests
parentf9850e766787d46bcae874fd4302cab0f0244e03 (diff)
downloadhorizon-e9870d0b830deb0b253e5e514fc90ceee201a778.tar.gz
horizon-e9870d0b830deb0b253e5e514fc90ceee201a778.tar.bz2
horizon-e9870d0b830deb0b253e5e514fc90ceee201a778.tar.xz
horizon-e9870d0b830deb0b253e5e514fc90ceee201a778.zip
Add many more various test cases
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/0227-netconfigtype-eni.installfile6
-rw-r--r--tests/fixtures/0253-fs-hfsplus.installfile10
-rw-r--r--tests/fixtures/0254-partition-type-prep.installfile8
-rw-r--r--tests/fixtures/0255-bootloader-devonly.installfile7
-rw-r--r--tests/fixtures/0256-bootloader-arm64.installfile7
-rw-r--r--tests/fixtures/0257-bootloader-armv7.installfile7
-rw-r--r--tests/fixtures/0258-bootloader-spaces.installfile7
-rw-r--r--tests/fixtures/0259-netconfigtype-duplicate.installfile21
-rw-r--r--tests/fixtures/0260-pppoe-duplicate.installfile7
-rw-r--r--tests/fixtures/0261-arch-duplicate.installfile7
-rw-r--r--tests/fixtures/0262-version-duplicate.installfile7
-rw-r--r--tests/fixtures/0263-bootloader-duplicate.installfile8
-rw-r--r--tests/spec/simulator_spec.rb69
-rw-r--r--tests/spec/validator_spec.rb26
14 files changed, 183 insertions, 14 deletions
diff --git a/tests/fixtures/0227-netconfigtype-eni.installfile b/tests/fixtures/0227-netconfigtype-eni.installfile
index e5beb22..0c1deda 100644
--- a/tests/fixtures/0227-netconfigtype-eni.installfile
+++ b/tests/fixtures/0227-netconfigtype-eni.installfile
@@ -2,8 +2,10 @@ hostname horizon-eni-test
rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
network true
netconfigtype eni
-netaddress eth0 static 192.168.1.2 24 192.168.1.1
-netaddress eth0 slaac
+netaddress eth0 static 192.0.2.2 24 192.0.2.1
+netaddress eth1 slaac
+netaddress eth2 dhcp
+netaddress eth3 static 2001:db8::2 64 2001:db8::1
nameserver 9.9.9.10
diskid /dev/sda QEMU_HARDDISK
disklabel /dev/sda gpt
diff --git a/tests/fixtures/0253-fs-hfsplus.installfile b/tests/fixtures/0253-fs-hfsplus.installfile
new file mode 100644
index 0000000..cf1801a
--- /dev/null
+++ b/tests/fixtures/0253-fs-hfsplus.installfile
@@ -0,0 +1,10 @@
+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 10M bios
+partition /dev/sdb 2 fill
+fs /dev/sdb2 hfs+
+mount /dev/sdb2 /
diff --git a/tests/fixtures/0254-partition-type-prep.installfile b/tests/fixtures/0254-partition-type-prep.installfile
new file mode 100644
index 0000000..96cc82d
--- /dev/null
+++ b/tests/fixtures/0254-partition-type-prep.installfile
@@ -0,0 +1,8 @@
+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 prep
+mount /dev/sdb1 /
diff --git a/tests/fixtures/0255-bootloader-devonly.installfile b/tests/fixtures/0255-bootloader-devonly.installfile
new file mode 100644
index 0000000..ab2a3e6
--- /dev/null
+++ b/tests/fixtures/0255-bootloader-devonly.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+arch ppc
+bootloader /dev/sda
diff --git a/tests/fixtures/0256-bootloader-arm64.installfile b/tests/fixtures/0256-bootloader-arm64.installfile
new file mode 100644
index 0000000..dfd5317
--- /dev/null
+++ b/tests/fixtures/0256-bootloader-arm64.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+arch aarch64
+bootloader /dev/sda
diff --git a/tests/fixtures/0257-bootloader-armv7.installfile b/tests/fixtures/0257-bootloader-armv7.installfile
new file mode 100644
index 0000000..2374ae5
--- /dev/null
+++ b/tests/fixtures/0257-bootloader-armv7.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+arch armv7
+bootloader /dev/sda
diff --git a/tests/fixtures/0258-bootloader-spaces.installfile b/tests/fixtures/0258-bootloader-spaces.installfile
new file mode 100644
index 0000000..661a439
--- /dev/null
+++ b/tests/fixtures/0258-bootloader-spaces.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+arch ppc64
+bootloader /dev/sda invalid loader
diff --git a/tests/fixtures/0259-netconfigtype-duplicate.installfile b/tests/fixtures/0259-netconfigtype-duplicate.installfile
new file mode 100644
index 0000000..08f0c91
--- /dev/null
+++ b/tests/fixtures/0259-netconfigtype-duplicate.installfile
@@ -0,0 +1,21 @@
+hostname horizon-netifrc-test
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+network true
+netconfigtype netifrc
+netconfigtype eni
+netaddress eth0 dhcp
+netaddress eth0 slaac
+nameserver 9.9.9.10
+diskid /dev/sda QEMU_HARDDISK
+disklabel /dev/sda gpt
+partition /dev/sda 1 fill
+fs /dev/sda1 ext4
+mount /dev/sda1 /
+repository https://distfiles.adelielinux.org/adelie/current/system
+repository https://distfiles.adelielinux.org/adelie/current/user
+signingkey /etc/apk/keys/packages@adelielinux.org.pub
+pkginstall adelie-base-posix dash-binsh easy-kernel-power8 easy-kernel-power8-modules grub-ieee1275 netifrc openrc s6-linux-init
+keymap us
+language en_GB.UTF-8
+timezone America/Chicago
+firmware false
diff --git a/tests/fixtures/0260-pppoe-duplicate.installfile b/tests/fixtures/0260-pppoe-duplicate.installfile
new file mode 100644
index 0000000..8bb0262
--- /dev/null
+++ b/tests/fixtures/0260-pppoe-duplicate.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+pppoe eth0
+pppoe eth0
diff --git a/tests/fixtures/0261-arch-duplicate.installfile b/tests/fixtures/0261-arch-duplicate.installfile
new file mode 100644
index 0000000..123fc09
--- /dev/null
+++ b/tests/fixtures/0261-arch-duplicate.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+arch ppc64
+arch ppc
diff --git a/tests/fixtures/0262-version-duplicate.installfile b/tests/fixtures/0262-version-duplicate.installfile
new file mode 100644
index 0000000..a795494
--- /dev/null
+++ b/tests/fixtures/0262-version-duplicate.installfile
@@ -0,0 +1,7 @@
+network false
+hostname 123lonelycorgi.street
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+version 1.0
+version 1.1
diff --git a/tests/fixtures/0263-bootloader-duplicate.installfile b/tests/fixtures/0263-bootloader-duplicate.installfile
new file mode 100644
index 0000000..ff81cd5
--- /dev/null
+++ b/tests/fixtures/0263-bootloader-duplicate.installfile
@@ -0,0 +1,8 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+arch ppc
+bootloader /dev/sda grub-ieee1275
+bootloader /dev/sda iquik
diff --git a/tests/spec/simulator_spec.rb b/tests/spec/simulator_spec.rb
index b2d6d4a..8c93996 100644
--- a/tests/spec/simulator_spec.rb
+++ b/tests/spec/simulator_spec.rb
@@ -100,6 +100,11 @@ RSpec.describe 'HorizonScript Simulator', :type => :aruba do
run_simulate
expect(last_command_started.stdout).to include("mkfs.ext4 -q -F /dev/sdb1")
end
+ it "creates HFS+ filesystems correctly" do
+ use_fixture '0253-fs-hfsplus.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("mkfs.hfsplus -w /dev/sdb2")
+ end
it "creates JFS filesystems correctly" do
use_fixture '0195-fs-jfs.installfile'
run_simulate
@@ -145,6 +150,29 @@ mount -o noatime /dev/gwyn/source /target/usr/src
printf '%s\\t%s\\t%s\\t%s\\t0\\t0\\n' /dev/gwyn/source /usr/src auto noatime >> /target/etc/fstab")
end
end
+ context "simulating 'bootloader' execution" do
+ it "installs grub-bios correctly" do
+ use_fixture '0251-bootloader-x86bios.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("add grub-bios")
+ expect(last_command_started.stdout).to include("grub-install")
+ expect(last_command_started.stdout).to include("/usr/sbin/update-boot")
+ end
+ it "installs grub-efi correctly" do
+ use_fixture '0256-bootloader-arm64.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("add grub-efi")
+ expect(last_command_started.stdout).to include("grub-install")
+ expect(last_command_started.stdout).to include("/usr/sbin/update-boot")
+ end
+ it "installs grub-ieee1275 correctly" do
+ use_fixture '0255-bootloader-devonly.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("add grub-ieee1275")
+ expect(last_command_started.stdout).to include("grub-install")
+ expect(last_command_started.stdout).to include("/usr/sbin/update-boot")
+ end
+ end
context "simulating 'hostname' execution" do
it "sets the hostname properly" do
use_fixture '0074-hostname-large.installfile'
@@ -217,15 +245,13 @@ printf '%s\\t%s\\t%s\\t%s\\t0\\t0\\n' /dev/gwyn/source /usr/src auto noatime >>
run_simulate
expect(last_command_started.stdout).to include("ln -s /etc/init.d/net.lo /target/etc/init.d/net.eth0")
end
- it "configures IPv4 addressing correctly with eni" do
- use_fixture '0227-netconfigtype-eni.installfile'
- run_simulate
- expect(last_command_started.stdout).to include("auto eth0\niface eth0 inet static")
- end
- it "configures IPv6 SLAAC addressing correctly with eni" do
+ it "configures addressing correctly with eni" do
use_fixture '0227-netconfigtype-eni.installfile'
run_simulate
- expect(last_command_started.stdout).to include("iface eth0 inet6 manual")
+ expect(last_command_started.stdout).to include("auto eth0\niface eth0 inet static\n\taddress 192.0.2.2")
+ expect(last_command_started.stdout).to include("auto eth1\niface eth1 inet6 manual\n\tpre-up echo 1 > /proc/sys/net/ipv6/conf/eth1/accept_ra")
+ expect(last_command_started.stdout).to include("auto eth2\niface eth2 inet dhcp")
+ expect(last_command_started.stdout).to include("auto eth3\niface eth3 inet6 static\n\tpre-up echo 0 > /proc/sys/net/ipv6/conf/eth3/accept_ra")
end
end
context "simulating 'nameserver' execution" do
@@ -257,6 +283,25 @@ printf '%s\\t%s\\t%s\\t%s\\t0\\t0\\n' /dev/gwyn/source /usr/src auto noatime >>
expect(last_command_started.stdout).to include("cp /target/etc/resolv.conf* /etc/")
end
end
+ context "simulating 'pppoe' execution" do
+ it "supports simulating PPPoE using netifrc" do
+ use_fixture '0243-pppoe-allkeys.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include('pppd_ppp0="noauth
+defaultroute
+lcp-echo-interval 10
+lcp-echo-failure 5
+mtu 9001
+"
+password_ppp0="fuzzball"
+username_ppp0="awilfox"
+plugins_ppp0="pppoe"
+link_ppp0="eth0"
+config_ppp0="ppp"
+rc_net_ppp0_need="eth0"
+config_eth0="null"')
+ end
+ end
context "simulating 'signingkey' execution" do
it "downloads remote keys to target" do
use_fixture '0186-signingkey-basic.installfile'
@@ -280,11 +325,11 @@ printf '%s\\t%s\\t%s\\t%s\\t0\\t0\\n' /dev/gwyn/source /usr/src auto noatime >>
run_simulate
expect(last_command_started.stdout).to include("ln -s /etc/init.d/sshd /target/etc/runlevels/default/sshd")
end
- it "handles runlevels correctly" do
- use_fixture '0239-svcenable-runlevel.installfile'
- run_simulate
- expect(last_command_started.stdout).to include("ln -s /etc/init.d/udev /target/etc/runlevels/boot/udev")
- end
+ it "handles runlevels correctly" do
+ use_fixture '0239-svcenable-runlevel.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("ln -s /etc/init.d/udev /target/etc/runlevels/boot/udev")
+ end
end
context "simulating 'pkginstall' execution" do
# Runner.Execute.pkginstall.APKDB
diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb
index ceed3c2..2040fe0 100644
--- a/tests/spec/validator_spec.rb
+++ b/tests/spec/validator_spec.rb
@@ -937,6 +937,18 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
expect(last_command_started).to have_output(PARSER_SUCCESS)
expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
end
+ it "handles 'bios'" do
+ use_fixture '0253-fs-hfsplus.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ it "handles 'prep'" do
+ use_fixture '0254-partition-type-prep.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
it "handles no value" do
use_fixture '0154-partition-type-none.installfile'
run_validate
@@ -1146,6 +1158,12 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
run_validate
expect(last_command_started).to have_output(/error: .*fs.*already/)
end
+ it "succeeds with HFS+" do
+ use_fixture '0253-fs-hfsplus.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
end
context "for 'bootloader' key" do
it "succeeds with valid values" do
@@ -1165,12 +1183,20 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
use_fixture '0249-bootloader-ppc.installfile'
run_validate
expect(last_command_started).to have_output(/error: .*bootloader.*/)
+ use_fixture '0258-bootloader-spaces.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*bootloader.*/)
end
it "fails with unprepared architectures" do
use_fixture '0252-bootloader-alpha.installfile'
run_validate
expect(last_command_started).to have_output(/error: .*bootloader.*/)
end
+ it "fails when loader not specified and architecture doesn't have default" do
+ use_fixture '0257-bootloader-armv7.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*bootloader: no default.*/)
+ end
end
context "for 'keymap' key" do
it "succeeds with a simple value" do