2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-04 20:17:55 +00:00
Files
xcat-core/xCAT-server/lib
Daniel Hilst 00ef09add2 test(xcat-core): assert the Subiquity install behaviour instead of the source that implements it
The tests added with this fix matched regexes against the text of debian.pm, Postage.pm and
compute.subiquity.tmpl. A source match cannot tell whether the code it found ever runs: moving
the Subiquity command line into its own routine leaves every one of those assertions passing,
and reformatting a line fails them while the behaviour is untouched. One of them pinned Perl
syntax outright, qr/\$kcmdline\s*\.=\s*" ---";/, and another matched the text of a substitution.

Run the code instead.

Two decisions were lifted out of the routines that had grown around them, so a test can call
them: subiquity_kcmdline() in debian.pm builds the installer command line from its inputs, and
defer_syncfiles_to_postboot() in Postage.pm returns the adjusted postscript lists. Both are pure
and carry the reasoning that used to sit inline. The callers keep their behaviour exactly.

The template's two shell fragments are extracted and executed: the boot flip runs against a
stand-in for xcatd on the install-monitor port, and the resolv.conf step runs with a getent that
answers as the case requires.

Every assertion now fails when the behaviour it describes is removed, which is what the source
matches only appeared to do:

  boot=casper dropped from the command line     1 assertion fails
  toram dropped                                 1 assertion fails
  nfsroot given the host name instead of the IP 2 assertions fail
  the deferral made a no-op                     7 assertions fail
  the wrong token sent to xcatd                 1 assertion fails
  the failed-flip log line removed              3 assertions fail
  the retry loop reduced to one attempt         2 assertions fail
  resolv.conf given the host name               3 assertions fail
  the resolution fallback removed               2 assertions fail

ubuntu_subiquity_bootparams.t is removed. Its three matches are covered by execution in
debian_subiquity_netboot.t, and it demonstrated the problem: it still passed after the command
line moved into another routine.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-08-26 17:31:46 -03:00
..