MCPcopy Create free account
hub / github.com/canonical/multipass / TEST_F

Function TEST_F

tests/test_ssh_process.cpp:51–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49} // namespace
50
51TEST_F(SSHProcess, can_retrieve_exit_status)
52{
53 ssh_channel_callbacks callbacks{nullptr};
54 auto add_channel_cbs = [&callbacks](ssh_channel, ssh_channel_callbacks cb) {
55 callbacks = cb;
56 return SSH_OK;
57 };
58 REPLACE(ssh_add_channel_callbacks, add_channel_cbs);
59
60 int expected_status{42};
61 auto event_dopoll = [&callbacks, &expected_status](auto...) {
62 if (!callbacks)
63 return SSH_ERROR;
64 callbacks->channel_exit_status_function(nullptr, nullptr, expected_status, callbacks->userdata);
65 return SSH_OK;
66 };
67 REPLACE(ssh_event_dopoll, event_dopoll);
68 auto proc = session.exec("something");
69 EXPECT_THAT(proc.exit_code(), Eq(expected_status));
70}
71
72TEST_F(SSHProcess, exit_code_times_out)
73{

Callers

nothing calls this directly

Calls 6

exit_codeMethod · 0.80
read_std_outputMethod · 0.80
read_std_errorMethod · 0.80
EXPECT_THROWFunction · 0.70
execMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected