Skip to content

Commit

Permalink
Merge #2191
Browse files Browse the repository at this point in the history
2191: Fix compilation with Clang 12 on Linux. r=Saviq a=luis4a0

Clang is picky with lambda captures.

Co-authored-by: Luis Peñaranda <luis.penaranda@canonical.com>
  • Loading branch information
bors[bot] and luis4a0 authored Aug 5, 2021
2 parents 12d1164 + 3258c6a commit c9fa525
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/qemu/test_firewall_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,24 +192,25 @@ TEST_F(FirewallConfig, dtorDeleteErrorLogsErrorAndContinues)

TEST_P(FirewallToUseTestSuite, usesExpectedFirewall)
{
const auto& [expected_firewall, nft_response, legacy_response] = GetParam();
const auto& param = GetParam();

mpt::MockProcessFactory::Callback firewall_callback = [&nft_response, &legacy_response](mpt::MockProcess* process) {
mpt::MockProcessFactory::Callback firewall_callback = [&param](mpt::MockProcess* process)
{
if (process->program() == "iptables-nft" && process->arguments().contains("--list-rules"))
{
EXPECT_CALL(*process, read_all_standard_output()).WillOnce(Return(nft_response));
EXPECT_CALL(*process, read_all_standard_output()).WillOnce(Return(std::get<1>(param)));
}
else if (process->program() == "iptables-legacy" && process->arguments().contains("--list-rules"))
{
EXPECT_CALL(*process, read_all_standard_output()).WillOnce(Return(legacy_response));
EXPECT_CALL(*process, read_all_standard_output()).WillOnce(Return(std::get<2>(param)));
}
};

auto factory = mpt::MockProcessFactory::Inject();
factory->register_callback(firewall_callback);

logger_scope.mock_logger->screen_logs(mpl::Level::info);
logger_scope.mock_logger->expect_log(mpl::Level::info, expected_firewall);
logger_scope.mock_logger->expect_log(mpl::Level::info, std::get<0>(param));

mp::FirewallConfig firewall_config{goodbr0, subnet};
}
Expand Down

0 comments on commit c9fa525

Please sign in to comment.