Skip to content

Commit cc801ec

Browse files
authored
Fix test_net to not depend on system sni.yaml (#12736)
Configure proxy.config.ssl.servername.filename to use the unit test's sni_conf_test.yaml before calling SNIConfig::reconfigure(). This ensures the test is self-contained and does not fail when the system-level sni.yaml file does not exist. Fixes: #12353
1 parent 0e42870 commit cc801ec

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/iocore/net/unit_tests/test_SSLSNIConfig.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#define _XSTR(s) _STR(s)
3030

3131
#include "iocore/net/SSLSNIConfig.h"
32+
#include "records/RecCore.h"
3233

3334
#include <catch2/catch_test_macros.hpp>
3435

@@ -173,6 +174,11 @@ TEST_CASE("Test SSLSNIConfig")
173174

174175
TEST_CASE("SNIConfig reconfigure callback is invoked")
175176
{
177+
// Point the config to the test file so reconfigure() doesn't depend on the
178+
// system sni.yaml file existing.
179+
RecSetRecordString("proxy.config.ssl.servername.filename", _XSTR(LIBINKNET_UNIT_TEST_DIR) "/sni_conf_test.yaml",
180+
REC_SOURCE_EXPLICIT);
181+
176182
int result{0};
177183
auto set_result{[&result]() { result = 42; }};
178184
SNIConfig::set_on_reconfigure_callback(set_result);

0 commit comments

Comments
 (0)