Skip to content

Commit

Permalink
[tests][lxd] Check returned interface names.
Browse files Browse the repository at this point in the history
  • Loading branch information
luis4a0 committed Jan 15, 2024
1 parent 6a752ba commit 04ae2b9
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/lxd/test_lxd_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2356,9 +2356,20 @@ TEST_F(LXDBackend, addsNetworkInterface)
EXPECT_EQ(times_called, 1u);
}

TEST_F(LXDBackend, backendReturnsCorrectBridgeName)
struct LXDNetworkNameTestSuite : LXDBackend, WithParamInterface<std::pair<std::string, std::string>>
{
};

TEST_P(LXDNetworkNameTestSuite, backendReturnsCorrectBridgeName)
{
const auto [name, ret] = GetParam();

CustomLXDFactory factory{std::move(mock_network_access_manager), data_dir.path(), base_url};

EXPECT_EQ(factory.bridge_name_for("eth7"), "br-eth7");
EXPECT_EQ(factory.bridge_name_for(name), ret);
}

INSTANTIATE_TEST_SUITE_P(LXDBackend,
LXDNetworkNameTestSuite,
Values(std::make_pair("enp4s0", "br-enp4s0"),
std::make_pair("enx586d8fd35b6c", "br-enx586d8fd35")));

0 comments on commit 04ae2b9

Please sign in to comment.