summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-03-17 00:52:38 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-03-17 00:52:38 -0500
commitbbe669b761db4cb03fca2dbf9a7890d5a7e120af (patch)
tree580b71e39783a72c0416b65ef6714f454696e221 /tests
parent28c81a32aa59a9b2d39ddd7f86fb1d2677da32cc (diff)
downloadhorizon-bbe669b761db4cb03fca2dbf9a7890d5a7e120af.tar.gz
horizon-bbe669b761db4cb03fca2dbf9a7890d5a7e120af.tar.bz2
horizon-bbe669b761db4cb03fca2dbf9a7890d5a7e120af.tar.xz
horizon-bbe669b761db4cb03fca2dbf9a7890d5a7e120af.zip
hscript: Add new netconfigtype key and associated tests
Not wired up to netaddress et al, but does parse properly.
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/0226-netconfigtype-netifrc.installfile20
-rw-r--r--tests/fixtures/0227-netconfigtype-eni.installfile20
-rw-r--r--tests/fixtures/0228-netconfigtype-invalid.installfile20
-rw-r--r--tests/spec/validator_spec.rb19
4 files changed, 79 insertions, 0 deletions
diff --git a/tests/fixtures/0226-netconfigtype-netifrc.installfile b/tests/fixtures/0226-netconfigtype-netifrc.installfile
new file mode 100644
index 0000000..3b7cace
--- /dev/null
+++ b/tests/fixtures/0226-netconfigtype-netifrc.installfile
@@ -0,0 +1,20 @@
+hostname horizon-netifrc-test
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+network true
+netconfigtype netifrc
+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/0227-netconfigtype-eni.installfile b/tests/fixtures/0227-netconfigtype-eni.installfile
new file mode 100644
index 0000000..2eb6712
--- /dev/null
+++ b/tests/fixtures/0227-netconfigtype-eni.installfile
@@ -0,0 +1,20 @@
+hostname horizon-netifrc-test
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+network true
+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 easy-kernel-modules grub-ieee1275 openrc s6-linux-init
+keymap us
+language en_GB.UTF-8
+timezone America/Chicago
+firmware false
diff --git a/tests/fixtures/0228-netconfigtype-invalid.installfile b/tests/fixtures/0228-netconfigtype-invalid.installfile
new file mode 100644
index 0000000..fcb29df
--- /dev/null
+++ b/tests/fixtures/0228-netconfigtype-invalid.installfile
@@ -0,0 +1,20 @@
+hostname horizon-netifrc-test
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+network true
+netconfigtype netbsd-rcconf
+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/spec/validator_spec.rb b/tests/spec/validator_spec.rb
index 971b91d..963eecf 100644
--- a/tests/spec/validator_spec.rb
+++ b/tests/spec/validator_spec.rb
@@ -221,6 +221,25 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
expect(last_command_started).to have_output(/error: .*arch.*expected/)
end
end
+ context "for 'netconfigtype' key" do
+ it "succeeds with netifrc specified" do
+ use_fixture '0226-netconfigtype-netifrc.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ it "succeeds with /etc/network/interfaces specified" do
+ use_fixture '0227-netconfigtype-eni.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ it "fails with an invalid value" do
+ use_fixture '0228-netconfigtype-invalid.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*netconfigtype.*valid/)
+ end
+ end
context "for 'nameserver' key" do
it "succeeds with IPv4 and IPv6 addresses" do
use_fixture '0183-nameserver-basic.installfile'