2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-10-22 15:48:14 +00:00
Files
xcat-core/xCAT-test/blackboxtest/conf/prov/xcatd-postscript.conf
T
Daniel Hilst db170bad60 test(blackboxtest): require an answer behind each negative assertion
Several assertions held when nothing answered. Renew and rebind compared
the ACK with itself, because the step rebinds $lease before its
assertions run. tftp-escape, outside-the-aliases, monitor-is-not-tls,
postscript-unknown-client and the two credential refusals passed on a
closed port or a timeout.

Renew and rebind now compare with the earlier request, and validate
rejects an assertion on an alias its own step rebinds. Each negative
check now also requires the server to have answered: a TFTP error code,
an HTTP status, a TLS handshake, or a plain-text reply on 3002, read
from the new xcatreq field transport_error.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-18 11:05:06 -03:00

161 lines
5.1 KiB
Plaintext

# Stage 12: getpostscript, on both transports. Spec P-57, P-58, P-67.
#
# The node fetches the script it runs after the installer finishes, over
# whichever transport it has: TLS 3001 during genesis, plain 3002 from
# `xcatdsklspost` inside the installed system. One script, two framings. Over
# 3001 the body arrives as <data> elements ended by <serverdone>. Over 3002
# there is no envelope, so xcatd writes `#END OF SCRIPT` after the last line
# (xcatd:554) and the client reads until it -- a body truncated without the
# marker reads as a hang and not an error. So the marker is asserted on the
# plain transport only.
#
# blackboxtest run \
# --set server=10.99.1.1 --set client=10.99.1.11 \
# --set unknown=10.99.1.201 --set node=provtestcn \
# --set xcatport=3001 --set monitorport=3002 \
# --set master=10.99.1.1 --set domain=provtest.cluster \
# conf/prov/xcatd-postscript.conf
[defaults]
server = %(server)s
bind = %(client)s
timeout = 30
retries = 2
# --- P-57 -------------------------------------------------------------------
[scenario postscript-terminated]
description = A known node's postscript arrives complete and is ended by the server
[step getpostscript]
type = xcatreq
port = %(xcatport)s
command = getpostscript
assert =
# The envelope's end marker on this transport. A response without it is a
# connection the node is still waiting on.
serverdone == yes
# And the body is this node's: the script is built per node, and a node
# that runs somebody else's sets up somebody else's network and keys.
text contains %(node)s
# The assignments the rest of the postscripts read, each rendered from somewhere
# else: NODE is the name xcatd resolved the connection to, MASTER comes from
# noderes.xcatmaster (mypostscript.tmpl:48), SITEMASTER and DOMAIN from the site
# table by way of #SITE_TABLE_ALL_ATTRIBS_EXPORT# (Postage.pm:411, 910-940).
# A directive that expands to nothing leaves the variable empty and every script
# that reads it then does nothing at all, quietly -- so the values are compared
# and not merely looked for.
#
# Each pattern begins at a line start or at a `>`, because on this transport the
# script arrives one line per <data> element, and ends before the closing tag
# rather than at whitespace for the same reason. Everything a #TABLE: directive
# produced is single-quoted (Postage.pm:1988-1989), which is the difference
# between NODE, written by the renderer itself, and the three below it.
[step nodename]
type = extract
from = $getpostscript.text
pattern = (?:^|>)NODE=([\w.-]+)
assert =
matched == yes
value == %(node)s
[step master]
type = extract
from = $getpostscript.text
pattern = (?:^|>)MASTER='([^']*)'
assert =
matched == yes
value == %(master)s
[step sitemaster]
type = extract
from = $getpostscript.text
pattern = (?:^|>)SITEMASTER='([^']*)'
assert =
matched == yes
value == %(master)s
[step domain]
type = extract
from = $getpostscript.text
pattern = (?:^|>)DOMAIN='([^']*)'
assert =
matched == yes
value == %(domain)s
# No directive survived into the body. Postage.pm substitutes them in one pass,
# so one still there is one nothing recognised, and the node runs
# `MASTER=#TABLE:noderes:provtestcn:xcatmaster#` as a command.
[step directives]
type = extract
from = $getpostscript.text
pattern = #(?:TABLE|TABLEBLANKOKAY|INCLUDE|CRYPT|ENV|XCATVAR|Subroutine):
assert =
matched == no
[step placeholders]
type = extract
from = $getpostscript.text
pattern = #(?:IPADDR|MASTER_IP_ADDR|ROUTES_VARS_EXPORT|SITE_TABLE_ALL_ATTRIBS_EXPORT)#
assert =
matched == no
# --- P-58 -------------------------------------------------------------------
[scenario postscript-unknown-client]
description = A client that maps to no node is given no node's script
[step leaked]
type = xcatreq
port = %(xcatport)s
command = getpostscript
bind = %(unknown)s
expect = any
# Whether xcatd answers this at all is a policy question; what must not happen
# is that it answers with somebody else's script. A postscript carries the
# node's name, its master and the credentials it is to install.
assert =
handshake == yes
[step leak]
type = extract
from = $leaked.text
pattern = %(node)s
assert =
matched == no
# --- P-67 -------------------------------------------------------------------
[scenario postscript-both-transports]
description = The same node gets the same script on 3001 and on 3002
[step overtls]
type = xcatreq
port = %(xcatport)s
command = getpostscript
assert =
serverdone == yes
[step marker]
type = extract
from = $overtls.text
# An assignment from the body specific to this node, used below as the thing the
# other transport has to agree about. A byte comparison of the responses would
# compare the envelopes and not the script. Unanchored because on this transport
# the line is wrapped in <data>.
pattern = (NODE=\S+)
assert =
matched == yes
[step overplain]
type = monitor
port = %(monitorport)s
send =
getpostscript
assert =
text contains #END OF SCRIPT
text contains $marker.value