// This test verifies that the full command line for the process is
// returned with specific arguments redacted.
TEST_F(ProcessSpawnTest, getCommandLineRedacted) {
- {
- // Case 1: arguments present.
- ProcessArgs args;
- args.push_back("db-init");
- args.push_back("mysql");
- args.push_back("--host");
- args.push_back("example.com");
- args.push_back("--user");
- args.push_back("someone");
- args.push_back("--password");
- args.push_back("sesame");
- args.push_back("--other");
- args.push_back("stuff");
- args.push_back("foo");
+ // Case 1: arguments present.
+ ProcessArgs args;
+ args.push_back("db-init");
+ args.push_back("mysql");
+ args.push_back("--host");
+ args.push_back("example.com");
+ args.push_back("--user");
+ args.push_back("someone");
+ args.push_back("--password");
+ args.push_back("sesame");
+ args.push_back("--other");
+ args.push_back("stuff");
+ args.push_back("foo");
- ProcessSpawn process(ProcessSpawn::ASYNC, TEST_SCRIPT_SH, args);
- std::string expected = TEST_SCRIPT_SH;
- expected += " db-init mysql --host example.com --user ***** --password ***** --other stuff foo";
- std::unordered_set<std::string> redact_args = { "--user", "--password", "--not-there" };
- EXPECT_EQ(expected, process.getCommandLine(redact_args));
- }
+ ProcessSpawn process(ProcessSpawn::ASYNC, TEST_SCRIPT_SH, args);
+ std::string expected = TEST_SCRIPT_SH;
+ expected += " db-init mysql --host example.com --user ***** --password ***** --other stuff foo";
+ std::unordered_set<std::string> redact_args = { "--user", "--password", "--not-there" };
+ EXPECT_EQ(expected, process.getCommandLine(redact_args));
}
} // end of anonymous namespace
ProcessSpawn kea_admin(ProcessSpawn::SYNC, KEA_ADMIN_, kea_admin_parameters, vars,
/* inherit_env = */ true);
DB_LOG_INFO(MYSQL_INITIALIZE_SCHEMA)
- .arg(kea_admin.getCommandLine(std::unordered_set<std::string>{"--user", "--password"}));
+ .arg(kea_admin.getCommandLine(std::unordered_set<std::string>{"--password"}));
pid_t const pid(kea_admin.spawn());
if (kea_admin.isRunning(pid)) {
isc_throw(SchemaInitializationFailed, "kea-admin still running");
ProcessSpawn kea_admin(ProcessSpawn::SYNC, KEA_ADMIN_, kea_admin_parameters, vars,
/* inherit_env = */ true);
DB_LOG_INFO(PGSQL_INITIALIZE_SCHEMA)
- .arg(kea_admin.getCommandLine(std::unordered_set<std::string>{"--user", "--password"}));
+ .arg(kea_admin.getCommandLine(std::unordered_set<std::string>{"--password"}));
pid_t const pid(kea_admin.spawn());
if (kea_admin.isRunning(pid)) {
isc_throw(SchemaInitializationFailed, "kea-admin still running");