From e99b8b05204ccc1be6cfe4a23e3afa36d7c9686b Mon Sep 17 00:00:00 2001 From: server Date: Tue, 14 Apr 2026 08:49:30 +0200 Subject: [PATCH] tests: support env-backed smoke passwords --- tests/login_smoke.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/login_smoke.cpp b/tests/login_smoke.cpp index 86a8b42..a10523c 100644 --- a/tests/login_smoke.cpp +++ b/tests/login_smoke.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -381,13 +382,28 @@ int main(int argc, char** argv) { try { - Expect(argc == 6, "usage: metin_login_smoke "); + Expect(argc == 6, + "usage: metin_login_smoke \n" + " or: metin_login_smoke --password-env=ENV_NAME"); const std::string host = argv[1]; const uint16_t auth_port = static_cast(std::stoi(argv[2])); const uint16_t channel_port = static_cast(std::stoi(argv[3])); const std::string login = argv[4]; - const std::string password = argv[5]; + std::string password; + + const std::string password_arg = argv[5]; + const std::string prefix = "--password-env="; + if (password_arg.rfind(prefix, 0) == 0) + { + const char* value = std::getenv(password_arg.substr(prefix.size()).c_str()); + Expect(value && *value, "password environment variable is empty"); + password = value; + } + else + { + password = password_arg; + } Expect(login.size() <= LOGIN_MAX_LEN_LOCAL, "login too long"); Expect(password.size() <= PASSWD_MAX_LEN_LOCAL, "password too long");