Skip to content

Commit

Permalink
Merge pull request #1478 from prestist/debug-image-tests
Browse files Browse the repository at this point in the history
Update customize image test to fix ci
  • Loading branch information
prestist authored Jun 6, 2024
2 parents 6cae777 + 9e2933d commit 189f342
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 38 deletions.
10 changes: 5 additions & 5 deletions fixtures/customize/dest.bu
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ systemd:
Description=Dest Ignition Applied
Before=multi-user.target
ConditionPathExists=/etc/NetworkManager/system-connections/installer-test.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth1.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth2.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth1.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth2.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth1.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth2.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth1.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth2.nmconnection
ConditionKernelCommandLine=install-config-karg-1
ConditionKernelCommandLine=install-config-karg-2
ConditionKernelCommandLine=dest-karg
Expand All @@ -23,7 +23,7 @@ systemd:
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/grep -qz 'serial --unit=0 --speed=115200 --word=8 --parity=no.terminal_input serial.terminal_output serial.#' /boot/grub2/grub.cfg
ExecStart=/bin/grep -qz 'serial --unit=0 --speed=115200 --word=8 --parity=no.terminal_input serial.terminal_output serial.#' /boot/grub2/console.cfg
ExecStart=/bin/echo @applied-dest-ign@
StandardOutput=tty

Expand Down
2 changes: 1 addition & 1 deletion fixtures/customize/dest.ign
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"systemd": {
"units": [
{
"contents": "[Unit]\nDescription=Dest Ignition Applied\nBefore=multi-user.target\nConditionPathExists=/etc/NetworkManager/system-connections/installer-test.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth2.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth2.nmconnection\nConditionKernelCommandLine=install-config-karg-1\nConditionKernelCommandLine=install-config-karg-2\nConditionKernelCommandLine=dest-karg\nConditionKernelCommandLine=!ignition.platform.id=metal\nConditionKernelCommandLine=ignition.platform.id=qemu\nConditionKernelCommandLine=console=ttyS0,115200n8\n\n[Service]\nType=oneshot\nRemainAfterExit=true\nExecStart=/bin/grep -qz 'serial --unit=0 --speed=115200 --word=8 --parity=no.terminal_input serial.terminal_output serial.#' /boot/grub2/grub.cfg\nExecStart=/bin/echo @applied-dest-ign@\nStandardOutput=tty\n\n[Install]\nRequiredBy=multi-user.target\n",
"contents": "[Unit]\nDescription=Dest Ignition Applied\nBefore=multi-user.target\nConditionPathExists=/etc/NetworkManager/system-connections/installer-test.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth2.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth2.nmconnection\nConditionKernelCommandLine=install-config-karg-1\nConditionKernelCommandLine=install-config-karg-2\nConditionKernelCommandLine=dest-karg\nConditionKernelCommandLine=!ignition.platform.id=metal\nConditionKernelCommandLine=ignition.platform.id=qemu\nConditionKernelCommandLine=console=ttyS0,115200n8\n\n[Service]\nType=oneshot\nRemainAfterExit=true\nExecStart=/bin/grep -qz 'serial --unit=0 --speed=115200 --word=8 --parity=no.terminal_input serial.terminal_output serial.#' /boot/grub2/console.cfg\nExecStart=/bin/echo @applied-dest-ign@\nStandardOutput=tty\n\n[Install]\nRequiredBy=multi-user.target\n",
"enabled": true,
"name": "dest-ignition-applied.service"
}
Expand Down
4 changes: 2 additions & 2 deletions fixtures/customize/installer-test-nmstate-json.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"interfaces": [
{
"name": "nmstate-json-eth1",
"name": "nmstate-js-eth1",
"type": "ethernet",
"state": "up",
"ipv4": {
Expand All @@ -10,7 +10,7 @@
}
},
{
"name": "nmstate-json-eth2",
"name": "nmstate-js-eth2",
"type": "ethernet",
"state": "up",
"ipv4": {
Expand Down
4 changes: 2 additions & 2 deletions fixtures/customize/installer-test-nmstate-yaml.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
interfaces:
- name: nmstate-yaml-eth1
- name: nmstate-yl-eth1
type: ethernet
state: up
ipv4:
enabled: true
dhcp: true
- name: nmstate-yaml-eth2
- name: nmstate-yl-eth2
type: ethernet
state: up
ipv4:
Expand Down
8 changes: 4 additions & 4 deletions fixtures/customize/live.bu
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ systemd:
Before=coreos-installer.target
Before=multi-user.target
ConditionPathExists=/etc/NetworkManager/system-connections/installer-test.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth1.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth2.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth1.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth2.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth1.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth2.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth1.nmconnection
ConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth2.nmconnection

[Service]
Type=oneshot
Expand Down
2 changes: 1 addition & 1 deletion fixtures/customize/live.ign
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"systemd": {
"units": [
{
"contents": "[Unit]\nDescription=Live Ignition Applied\nBefore=coreos-installer.target\nBefore=multi-user.target\nConditionPathExists=/etc/NetworkManager/system-connections/installer-test.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-json-eth2.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yaml-eth2.nmconnection\n\n[Service]\nType=oneshot\nRemainAfterExit=true\nExecStart=/bin/echo @applied-live-ign@\nStandardOutput=tty\n\n[Install]\nRequiredBy=coreos-installer.target\nRequiredBy=multi-user.target\n",
"contents": "[Unit]\nDescription=Live Ignition Applied\nBefore=coreos-installer.target\nBefore=multi-user.target\nConditionPathExists=/etc/NetworkManager/system-connections/installer-test.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-js-eth2.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth1.nmconnection\nConditionPathExists=/etc/NetworkManager/system-connections/nmstate-yl-eth2.nmconnection\n\n[Service]\nType=oneshot\nRemainAfterExit=true\nExecStart=/bin/echo @applied-live-ign@\nStandardOutput=tty\n\n[Install]\nRequiredBy=coreos-installer.target\nRequiredBy=multi-user.target\n",
"enabled": true,
"name": "live-ignition-applied.service"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[connection]
id=nmstate-json-eth2
id=nmstate-js-eth2
type=ethernet

[ipv4]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[connection]
id=nmstate-yaml-eth1
id=nmstate-yl-eth1
type=ethernet

[ipv4]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[connection]
id=nmstate-yaml-eth2
id=nmstate-yl-eth2
type=ethernet

[ipv4]
Expand Down
56 changes: 36 additions & 20 deletions tests/images/customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,28 +145,44 @@ qemu_disk() {
}

assert() {
grep -Fq "$1" log
if grep -Fq "$1" log; then
echo "Assertion passed: '$1' found in log"
return 0
else
echo "Assertion failed: '$1' not found in log"
return 1
fi
}

assert_not() {
if grep -Fq "$1" log; then
echo "Assertion failed: '$1' found in log"
return 1
else
echo "Assertion passed: '$1' not found in log"
return 0
fi
}

check_live_noinstall() {
assert @applied-live-ign@
assert @applied-live-2-ign@
! assert @applied-dest-ign@
! assert @applied-dest-2-ign@
assert_not @applied-dest-ign@
assert_not @applied-dest-2-ign@
assert @did-not-install@
! assert @preinst-1@
! assert @preinst-2@
! assert @postinst-1@
! assert @postinst-2@
assert_not @preinst-1@
assert_not @preinst-2@
assert_not @postinst-1@
assert_not @postinst-2@
assert 'Adding "coreos-installer test certificate" to list of CAs'
}

check_live_install() {
assert @applied-live-ign@
assert @applied-live-2-ign@
! assert @applied-dest-ign@
! assert @applied-dest-2-ign@
! assert @did-not-install@
assert_not @applied-dest-ign@
assert_not @applied-dest-2-ign@
assert_not @did-not-install@
assert @preinst-1@
assert @preinst-2@
assert @postinst-1@
Expand All @@ -175,14 +191,14 @@ check_live_install() {
}

check_dest() {
! assert @applied-live-ign@
! assert @applied-live-2-ign@
assert_not @applied-live-ign@
assert_not @applied-live-2-ign@
assert @applied-dest-ign@
assert @applied-dest-2-ign@
! assert @preinst-1@
! assert @preinst-2@
! assert @postinst-1@
! assert @postinst-2@
assert_not @preinst-1@
assert_not @preinst-2@
assert_not @postinst-1@
assert_not @postinst-2@
assert 'Adding "coreos-installer test certificate" to list of CAs'
}

Expand Down Expand Up @@ -278,19 +294,19 @@ coreos-installer pxe customize src-initrd -o initrd
--network-keyfile "${fixtures}/installer-test.nmconnection" 2>&1 ||:) |
grepq "already specifies keyfile"
(iso_customize \
--network-keyfile "${fixtures}/nmstate-json-eth1.nmconnection" \
--network-keyfile "${fixtures}/nmstate-js-eth1.nmconnection" \
--network-nmstate "${fixtures}/installer-test-nmstate-json.json" 2>&1 ||:) |
grepq "already specifies keyfile"
(iso_customize \
--network-keyfile "${fixtures}/nmstate-json-eth2.nmconnection" \
--network-keyfile "${fixtures}/nmstate-js-eth2.nmconnection" \
--network-nmstate "${fixtures}/installer-test-nmstate-json.json" 2>&1 ||:) |
grepq "already specifies keyfile"
(iso_customize \
--network-keyfile "${fixtures}/nmstate-yaml-eth1.nmconnection" \
--network-keyfile "${fixtures}/nmstate-yl-eth1.nmconnection" \
--network-nmstate "${fixtures}/installer-test-nmstate-yaml.yaml" 2>&1 ||:) |
grepq "already specifies keyfile"
(iso_customize \
--network-keyfile "${fixtures}/nmstate-yaml-eth2.nmconnection" \
--network-keyfile "${fixtures}/nmstate-yl-eth2.nmconnection" \
--network-nmstate "${fixtures}/installer-test-nmstate-yaml.yaml" 2>&1 ||:) |
grepq "already specifies keyfile"
(iso_customize \
Expand Down

0 comments on commit 189f342

Please sign in to comment.