summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-06 20:33:01 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-06 20:33:01 -0600
commit5682d368343ccd8440178ea21ee4e29f4bb5201e (patch)
treec7a9fea34c3faa7c0b189aa14ce4b575ccbccfe6 /tests
parentf7c4db70e541ba11017d8261f0901a13badb7c97 (diff)
downloadhorizon-5682d368343ccd8440178ea21ee4e29f4bb5201e.tar.gz
horizon-5682d368343ccd8440178ea21ee4e29f4bb5201e.tar.bz2
horizon-5682d368343ccd8440178ea21ee4e29f4bb5201e.tar.xz
horizon-5682d368343ccd8440178ea21ee4e29f4bb5201e.zip
tests: Write more network tests
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/0221-nameserver-dhcp.installfile8
-rw-r--r--tests/fixtures/0222-complete.installfile19
-rw-r--r--tests/kvm.installfile10
-rw-r--r--tests/spec/simulator_spec.rb26
4 files changed, 52 insertions, 11 deletions
diff --git a/tests/fixtures/0221-nameserver-dhcp.installfile b/tests/fixtures/0221-nameserver-dhcp.installfile
new file mode 100644
index 0000000..8d87536
--- /dev/null
+++ b/tests/fixtures/0221-nameserver-dhcp.installfile
@@ -0,0 +1,8 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+netaddress eth0 dhcp
+nameserver 172.16.1.1
+nameserver 2600:1702:2a80:1b90::1
diff --git a/tests/fixtures/0222-complete.installfile b/tests/fixtures/0222-complete.installfile
new file mode 100644
index 0000000..c82063f
--- /dev/null
+++ b/tests/fixtures/0222-complete.installfile
@@ -0,0 +1,19 @@
+hostname horizonkvmtest-ppc64.adelielinux.org
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+network true
+netssid wlan0 "Testing" none
+netaddress eth0 dhcp
+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/kvm.installfile b/tests/kvm.installfile
deleted file mode 100644
index 5d54116..0000000
--- a/tests/kvm.installfile
+++ /dev/null
@@ -1,10 +0,0 @@
-hostname horizonkvmtest-ppc64.adelielinux.org
-rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
-network true
-netaddress eth0 dhcp
-diskid /dev/sda QEMU_HARDDISK
-disklabel /dev/sda gpt
-partition /dev/sda 1 fill
-fs /dev/sda1 ext4
-mount /dev/sda1 /
-pkginstall adelie-base-posix
diff --git a/tests/spec/simulator_spec.rb b/tests/spec/simulator_spec.rb
index 1507428..f18119b 100644
--- a/tests/spec/simulator_spec.rb
+++ b/tests/spec/simulator_spec.rb
@@ -202,8 +202,29 @@ 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("printf 'nameserver %s\\n' 172.16.1.1 >>/target/etc/resolv.conf")
end
+ it "uses resolv.conf when no interfaces use DHCP" do
+ use_fixture '0183-nameserver-basic.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to_not include("mv /target/etc/resolv.conf /target/etc/resolv.conf.head")
+ end
+ it "uses resolv.conf.head when interfaces use DHCP" do
+ use_fixture '0221-nameserver-dhcp.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("mv /target/etc/resolv.conf /target/etc/resolv.conf.head")
+ end
+ end
+ context "simulating 'network' execution" do
+ it "copies SSID information" do
+ use_fixture '0222-complete.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("cp /target/etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf")
+ end
+ it "copies nameserver information" do
+ use_fixture '0222-complete.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("cp /target/etc/resolv.conf* /etc/")
+ end
end
- # network
context "simulating 'signingkey' execution" do
it "downloads remote keys to target" do
use_fixture '0186-signingkey-basic.installfile'
@@ -222,16 +243,19 @@ printf '%s\\t%s\\t%s\\t%s\\t0\\t0\\n' /dev/gwyn/source /usr/src auto noatime >>
end
end
context "simulating 'pkginstall' execution" do
+ # Runner.Execute.pkginstall.APKDB
it "initialises the APK database" do
use_fixture '0001-basic.installfile'
run_simulate
expect(last_command_started.stdout).to include("apk --root /target --initdb add")
end
+ # Runner.Execute.pkginstall
it "updates the local repository cache" do
use_fixture '0001-basic.installfile'
run_simulate
expect(last_command_started.stdout).to include("apk --root /target update")
end
+ # Runner.Execute.pkginstall
it "installs the requested packages" do
use_fixture '0001-basic.installfile'
run_simulate