summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/spec/simulator_spec.rb63
1 files changed, 59 insertions, 4 deletions
diff --git a/tests/spec/simulator_spec.rb b/tests/spec/simulator_spec.rb
index fd2f412..db78a82 100644
--- a/tests/spec/simulator_spec.rb
+++ b/tests/spec/simulator_spec.rb
@@ -27,6 +27,34 @@ RSpec.describe 'HorizonScript Simulator', :type => :aruba do
expect(last_command_started.stdout).to start_with("#!/bin/sh")
end
end
+ context "simulating 'lvm_pv' execution" do
+ it "creates a physical volume" do
+ use_fixture '0163-lvmpv-basic.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("pvcreate --force /dev/sdb2")
+ end
+ end
+ context "simulating 'lvm_vg' execution" do
+ it "creates a volume group" do
+ use_fixture '0166-lvmvg-basic.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("vgcreate MyVolGroup /dev/sdb2")
+ end
+ end
+ context "simulating 'lvm_lv' execution" do
+ it "creates a logical volume" do
+ use_fixture '0171-lvmlv-basic.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("lvcreate -l 100%FREE -n root MyVolGroup")
+ end
+ end
+ context "simulating 'fs' execution" do
+ 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
+ end
context "simulating 'mount' execution" do
it "mounts directories in tree order" do
use_fixture '0057-many-mounts.installfile'
@@ -71,6 +99,19 @@ printf '%s\\t%s\\t%s\\t%s\\t0\\t0\\n' /dev/gwyn/source /usr/src auto noatime >>
expect(last_command_started.stderr).to include("set domain name 'we-sing-it-proudly.new-romantics.club'")
end
end
+ context "simulating 'repository' execution" do
+ it "outputs default repositories when none are specified" do
+ use_fixture '0001-basic.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("echo 'https://distfiles.adelielinux.org/adelie/stable/system' >> /target/etc/apk/repositories")
+ end
+ it "outputs requested repositories when specified" do
+ use_fixture '0055-repository-basic.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("echo 'https://distfiles.adelielinux.org/adelie/current/system' >> /target/etc/apk/repositories")
+ expect(last_command_started.stdout).to_not include("echo 'https://distfiles.adelielinux.org/adelie/stable/system' >> /target/etc/apk/repositories")
+ end
+ end
context "simulating 'netssid' execution" do
it "outputs the network block correctly" do
use_fixture '0067-netssid-spaces-wpa.installfile'
@@ -78,11 +119,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("network={\n\tssid=\"The New Fox 5G\"\n\tpsk=\"shh, sekrit!\"\n\tpriority=5\n}")
end
end
- context "simulating 'fs' execution" do
- it "creates ext4 filesystems correctly" do
- use_fixture '0179-fs-basic.installfile'
+ context "simulating 'netaddress' execution" do
+ it "configures addressing correctly" do
+ use_fixture '0042-netaddress-valid-static6.installfile'
run_simulate
- expect(last_command_started.stdout).to include("mkfs.ext4 -q -z /tmp/undo-sdb1 /dev/sdb1")
+ # The end quote is missing deliberately.
+ expect(last_command_started.stdout).to include('config_eth0="2600:1702:2a80:1b9f:5bbc:af4c:5dd1:a183/64')
+ end
+ it "configures routing correctly" do
+ use_fixture '0048-netaddress-gateway4.installfile'
+ run_simulate
+ # The end quote is missing deliberately.
+ expect(last_command_started.stdout).to include('routes_eth0="default via 172.16.1.1')
+ end
+ end
+ context "simulating 'nameserver' execution" do
+ it "configures nameservers correctly" do
+ use_fixture '0183-nameserver-basic.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("printf 'nameserver %s\n' 172.16.1.1 >>/target/etc/resolv.conf")
end
end
end