summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/0104-usergroups-basic.installfile15
-rw-r--r--tests/fixtures/0105-usergroups-without-groups.installfile7
-rw-r--r--tests/fixtures/0106-usergroups-comma.installfile7
-rw-r--r--tests/fixtures/0107-usergroups-unknown-name.installfile8
-rw-r--r--tests/fixtures/0108-jumbo-usergroups.installfile7
-rw-r--r--tests/fixtures/0109-usergroups-unknown.installfile8
-rw-r--r--tests/fixtures/0110-usergroups-duplicate.installfile8
-rw-r--r--tests/spec/validator.rb44
8 files changed, 104 insertions, 0 deletions
diff --git a/tests/fixtures/0104-usergroups-basic.installfile b/tests/fixtures/0104-usergroups-basic.installfile
new file mode 100644
index 0000000..fb4c31e
--- /dev/null
+++ b/tests/fixtures/0104-usergroups-basic.installfile
@@ -0,0 +1,15 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+username chris
+usergroups chris disk,lp,wheel,floppy,audio,cdrom,video,games,cdrw,usb,users
+username kayla
+usergroups kayla lp,audio,cdrom,video,games,users
+username meg
+usergroups meg lp,audio,cdrom,video,games,users
+username steph
+usergroups steph lp,audio,cdrom,video,games,users
+username amanda
+usergroups amanda lp,audio,cdrom,video,games,users
diff --git a/tests/fixtures/0105-usergroups-without-groups.installfile b/tests/fixtures/0105-usergroups-without-groups.installfile
new file mode 100644
index 0000000..63cc3fd
--- /dev/null
+++ b/tests/fixtures/0105-usergroups-without-groups.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+username awilfox
+usergroups awilfox
diff --git a/tests/fixtures/0106-usergroups-comma.installfile b/tests/fixtures/0106-usergroups-comma.installfile
new file mode 100644
index 0000000..b337fb5
--- /dev/null
+++ b/tests/fixtures/0106-usergroups-comma.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+username awilfox
+usergroups awilfox ,,,
diff --git a/tests/fixtures/0107-usergroups-unknown-name.installfile b/tests/fixtures/0107-usergroups-unknown-name.installfile
new file mode 100644
index 0000000..6cbec3b
--- /dev/null
+++ b/tests/fixtures/0107-usergroups-unknown-name.installfile
@@ -0,0 +1,8 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+username awilfox
+# Intentional misspelling
+usergroups awilcox users,wheel
diff --git a/tests/fixtures/0108-jumbo-usergroups.installfile b/tests/fixtures/0108-jumbo-usergroups.installfile
new file mode 100644
index 0000000..6b3cd03
--- /dev/null
+++ b/tests/fixtures/0108-jumbo-usergroups.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+username awilfox
+usergroups awilfox root,bin,daemon,sys,adm,tty,disk,lp,mem,kmem,wheel,floppy,mail,news,uucp,man,cron,console,audio,cdrom,dialout,ftp,sshd,input,at,tape,video
diff --git a/tests/fixtures/0109-usergroups-unknown.installfile b/tests/fixtures/0109-usergroups-unknown.installfile
new file mode 100644
index 0000000..4557950
--- /dev/null
+++ b/tests/fixtures/0109-usergroups-unknown.installfile
@@ -0,0 +1,8 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+username awilfox
+# Groups that are not in the base set
+usergroups awilfox messagebus,www-data,pulse
diff --git a/tests/fixtures/0110-usergroups-duplicate.installfile b/tests/fixtures/0110-usergroups-duplicate.installfile
new file mode 100644
index 0000000..9d04ae7
--- /dev/null
+++ b/tests/fixtures/0110-usergroups-duplicate.installfile
@@ -0,0 +1,8 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+username awilfox
+usergroups awilfox disk,lp,wheel,floppy,audio,cdrom
+usergroups awilfox wheel,video,games,cdrw,usb,users
diff --git a/tests/spec/validator.rb b/tests/spec/validator.rb
index e43e5ed..023d49e 100644
--- a/tests/spec/validator.rb
+++ b/tests/spec/validator.rb
@@ -651,6 +651,50 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
expect(last_command_started).to have_output(/error: .*usericon.*URL/)
end
end
+ context "'usergroups'" do
+ # Runner.Validate.usergroups.
+ it "succeeds with a valid account/group set" do
+ use_fixture '0104-usergroups-basic.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ # Runner.Validate.usergroups.Validity.
+ it "requires at least one group to be provided" do
+ use_fixture '0105-usergroups-without-groups.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*usergroups.*required/)
+ end
+ it "correctly errors when only a , is given" do
+ use_fixture '0106-usergroups-comma.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*usergroups.*invalid/)
+ end
+ # Runner.Validate.usergroups.Name.
+ it "fails with a username that wasn't given" do
+ use_fixture '0107-usergroups-unknown-name.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*usergroups.*name/)
+ end
+ # Runner.Validate.usergroups.Count.
+ it "fails with more than 16 groups for a single name" do
+ use_fixture '0108-jumbo-usergroups.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*usergroups.*16/)
+ end
+ # Runner.Validate.usergroups.Group.
+ it "fails with an unknown group name" do
+ use_fixture '0109-usergroups-unknown.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*usergroups.*group/)
+ end
+ # Runner.Validate.usergroups.Unique.
+ it "fails with the same group specified twice" do
+ use_fixture '0110-usergroups-duplicate.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*usergroups.*duplicate/)
+ end
+ end
end
context "package specifications" do
# no requirements for these, but I think obvious.