2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-29 22:02:20 +00:00

test(xcat-core): capture the empty candidate list of mysqlsetup

mysqlsetup -i reports

    comment the bind-address line failed: cannot read : No such file or
    directory

on every MySQL cluster, with no file named. Measured on xcat185-mn-tmp-84
through SN_setup_case, which then stops: the Kea configuration and the
service node install never happen.

@BIND_FILES is assigned by a top-level statement that sits below the main
flow's exit, so the statement never runs and the list is empty at run time.
$BIND_FILES[-1] is then undef. Each case in the test localizes the list, so
none of them read the value the script itself holds.

The test now asserts the list of the loaded script. 2 of its 15 checks fail
on this commit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-10-14 18:48:54 -03:00
parent 7f5cf08ad8
commit 2f5a4dbd3a
@@ -29,6 +29,18 @@ my ($help, $load_error);
die("Unable to load mysqlsetup: $load_error")
unless ref($load_error) eq 'MysqlSetupTestExit' && $load_error->{status} == 0;
# THE SECOND DEFECT. The candidate list was a top-level statement below the
# main flow's exit, so it never ran and the list was empty at run time: every
# call reported "cannot read : No such file or directory". Each case below
# localizes the list, so only this check sees the loaded script's own value.
{
no warnings 'once';
ok(scalar(@main::BIND_FILES) > 0, 'the loaded script has candidate files');
is_deeply([ @main::BIND_FILES ],
[ '/etc/mysql/mariadb.conf.d/50-server.cnf', '/etc/mysql/my.cnf', '/etc/my.cnf' ],
'... the three the POD names, in order');
}
my $CONF = <<'CONF';
[mysqld]
datadir=/var/lib/mysql