From 036eb19b5825cbcd111420032e6291a10384a275 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Mon, 14 Oct 2019 12:26:55 -0500 Subject: tests: Add tests for hostname simulation --- tests/fixtures/0074-hostname-large.installfile | 5 +++++ tests/spec/simulator.rb | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/0074-hostname-large.installfile (limited to 'tests') diff --git a/tests/fixtures/0074-hostname-large.installfile b/tests/fixtures/0074-hostname-large.installfile new file mode 100644 index 0000000..285fef1 --- /dev/null +++ b/tests/fixtures/0074-hostname-large.installfile @@ -0,0 +1,5 @@ +network false +hostname heartbreak-is-the-national-anthem.we-sing-it-proudly.new-romantics.club +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / diff --git a/tests/spec/simulator.rb b/tests/spec/simulator.rb index 25d48f3..d3d8afa 100644 --- a/tests/spec/simulator.rb +++ b/tests/spec/simulator.rb @@ -33,7 +33,7 @@ RSpec.describe 'HorizonScript Simulator', :type => :aruba do expect(last_command_started.stdout).to start_with("#!/bin/sh") end end - context "simulating 'mount' flags" do + context "simulating 'mount' execution" do it "mounts directories in tree order" do use_fixture '0057-many-mounts.installfile' run_simulate @@ -44,4 +44,19 @@ mount /dev/sda2 /target/usr mount /dev/gwyn/source /target/usr/src") end end + context "simulating 'hostname' execution" do + it "sets the hostname properly" do + use_fixture '0074-hostname-large.installfile' + run_simulate + expect(last_command_started.stdout).to include("hostname heartbreak-is-the-national-anthem") + use_fixture '0001-basic.installfile' + run_simulate + expect(last_command_started.stdout).to include("hostname test.machine") + end + it "sets the domain name properly" do + use_fixture '0074-hostname-large.installfile' + run_simulate + expect(last_command_started.stderr).to include("set domain name 'we-sing-it-proudly.new-romantics.club'") + end + end end -- cgit v1.2.3-70-g09d2