From 9da2d71b90bc1a658b7de77c56be651a3fc41774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Fri, 21 Aug 2026 20:11:31 -0300 Subject: [PATCH] test(genesis): cover legacy destiny retries --- xCAT-test/unit/genesis_openembedded_runtime.t | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/xCAT-test/unit/genesis_openembedded_runtime.t b/xCAT-test/unit/genesis_openembedded_runtime.t index bccdc520c..435f2525f 100644 --- a/xCAT-test/unit/genesis_openembedded_runtime.t +++ b/xCAT-test/unit/genesis_openembedded_runtime.t @@ -216,6 +216,8 @@ write_file( printf 'openssl %s\n' "$*" >>"$XCAT_TEST_LOG" [ -z "${XCAT_TEST_OPENSSL_DELAY-}" ] \ || exec sleep "$XCAT_TEST_OPENSSL_DELAY" +[ -z "${XCAT_TEST_OPENSSL_STATUS-}" ] \ + || exit "$XCAT_TEST_OPENSSL_STATUS" cat "$XCAT_TEST_RESPONSE_FILE" SH ); @@ -291,6 +293,47 @@ ENV 'a failed request preserves prior metadata' ); +is( + terminate_command( + \%environment, + '/bin/bash', $getdestiny_script, '192.0.2.10:3001' + ), + 143, + 'legacy getdestiny retries an explicit error response' +); + +{ + my %failure_environment = ( + %environment, + XCAT_TEST_OPENSSL_STATUS => 1, + ); + is( + terminate_command( + \%failure_environment, + '/bin/bash', $getdestiny_script, '192.0.2.10:3001' + ), + 143, + 'legacy getdestiny retries a connection failure' + ); +} + +write_file( $destiny_response, "\n" ); +( $destiny_status, $destiny_output ) = capture_command( + \%environment, + '/bin/bash', $getdestiny_script, '192.0.2.10:3001' +); +is( $destiny_status, 0, + 'legacy getdestiny accepts a response without a destiny' ); +is( $destiny_output, "\n", + 'legacy getdestiny returns an empty destiny' ); + +( $destiny_status, $destiny_output ) = capture_command( + \%environment, + '/bin/bash', $getdestiny_script, '192.0.2.10:3001', '--once' +); +isnt( $destiny_status, 0, + 'one-shot getdestiny rejects a response without a destiny' ); + write_file( $destiny_response, <<'XML'