Skip to content

Commit ed5b166

Browse files
committed
Modify upgrade test to check quoted kargs
This covers the issue reported in ostreedev/ostree#3544 Signed-off-by: John Eckersberg <jeckersb@redhat.com>
1 parent d5df176 commit ed5b166

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tmt/tests/booted/test-image-pushpull-upgrade.nu

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ use tap.nu
1010
const kargsv0 = ["testarg=foo", "othertestkarg", "thirdkarg=bar"]
1111
const kargsv1 = ["testarg=foo", "thirdkarg=baz"]
1212
let removed = ($kargsv0 | filter { not ($in in $kargsv1) })
13+
const quoted_karg = '"thisarg=quoted with spaces"'
1314

1415
# This code runs on *each* boot.
1516
# Here we just capture information.
1617
bootc status
1718
let st = bootc status --json | from json
1819
let booted = $st.status.booted.image
20+
let is_composefs = ($st.status.booted.composefs? != null)
1921

2022
# Parse the kernel commandline into a list.
2123
# This is not a proper parser, but good enough
@@ -76,6 +78,13 @@ RUN echo test content > /usr/share/blah.txt
7678
let new_root_mtime = ls -Dl /ostree/bootc | get modified
7779
assert ($new_root_mtime > $orig_root_mtime)
7880

81+
# Test for https://github.com/ostreedev/ostree/issues/3544
82+
# Add a quoted karg using rpm-ostree if available
83+
if not $is_composefs {
84+
print "Adding quoted karg via rpm-ostree to test ostree issue #3544"
85+
rpm-ostree kargs --append=($quoted_karg)
86+
}
87+
7988
# And reboot into it
8089
tmt-reboot
8190
}
@@ -125,6 +134,14 @@ def second_boot [] {
125134
assert ($x in $cmdline)
126135
}
127136

137+
# Test for https://github.com/ostreedev/ostree/issues/3544
138+
# Verify the quoted karg added via rpm-ostree is still present
139+
if not $is_composefs {
140+
print "Verifying quoted karg persistence (ostree issue #3544)"
141+
let cmdline = open /proc/cmdline
142+
assert ($quoted_karg in $cmdline) $"Expected quoted karg ($quoted_karg) not found in cmdline"
143+
}
144+
128145
# Now do another build where we drop one of the kargs
129146
let td = mktemp -d
130147
cd $td
@@ -169,6 +186,14 @@ def third_boot [] {
169186
assert not ($removed in $cmdline)
170187
}
171188

189+
# Test for https://github.com/ostreedev/ostree/issues/3544
190+
# Verify the quoted karg added via rpm-ostree is still present after upgrade
191+
if not $is_composefs {
192+
print "Verifying quoted karg persistence after upgrade (ostree issue #3544)"
193+
let cmdline = open /proc/cmdline
194+
assert ($quoted_karg in $cmdline) $"Expected quoted karg ($quoted_karg) not found in cmdline after upgrade"
195+
}
196+
172197
tap ok
173198
}
174199

0 commit comments

Comments
 (0)