From 79694decedf3496124a884485806a203c39874aa Mon Sep 17 00:00:00 2001 From: Gildas Le Nadan <3ntr0p13+github@gmail.com> Date: Sat, 28 Dec 2024 12:18:46 +1000 Subject: [PATCH 1/2] Improve goss tests to match previous serverspec ones --- goss/goss_pimusicbox.yaml | 3 ++- goss/goss_rclocal.yaml | 5 +++-- goss/goss_system.yaml | 21 +++++++++++---------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/goss/goss_pimusicbox.yaml b/goss/goss_pimusicbox.yaml index dc63271..8db35e1 100644 --- a/goss/goss_pimusicbox.yaml +++ b/goss/goss_pimusicbox.yaml @@ -7,8 +7,9 @@ file: # pimusicbox dependencies /sbin/wpa_cli: exists: true - # FIXME: it should be executable filetype: file + mode: + match-regexp: '[0-9][1357][1357][1357]' /etc/wpa_supplicant: exists: true filetype: directory diff --git a/goss/goss_rclocal.yaml b/goss/goss_rclocal.yaml index 21fcfd5..bddcf83 100644 --- a/goss/goss_rclocal.yaml +++ b/goss/goss_rclocal.yaml @@ -5,5 +5,6 @@ file: owner: root group: root filetype: file - # should not contain 'By default this script does nothing.' - contents: ['/opt/musicbox/startup.sh'] + contents: + - '/opt/musicbox/startup.sh' + - '!By default this script does nothing.' diff --git a/goss/goss_system.yaml b/goss/goss_system.yaml index 5df38d3..4d8d1fe 100644 --- a/goss/goss_system.yaml +++ b/goss/goss_system.yaml @@ -4,8 +4,10 @@ file: owner: root group: root filetype: file - # readable by owner, group and others - contents: ['TZ=:/etc/localtime'] + mode: + match-regexp: '[0-9][4567][4567][4567]' + contents: + - 'TZ=:/etc/localtime' /etc/init.d/resize2fs_once: exists: false /etc/fstab: @@ -14,19 +16,18 @@ file: group: root filetype: file mode: 644 - contents: [ - 'LABEL=boot /boot', - 'LABEL=rootfs /' - ] + contents: + and: + - 'LABEL=boot /boot' + - 'LABEL=rootfs /' /boot/cmdline.txt: exists: true owner: root group: root filetype: file - # should not contain 'init=/usr/lib/raspi-config/init_resize.sh' - contents: [ - 'root=/dev/mmcblk0p2' - ] + contents: + - 'root=/dev/mmcblk0p2' + - !'init=/usr/lib/raspi-config/init_resize.sh' command: 'rootfs label': exit-status: 0 From 928df9e3963942ac489f6a7a45b62cca55da76b4 Mon Sep 17 00:00:00 2001 From: Gildas Le Nadan <3ntr0p13+github@gmail.com> Date: Sat, 28 Dec 2024 12:41:01 +1000 Subject: [PATCH 2/2] We want those two lines alongside others, removing "and" --- goss/goss_system.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/goss/goss_system.yaml b/goss/goss_system.yaml index 4d8d1fe..a62cae0 100644 --- a/goss/goss_system.yaml +++ b/goss/goss_system.yaml @@ -17,9 +17,8 @@ file: filetype: file mode: 644 contents: - and: - - 'LABEL=boot /boot' - - 'LABEL=rootfs /' + - 'LABEL=boot /boot' + - 'LABEL=rootfs /' /boot/cmdline.txt: exists: true owner: root